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
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
Accepted Solution

BluetoothListener with dataReceived issue

Purpose:

Receive data from a bluetooth sensor.

 

Problem:

dataReceived never be trigger.

 

Question:

Does anyone know how to debug or identify the issue??

How to check dataSent is correct or not??

 

Using serial port to connect the BT sensor.

_port2 = new BluetoothSerialPort(info2, 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);

 

 

Thank your attention,

 

 

-Fight with BB10
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.

Re: BluetoothListener with dataReceived issue

BluetoothDemo is my solution.

I import BB example/BluetoothDemo.

And then, change Hi There to the device name. 

 

Only change APP Screen. 

 

int numServices = _portInfo.length;

// Create a MenuItem for each Bluetooth device we can connect to.
if (numServices>0)
_rtf = new RichTextField(String.valueOf(numServices)+" device, Name: "+_portInfo[0].getDeviceName(), RichTextField.NON_FOCUSABLE);
else
_rtf = new RichTextField("No devices in pairing list", RichTextField.NON_FOCUSABLE);
add(_rtf);
//Create a MenuItem for each Bluetooth device we can connect to.
DeviceMenuItem deviceItems[] = new DeviceMenuItem[numServices];
for (int count = 0; count < numServices; count++) {
deviceItems[count] = new DeviceMenuItem("Connect to: " + _portInfo[count].getDeviceName(), _portInfo[count]);
addMenuItem(deviceItems[count]);
}

 

You can also download my sample code, which bases on bluetoothDemo, from sourceforge.

https://sourceforge.net/projects/blackberry71blu/

 

I can begin to develop coding with the BT sensor.

 

Cheers,

 

-Fight with BB10