I'm starting to work on Bluetooth in Android recently. I want to build an application that can read the data recorded by a sensor through bluetooth.
I have some sample code, but looks like I need another UUID of a different device.It looks like this:
private static final UUID MY_UUID = UUID
.fromString("00001101-0000-1000-8000-00805F9B34FB");
Later on in the code, it uses this UUID to make a connection:
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
I have done some research online, like [here][1]. I think I need a different UUID number for the new device I'm working on. How do I get the UUID number?
On the device, there are two lines of number saying:
SN: 1201L0023
BT: 10:00:E8:C5:16:85
Thanks in advance!
Jake
Set<BluetoothDevice> devices = BluetoothAdapter. getDefaultAdapter(). getBondedDevices(); BluetoothDevice glass = null; for (BluetoothDevice d : devices { ParcelUuid[] uuids = d. getUuids(); for (ParcelUuid p : uuids) { System.
Each service and characteristic has a universally unique id (UUID). You use these ids when setting up the communication with the BLE device from JavaScript. The UUIDs are usually found in the device documentation provided by the manufacturer.
Every single Bluetooth device has a unique 48-bit address, commonly abbreviated BD_ADDR. This will usually be presented in the form of a 12-digit hexadecimal value. The most-significant half (24 bits) of the address is an organization unique identifier (OUI), which identifies the manufacturer.
UUIDs are not tied to particular devices. They identify software services. Some UUIDs for defined profiles are set by BT. The UUIDs used with RFCOMM sockets like your example are arbitrary. You just need both sides to use the same one. In general, devices connect and then use service discovery protocol to find out what services (UUIDs) are supported on the remote device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With