Hi,
I tweaked the android bluetooth example to get my android device to
communicate with my UART Bluetooth module. I just changed the UUID to
communicate to the module.
My objective is to read data from a bluetooth device alternatively. I
was successful in storing the address of the devices selected. This is
how I am trying to connect to the devices alternatively:
case MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = new String(readBuf, 0, msg.arg1);
mConversationArrayAdapter.add(mConnectedDeviceName+": " +
readMessage);
if(status==0)
{
mChatService.stop();
BluetoothDevice device =
mBluetoothAdapter.getRemoteDevice(address);
mChatService.connect(device);
status =1;
break;
}
else {
mChatService.stop();
BluetoothDevice device =
mBluetoothAdapter.getRemoteDevice(address1);
mChatService.connect(device);
status =0;
}
The device successfully disconnects and reconnect successfully. This
activity repeats only for a few cycles then it stops connecting. I am
an inexperienced programmer and I am not sure how to establish a
robust mechanism.
Any thoughts would be appreciated.
Thanks,
Sai
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en