I'm going to implement a custom BLE service. I found some tutorial online that choose their custom service UUID in the following way:
For service uuid, the third and fourth bytes are zero, such as:
3698-0000-82c9-4adb-90cd-792b53207775
and corresponding characteristic uuids have different value in third and fourth byte. But all other bytes are the same with that of service UUID, such as:
3698-0001-82c9-4adb-90cd-792b53207775
3698-0002-82c9-4adb-90cd-792b53207775
3698-0003-82c9-4adb-90cd-792b53207775
3698-0004-82c9-4adb-90cd-792b53207775
My question: it that just a common practice, or it is a mandatory requirement by BLE specification?
There is definitely no requirement for the service and characteristic UUIDs to have the same base, but I have seen it done multiple times so yes it is just common practise.
As an example, the Heart Rate service has a UUID of 0x180D, but it's characteristics have UUIDs of 0x2a37 (Heart Rate Measurement), 0x2a38 (Body Sensor Location), and 0x2a39 (Heart Rate Control Point).
In the Bluetooth Spec, only the following paragraph exists in relation to the Characteristic UUID format:-
The Characteristic UUID field is a 16-bit Bluetooth UUID or 128-bit UUID that describes the type of Characteristic Value. A client shall support the use of both 16-bit and 128-bit Characteristic UUIDs. A client may ignore any characteristic definition with an unknown Characteristic UUID. An unknown characteristic UUID is a UUID for an unsupported characteristic.
This can be found in the Bluetooth Specification Version 5.0, Vol 3, Part G, Section 3.3.1.3. As you can see, there is no reference to the characteristic UUID being related to the service UUID.
I hope this helps.
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