WICED Smart BCM92073X Generate Your Own UUID

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

UUID Overview

UUID is to identify attributes such as services, characteristics and descriptors. Bluetooth SIG has reserved some UUIDs for standard attributes. Any implementer may generate any other UUID for their own use.

To understand how UUID works, please refer to Universally unique identifier and Globally unique identifier at Wikipedia.

UUID Generation

Tool on Linux

The uuidgen program creates a new UUID. The new UUID can reasonably be considered unique among all UUIDs created on the local system, and among UUIDs created on other systems in the past and in the future.

1.png

Tool on Windows

Please refer to document Create GUID on MSDN to generate UUID by tool guidgen.exe.

2.png

Tool Provided by Python

Module uuid in Python is to generate UUID. If all you want is a unique ID, you should probably call uuid1() or uuid4().

uuid.png

Define UUID in WICED Smart Applications

Suppose that we want to replace the UUID for service HELLO in example application “Hello Sensor” with a new one. Click copy in guidgen.exe and paste it here. And if we get a GUID as follows:

// {1B7E8251-2877-41C3-B46E-CF057C562023}

static const GUID <<name>>              = { 0x1b7e8251, 0x2877, 0x41c3, { 0xb4, 0x6e, 0xcf, 0x5, 0x7c, 0x56, 0x20, 0x23 } };

We should define UUID of HELLO service as follows:

#define UUID_HELLO_SERVICE                  0x23, 0x20, 0x56, 0x7c, 0x05, 0xcf, 0x6e, 0xb4, 0xc3, 0x41, 0x77, 0x28, 0x51, 0x82, 0x7e, 0x1b.

Please note that byte order need to be reversed when it’s defined in the source code.

Practice with Hello Sensor Application

Please change the UUID of service HELLO to a new value, run the application again and check the result.

3 Replies
Anonymous
Not applicable

I got my UUID from here:

Generate UUID

Is that unique for my application?

0 Likes
Anonymous
Not applicable

It depends on the algorithm how the UUID is generated.

There is probability of duplicates but it's extremely small.

Please check section Variants and versions and Random UUID probability of duplicates at Wikipeda

Unless you are sure the UUID generator implementation is from reliable source, please use one of implementations that are proven to be reliable.

0 Likes
Anonymous
Not applicable

As what I guess on the Windows UUIDs - often the date (and time) are used as starting value for the number generator. So, generating an UUID should be quite free of conflicts (to have same UUID generated by two different developers or even you generate a new one later). As long as all people use the same tool and generator.

Yes, for BLE we should use and just use the official ITU site:

http://www.itu.int/en/ITU-T/asn1/Pages/UUID/uuids.aspx

This makes sure: if everybody using it for BLE UUIDs - there might not be a conflict with using the same UUID.

Using something else, e.g.:

http://www.guidgenerator.com/

Does not guarantee that same starting value, same randomization is used (and you might use an already existing UUID). So, using other UUID tools for BLE can be very risky (not for you but for your clients using two different devices and having issues with same UUID in both).

BTW:

I suggest, before creating new UUIDs, if you need one for a service, attribute, characteristic, value, data type ... etc. - check out if BLE has already a well defined UUID. If so, please use it.
If WICED Sense would follow this approach as well - it makes the life easier: if you provide a temperature sensor - use the official, well known temperature UUID: so, any App can figure out as "there is a temperature" and use it. An App will work on different devices (with different temperature sensors but provided as a temperature feature). It makes also your life easier if your App can be reused on other devices or on other projects.

This should be the first place to look for an existing, well defined UUID:

Characteristics | Bluetooth Development Portal