How can I get UUID of Services and Characteristics?

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

cross mob
Anonymous
Not applicable

 Hi

   

As Topic, I want to know how do i know UUID services and characteristics of BLE kit. I need it for Xcode.

0 Likes
1 Solution
Anonymous
Not applicable

Rules:

   

1) Custom Services, characteristics or descriptors (let us call them SCD) should never be 16-bit or 32-bit UUID.

   

2) Custom SCD can only be 128-bit UUID. Though there is no strict rule written about this in BLE spec, but that is what is STRONGLY preferred.

   

3) Ensure your 128-bit UUID is not the base BLE UUID (00000000-0000-1000-8000-00805F9B34FB)

   

4) The 16-bit or 32-bit UUID are converted to 128-bit UUID by changing the first 4 bytes of the base UUID.

   

For example, 0x2018 is represented as 00002018-0000-1000-8000-00805F9B34FB. So changing only the first 4 bytes of the base UUID does not mean that you are not clashing with the existing 16 or 32-bit UUID.

   

Ensure that you have some change in the rest of the bytes of base UUID.

   

Unfortunately, BLE spec does not tell how to create 128-bit UUIDs for custom SCD. Also, there is no registration that can be done for a custom 128-bit UUID, so you can never know if the one you choose is unique or not.

   

I suggest something like this:

   

Take the base UUID and mask out all the bytes except the first 4 bytes:

   

XXXXYYYY-0000-1000-8000-00805F9B34FB

   

Change the last 4 bytes (0x34FB in base UUID) to your company's ID.

   

Define all your custom SCD by changing values in XXXXYYYY. You can make such changes in the middle bytes too.

View solution in original post

0 Likes
11 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Since the BLE Kit is a programmable device, all characteristics are specified by YOU. When you open the sources in Creator 3.1 you will see what has been specified in the different examples and you may adjust the attributes to your own need.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

All standard service (heart rate, battery monitor, device information etc) and their corresponding characteristics UUIDs are assigned by SIG - https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx

   

Custom service UUIDs that are used on the Cypress BLE kit (Capsense LED demo for example) are specified in the respective service and characteristic declaration in the BLE component's Profile tab

0 Likes
Anonymous
Not applicable

So what I understand is that you can pick any UUID as long as it does not conflict with any predefined UUID from the GATT declarations, descriptors, characteristics, or services.  Is  this correct?

0 Likes
Anonymous
Not applicable

 Not exactly.

   

there are three types of UUID usages, 16-bit, 32-bit and 128-bit.

   

16-bit is generally used for standard services/characteristic/descriptors that have been defined by BLE SIG.,

   

BLE SIG does not make it 'illegal' to use a 16-bit UUID for custom attributes, but it does recommend that for custom services, you should use 128-bit UUID which does not match the base 128-bit UUID of BLE SIG.

   

This way, it will prevent clash of UUID that you may have used for today and BLE SIG defines something else, a standard service/characteristic, using it in the future.

   

- Rohit

0 Likes
Anonymous
Not applicable

Ok.  128 bits it is then.

   

My confusions stems from the BLE hands-on training seminar where we entered custom 16 bit UUIDs that are derived from the Bluetooth base UUID of 00000000-0000-1000-8000-00805F9B34FB.

0 Likes
Anonymous
Not applicable

 Agreed.

   

 

   

As I stated, BLE SIG does not say that such use is 'illegal', but does recommend using 128-bit UUID.

   

You may see some of the BLE Pioneer Kit example projects using 16-bit UUID (not existing in current BLE SIG domain) for custom service. The reason for 16-bit UUID for custom purpose, apart from many other, is ease of use and understanding. It may be overwhelming for few to understand what to generate and how to use the 128-bit UUID, when at their initial stage of learning BLE.

   

 

   

-Rohit

0 Likes
Anonymous
Not applicable

how can I choose the uuid for my custom services and characteristics ?

   

are there any rules for choosing them?

0 Likes
Anonymous
Not applicable

Rules:

   

1) Custom Services, characteristics or descriptors (let us call them SCD) should never be 16-bit or 32-bit UUID.

   

2) Custom SCD can only be 128-bit UUID. Though there is no strict rule written about this in BLE spec, but that is what is STRONGLY preferred.

   

3) Ensure your 128-bit UUID is not the base BLE UUID (00000000-0000-1000-8000-00805F9B34FB)

   

4) The 16-bit or 32-bit UUID are converted to 128-bit UUID by changing the first 4 bytes of the base UUID.

   

For example, 0x2018 is represented as 00002018-0000-1000-8000-00805F9B34FB. So changing only the first 4 bytes of the base UUID does not mean that you are not clashing with the existing 16 or 32-bit UUID.

   

Ensure that you have some change in the rest of the bytes of base UUID.

   

Unfortunately, BLE spec does not tell how to create 128-bit UUIDs for custom SCD. Also, there is no registration that can be done for a custom 128-bit UUID, so you can never know if the one you choose is unique or not.

   

I suggest something like this:

   

Take the base UUID and mask out all the bytes except the first 4 bytes:

   

XXXXYYYY-0000-1000-8000-00805F9B34FB

   

Change the last 4 bytes (0x34FB in base UUID) to your company's ID.

   

Define all your custom SCD by changing values in XXXXYYYY. You can make such changes in the middle bytes too.

0 Likes
Anonymous
Not applicable

Article on BT website talks about using a UUID generator

   

https://www.bluetooth.org/ticketing/view_article.cfm?action=article_comment&aid=396

0 Likes
Anonymous
Not applicable

Hi,

   

Suppose I have to use last 16 bits of UUID is "0x6212”"

   

Therefore, What would be my complete UUID for characterstic.

   

Please help.

   

Thanks,

   

Pravin

0 Likes

Hi,

If I use 16-bit uuid rather than 128-bit uuid, Programme behavior changes?

0 Likes