07-25-2013 09:52 AM
Solved! Go to Solution.
07-25-2013 03:23 PM
At this time (10.1), only SPP, GATT and LE functions are programatically available.
OBEX is normally implemented on top of SPP/RFCOMM - you would have to handle the bytes that make higher level protocols yourself.
Which device is the bt_spp_open_server failing on? Which OS version is running?
Can you paste more of your open code?
07-26-2013 07:36 AM
Thanks for your answer!
As I understood it, it would be possible to establish the bluetooth connection to the digital pen via SPP. For the byte per byte transfer I already have sample code in Java. For better reading the code (in Java) from above again:
// open ServerSocketConnection with a special 'serviceName': _server = (ServerSocketConnection) Connector.open('serviceName', Connector.READ_WRITE, false); ... connection = _server.acceptAndOpen(); DataInputStream dis = connection.openDataInputStream(); DataOutputStream dos = connection.openDataOutputStream(); // Process the incoming file byte per byte: DoSomething(dis, dos);
But what I don't know is how I the app is able to "get the info" that another device wants to send something. Yesterday I tried another 'serviceName' (the first I used worked with previous BB versions, but failed on BB10, this new one worked with Android devices) and this new one worked, which means I got no error, but the pen is still sending its files to the phone and not to the app.
My BB10 device is a Z10.
At this moment, I think, I would just need the method which sets up the "listening" for an incoming pen-connection. I thought this could be bt_spp_open_server, but I am really not sure.
If you need more information, please let me know. Right now I can't think of other lines of code which would help explaining my problem.
07-26-2013 08:23 AM
Ok ... interesting:
I tested again and with some bluetooth device deleting and new pairing I could make it work!
It seems that you have to first install (or debug) the app before you pair the device (in my case the digital pen) to the phone. This fact was not new to me, but I thought I did that before. What I also tried now was to pair the device from the phone instead initializing the pairing from the pen. I also thought I did that before, but I think, something else was not right before (the serviceName? Now it's the above mentioned second name).
Now it works as follows:
I took the SPP Chat Sample and on the phone I opened per button click the SPP Server. In the code I made one small adjustment in the ChatManager::startSPPServer() Method:
bt_spp_open_server((char *) "serviceName", (char *) SPP_SERVICE_UUID, 0, BTControllerSPPCallback, reinterpret_cast<long>(this)
where "serviceName" is the Name of my digital pen service record.
Maybe this info helps someone, too. We developed this kind of app for a number of devices and the order of actions to pair pen and phone is not always the same.
07-26-2013 09:53 AM - edited 07-26-2013 10:36 AM
You're saying that the pen doesn't ever connect if the service isn't there at pairing time?
I don't think this is a general Bluetooth problem - can the Pen refresh services?
This is fairly standard behaviour. The service won't be visible to a device that pairs when the application isn't running.