This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UUID 128 bit

Hello I need help with 128 bit UUID for BLE. Could you explain me how to specify my own 128 bit uuid? Whether it should be unique?

Bluetooth specification refers to ITU-T X.667. There are 3 way to create unique UUID:

  • time based UUID
  • name based UUID
  • random-number-based UUID

I suppose the second method is useful. It implies I have UUID of 'name space identifier' and names for UUIDs that will be created from base UUID with hash function. I think company name can be used for 'name space identifier' and then I can create names for my services and attributes and then UUIDs using specification recommendations.

I use nRF51822 with softdevice. To define base UUID I have to use sd_ble_uuid_vs_add(). And then I can add my services with attributes. But their UUIDs will be obtained by defining only byte 12 and byte 13. And this does not match to name based UUIDs, because UUIDs obtained using hash function will be differ not only in 12 and 13 bytes.

Could you help me understand this please?

Best regards, Artem

  • Hi there,

    I use nRF51822 with softdevice. To define base UUID I have to use sd_ble_uuid_vs_add(). And then I can add my services with attributes. But their UUIDs will be obtained by defining only byte 12 and byte 13. And this does not match to name based UUIDs, because UUIDs obtained using hash function will be differ not only in 12 and 13 bytes.

    The nRF51 solution to handling 128-bit UUIDs is specially tailored for the low memory requirements of an embedded system. It consists of vendor specific 128-bit UUIDs that can be freely set to any value by the user. Those base UUIDs can then be further modified by changing the 2 lower bytes of the TimeLow portion of the UUID (bytes 12 and 13). If your UUIDs can't be extended with this mechanism simply set the base plus bytes 12 and 13 to your required value, but that will use up a base for each VS UUID that you require.

    We used this mechanism because it was the SIG's choice when shortening Bluetooth standard 128-bit UUIDs to 16 or 32 bits.

    EDIT: According to the spec: "UUID values outside of this range can be allocated as described in [ISO-11578] for any purpose the allocator desires."

    You can generate UUIDs here: www.itu.int/.../uuid.html

    Carles

  • Carles, thank you for your fats response,

    If I set my UUID to any arbitrary value, this may be will not be unique. So can I not worry about the fact that my UUID will not be unique?

  • According to the spec, all UUID values outside the range of the ones reserved by the spec are valid. Also UUIDs are universal by nature, so I believe that you can simply generate them using the tool linked and use them for your purposes. Because the TimeLow value is a timestamp, if you modify it you are effectively generating UUIDs extremely quickly (in time-based generation).

Related