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

One Service with Multiple Characteristics or Multiple Services with Single Characteristic each?

Hi,

I wanted to know what is the recommended way of data transfer through ble if there are multiple sensors. Is Creating one service with multiple characteristics a good way or creating multiple services with one characteristic each the best option.

Parents
  • Hi soumil and Carles,

    To be fair there are some details which make difference, e.g. creating too many Services/Characteristics (= GATT handles) can make Service Discovery procedure (from GATT client side) longer - and I've seen cases where inefficient GATT Server profile made connection time longer by several seconds (speaking about generic "multi-application" BLE central stack such as mobile phones). So in case you don't care about connection "performance" (e.g. because you typically connect once and then operate in continuous connection for long time) or because you have control over both parts of BLE stack (GATT server as well as client) so you can make the discovery efficient then it's really almost equal approach (not mentioning that at some point you need to scale GATT table in Nordic Soft Device as well). If you want to overcome these drawbacks of "many Services and Characteristics" approach and your device is "single application" (meaning that all these sensors or "features" will be always accessed only by one app) then you can simply group everything into single Primary Service + Characteristic and define your own protocol on top of it. (I'd actually recommend this over creating of crowded GATT stack but choice is yours;)

    Cheers Jan

Reply
  • Hi soumil and Carles,

    To be fair there are some details which make difference, e.g. creating too many Services/Characteristics (= GATT handles) can make Service Discovery procedure (from GATT client side) longer - and I've seen cases where inefficient GATT Server profile made connection time longer by several seconds (speaking about generic "multi-application" BLE central stack such as mobile phones). So in case you don't care about connection "performance" (e.g. because you typically connect once and then operate in continuous connection for long time) or because you have control over both parts of BLE stack (GATT server as well as client) so you can make the discovery efficient then it's really almost equal approach (not mentioning that at some point you need to scale GATT table in Nordic Soft Device as well). If you want to overcome these drawbacks of "many Services and Characteristics" approach and your device is "single application" (meaning that all these sensors or "features" will be always accessed only by one app) then you can simply group everything into single Primary Service + Characteristic and define your own protocol on top of it. (I'd actually recommend this over creating of crowded GATT stack but choice is yours;)

    Cheers Jan

Children
Related