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 Developer
Posts: 18
Registered: ‎08-13-2008
My Device: Not Specified

Bluetooth Port Initialization Errors

When I attempt to create a BluetoothSerialPort object my app will occasionally throw some erros.  

 

The three error messages I usually receive are..

"Radio is off" - This tends to occur when the radio is turned on, which makes no sense.

"All ports in use" - I'm assuming this occurs from not properly disconnecting a port before recreating it.

"SppOpen failed" - I have no idea what this is.

 

My main concern is with the 'SppOpen failed' error. My code to create the port is..

 

BluetoothSerialPortInfo[] portInfo = BluetoothSerialPort.getSerialPortInfo();  

BluetoothSerialPortInfo info = portInfo[pairedDevicesList.getSelectedIndex()]

 

port = new BluetoothSerialPort(info, BluetoothSerialPort.BAUD_115200, BluetoothSerialPort.DATA_FORMAT_PARITY_NONE | BluetoothSerialPort.DATA_FORMAT_STOP_BITS_1 | BluetoothSerialPort.DATA_FORMAT_DATA_BITS_8, BluetoothSerialPort.FLOW_CONTROL_NONE, 1024, 1024, this);

 

Sometimes when I invoke this it will throw that SppOpen error, and I have no idea why this occurs.  What does SppOpen failed even mean?

Thanks a lot for the help

 

 

 

BlackBerry Development Advisor
Posts: 15,698
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Bluetooth Port Initialization Errors

What BlackBerry model and handheld software version are you testing with?  You can see this under Options, About.  Are you able to reproduce this using handheld software version 4.5.0.x?  Are you seeing this with any Bluetooth device or just a specific one?

 

The following link contains an example on how to properly close connections. 

 

How To - Close connections 
Article Number: DB-00530

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 18
Registered: ‎08-13-2008
My Device: Not Specified

Re: Bluetooth Port Initialization Errors

The SppOpen failed error occurs quite frequently on OS 4.2.  I have also seen it on OS 4.1.  As for OS 4.5 I don't recall it being an issue.

 

I actually just noticed on OS 4.2 the SppOpen failed error has a number added to it such as 'SppOpen failed: 19'.  Not sure what the number means, but it changes everytime the error pops up.

 

Thank you for the response and the link.

 

 

 

 

BlackBerry Development Advisor
Posts: 15,698
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Bluetooth Port Initialization Errors

What scenarios trigger the error?  Is it reproducable?  Are you seeing it with more than 1 type of Bluetooth device?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 18
Registered: ‎08-13-2008
My Device: Not Specified

Re: Bluetooth Port Initialization Errors

I've tried about 5 or 6 different Bluetooth GPS devices and they all have the same issue.  On an OS 4.1 Blackberry device, I am able to reproduce it by connecting to a Bluetooth GPS device, when I turn off the GPS device after connecting, it will throw the SppOpen error.

 

It may be a problem with my code, because when I detect a disconnect, I will attempt to reconnect to the device.  This allows it to automatically reconnect when its turned back on, or comes within range again.  So it seems the error will pop up when i attempt to reconnect to a device that has been turned off.  Not sure if that warrants an error or not, it just seems a little strange since it acts a little different on OS 4.2.

 

OS 4.2 seems to throw the error when i initially try to connect to the device.  Even when the GPS device is turned on.  If I keep trying it will connect. 

 

For now I'm just catching the error and trying to reconnect.  It doesn't seem like a huge issue now, I'd just be nice to know exactly what is causing it.

 

 

Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: Bluetooth Port Initialization Errors

I know this is a very old post but I happen to have come across some information on the numeric codes that can accompany "SppOpen Fail: n" errors.

 

On the off chance this helps others:

 

Failed 1
Pending 2
In use 5
Busy 11
No resources 12
Not found 13
Device not found 14
Connection failed 15
Timeout 16
No connection 17
Invalid parm 18
In progress 19
Restricted 20
Invalid type 21
HCI init err 22
Not supported 23
SDP continue state 24
Cancelled 25

 

Not enormously clear I know but maybe it will offer some clues.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim