Search code examples
iosbluetoothbluetooth-lowenergycore-bluetoothbtle

How to handle customized UUID's in Bluetooth Low Energy (BLE)


I would like to write an iOS APP to transfer some data to an embedded BLE Module and vice versa. To get the best structure of my data stream, I create my own characteristics and services with its corresponding UUID's. So far, everything is all right! But what happens, if I would like to add a second BLE Module without change my hard coded UUID's in my embedded BLE Module? Do I have to generate completely new UUID's for each BLE Module I would like to add? In this case I have to change my iOS App too, because I have to change my expected UUID's for the specific services and characteristics or? Thanks!


Solution

  • No you don't have to generate new UUID's for each BLE Module. Thats not the way it is designed to operate. Just make sure that you don't re-use the same UUID for any of the characteristic within the same BLE module.

    Thumb rule:

    1. I can't have a BLE module having two characteristics having the same UUID.
    2. I can't have a BLE module having two services having the same UUID.
    3. I can't have a BLE module having a UUID used once for a service and the same for a characteristics.
    4. I can definitely have theoretically infinite number of BLE modules having same GATT structure (that includes all the UUIDs).

    This is possible since the GATT Client (the application) distinguishes and accesses the connected GATT Servers by means of connection handles, which are out of scope from other GATT servers connected to the same application.