I developed a Rhodes application that will run on a JANAM XM66 Windows Mobile 6 Device. The application connects to an Oniel 4te printer via bluetooth based on the Rhodes Bluetooth API. Since The device is not a motorolla device and the application was written under the SDK. version 2.2.6, i cannot use the APD approach .
Unfortunately i ran into a problem.
The original iteration of the program worked by creating a Bluetooth session every time i needed to print then immediately disconnect after printing. This was fine for a time, but because the device had to scan for all Bluetooth devices in the area every time i needed to connect, this was deemed impractical if i needed to print a lot of times or if there is a lot of Bluetooth devices within range. Unfortunately the "Connection without UI" approach to connect to a specific Bluetooth device is not available for Windows Mobile devices (only IOS and android devices) , so i am stuck with the slow way of creating a Bluetooth session.
So another approach was to make a longer lasting connection. I would connect to the device and only disconnected at the end of the day, I was able to change the Bluetooth time out values in the printer and make sure the handheld doesn't power off to ensure that there isn't a disconnection, but there is still 2 scenarios where the application freezes.
1) If the Bluetooth printer radio is turned off manually
2) The Bluetooth session disconnects due to the devices leaving Bluetooth range.
When either of these scenarios occur, i cant seem to find a way to get the status of the session, so when i blindly try to print, the application freezes on me.
I tried using the session call back routine in the Rhodes Bluetooth API, but that is not fired when the session disconnect.
I tried to query by using the get_status routine, but regardless of when it is connected or disconnected, it returns 0 (no data read).
I tried placing a exception handler , i.e
but it still freezes instead of going to he rescue clause.
I was able to duplicate this same occurrence using the standard Bluetooth Chat program bundled in with the Rhodes Sample API (https://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/BluetoothChat) , even with other Bluetooth devices (such as my phone) using the following steps
1) Connect to Bluetooth device as client.
2) send data
3) cause the session to terminate (by either turning off the other Bluetooth device's radio or having one of the devices to exit Bluetooth range).
4) attempt to send data again and watch the application freeze.
I sent a report to rhomobile.zendesk.com but in the end, they said that it seems to be a bug and they will follow up with their team, then forwarded me towards this site and their sales department for purchasing direct application support.
The question i have is has anyone else encountered this problem, and if so, were you able to fix it, and how?