| | |
| | | * This class does all the work for setting up and managing Bluetooth |
| | | * connections with other devices. It has a thread that listens for |
| | | * incoming connections, a thread for connecting with a device, and a |
| | | * thread for performing data transmissions when connected. |
| | | * thread for amperforming data transmisspions when connected. |
| | | */ |
| | | public class BluetoothChatService { |
| | | // Debugging |
| | |
| | | msg.setData(bundle); |
| | | mHandler.sendMessage(msg); |
| | | |
| | | msg = mHandler.obtainMessage(Constants.MESSAGE_DEVICE_ADDRESS); |
| | | bundle = new Bundle(); |
| | | bundle.putString(Constants.DEVICE_ADDRESS, device.getAddress()); |
| | | msg.setData(bundle); |
| | | mHandler.sendMessage(msg); |
| | | |
| | | setState(STATE_CONNECTED); |
| | | |
| | | // Start the thread to manage the connection and perform transmissions |