BlueGPS for J2ME – The Saga Continues
Aug 29
In my last post I mentioned that I was unable to retrieve the Bluetooth address of my GPS receiver, this wasn’t entirely accurate. I stumbled across Benhui’s Bluelet library that simplies Bluetooth device/service discovery. This worked like a charm but the problem turned out to be making a call for the first service record:
ServiceRecord r = bluelet.getFirstDiscoveredService();
kept returning null. Therefore I was unable to retrieve the connection URL for connecting to the device using the serial port profile. So what I had to do was build the URL manually from the device’s Bluetooth address. So in the Bluelet code I created a variable that stores the device address and was able to access it my MIDlet using:
url = “btspp://” + bluelet.btaddr + “:1″;
Notice the connection string built around the device address. I’ve successfully connected to the device and now it’s time to write the parser to decode the NMEA 0183 sentences.
