If you have problems with the book, I recommend to read the PDF coming with the specification.
– Do you know how to start an inquiry (device search)?
– Do you know how to start a service search?
or said differently, if you code psm/channel numbers in JSR-82, you either do something very wrong or you really, really know what you are doing.
javax.bluetooth.DiscoveryAgent is your friend. For the start, use
UUID uuid = new UUID(0x1103L);
int security = ServiceRecord.NOAUTHENTICATE_NOENCRYPT;
boolean master = false;
LocalDevice local = LocalDevice.getLocalDevice();
DiscoveryAgent agent = local.getDiscoveryAgent();
String name = agent.selectService(uuid, security, master);
StreamConnection connection = (StreamConnection) Connector.open(name);
OutputStream out = connection.openOutputStream();
char return = '\r'; // allows to change it anytime
String command = "AT" + return;
byte b = command.getBytes("UTF-8")