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
jamesvoltage
Posts: 10
Registered: ‎04-08-2009
My Device: Not Specified

How to change the baud rate for a bluetooth connection

I am trying to change the baud rate for a bluetooth connection I have established with my Blackberry, but I am not sure how to do it.  I am using the "Bluetooth Serial Port Demo" program which establishes a connection using the following code:

 

  

_bluetoothConnection =

(StreamConnection) Connector.open(info[0].toString(), connector.READ_WRITE); _din = _bluetoothConnection.openDataInputStream(); _dout = _bluetoothConnection.openDataOutputStream();

 

The other serial port demo program, "Bluetooth Sample" has a few lines that allow the baud rate to be changed, but I have not been able to make this program connect to my Bluetooth device. 

 

 

_port = new BluetoothSerialPort("Hi there", 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);

 Is there a way to change the baud rate when making the first type of connection to the Bluetooth?  Any help would be greatly appreciated.

 

 

 

Please use plain text.
New Developer
jamesvoltage
Posts: 10
Registered: ‎04-08-2009
My Device: Not Specified

Re: How to change the baud rate for a bluetooth connection

Ah I found out how to do it; in case anyone is interested it's in the CommConnection interface:

 

http://www.blackberry.com/developers/docs/4.3.0api/javax/microedition/io/CommConnection.html

Please use plain text.
Developer
tombz
Posts: 24
Registered: ‎04-22-2009
My Device: Not Specified

Re: How to change the baud rate for a bluetooth connection

Hi, I am running into the same problem and can't seem to get it to work with CommConnection. Could you give some more details?

 

I am assuming that you changed this:

 

 

_bluetoothConnection = (StreamConnection) Connector.open(info[0].toString(), connector.READ_WRITE);


to something like:

_bluetoothConnection = (CommConnection) Connector.open("something;baudrate=19600");

But what did you put in place of "something"? I can't figure it out. For the original case, I use "btspp://1000E8ADC202:1" and it works, but it doesn't work if I just append ";baudrate=19600" onto the end of it, like "btspp://1000E8ADC202:1;baudrate=19600";

Any hints would be much appreciated.

Thanks!
-Tom B.

 

Please use plain text.