As Topic, I want to know how do i know UUID services and characteristics of BLE kit. I need it for Xcode.
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.
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
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?
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.
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.
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.
how can I choose the uuid for my custom services and characteristics ?
are there any rules for choosing them?
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:
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.
Article on BT website talks about using a UUID generator