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

General question about services, characteristics, BLE connection

Hello, i recently followed your tutorial nAN-36 to understand how to add a custom service to my project. I managed to do this and i also created three characteristics to control RGB led on my board. However now i have some, i think, basic questions, but i am not able to find answers to it, so if anyone could answer my, i would appreciate.

  1. According to nAN-36, we need to create a scanResponse if we want to advertise our own custom service with its 128-bit UUID. Does this mean that, if i am creating a custom service, i will be able to create only one service, because i just don't have any more space for another custom service, since i have space only to advertise 31 bytes?

  2. Does every characteristic which i create, requires a handler? Can one handler be used to handle multiple characteristics write/read?

  3. Can you point me to an example which would show how to add and use a descriptor to a characteristic?

  4. Off-topic question: Do you have an example for a multiple master connection to a single slave?

Thank your for your support and wasting time in answering my questions. Regards.

  • Yes, the characteristic value can be of several bytes. For characteristics that are part of the GATT specifications the size is part of that specification (the format is known). For custom characteristics you can rely on the format being known in both ends. You can also add a characteristic presentation format descriptor which describes the format of the value, but I do not know much about that descriptor nor how widely it is actually used. Others may be able to fill you in on this.

    Basically what you suggest is correct, but be aware that if you store the value in application memory then that memory allocation must be adjusted accordingly. For the LBS examples the value is in SoftDevice memory (cccd_md.vloc = BLE_GATTS_VLOC_STACK;) which means what you wrote above is all that is needed.

  • You make things so clear Terje, thank you very much. Regards.

Related