Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Member
fender0656
Posts: 1
Registered: ‎07-01-2012
My Device: Curve 9360

BTSPP Issue Specific to OS 7.0 / 7.1

Hi Everyone,

 

We have a Bluetooth-enabled application that has seen much stability with BlackBerry OS 4, 5 and 6.  However, in recent tests with OS 7.0 and 7.1, we have run into some issues.  I should note our tests have been specific to BlackBerry 9360s.  I apologise in advance for the long post.

 

We have a simplistic Bluetooth device which initiates pairing and data transfer to our application for processing.  As such we are using the BTSPP to establish a server connection to which our Bluetooth client can connect.  For example:

 

ServerSocketConnection conn = (ServerSocketConnection) Connector.open
    ("btspp://localhost:00112233445566778899AABBCCDDEEFF;name=SSPEx" );

ServiceRecord serviceRecord = LocalDevice.getLocalDevice().getRecord(conn);

System.out.println(serviceRecord.getConnectionURL
    (ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false));
SocketConnection socket = (SocketConnection) conn.acceptAndOpen();

 

This process works perfectly until the BlackBerry is rebooted (battery dies / battery pulled).  Typically, it will continue accepting connections as it should.  However, on occasion the application does not get passed the data being transferred.  The only way to get it to work again is to either re-pair or keep on pulling the battery until it mysteriously starts working.

 

The issue seems to be in correlation with the server’s channel number changing.  For example, if I pair when the above code prints "btspp://A06CEC2C2294:2;authenticate=false;encrypt=false;master=false" and this URL remains the same after reboot, it all works fine.  On occasion, the channel number will change to 3 or 4 and all communication will break.  When it finally changes back to 2, or I re-pair, it works again.

 

Does anyone have any insight into this issue?  Why does the channel number sporadically change and seem to break the application?  Is there a way around this issue?

 

Thank you in advance!

Please use plain text.
Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: BTSPP Issue Specific to OS 7.0 / 7.1

Hi and welcome to the forums!

This behaviour is expected, the same channel may not persist through reboots. The suggestion would be to try the original channel, if not successful then you could perform a service discovery and reconnect to the target device.

Regards,
Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.