Search code examples
bluetoothgatt

Varibale Number Of Characteristics in Custom GATT Service


I am defining a custom GATT profile and have some questions which I could not find definite answers of on Bluetooth specifications.

  1. Can there be multiple characteristics of same type (UUID) defined in a single service?

  2. Can there be variable number of characteristics of same type (UUID) in a service? For example, depending upon system operation, a peripheral can accumulate variable number of copies of some data. Can these copies be sent as characteristics to the central when asked for?

  3. Suppose we have a table of data and we want to give access to it in two forms – row wise and column wise. Can such a requirement be handled in terms of characteristics? I imagine it like if you request for reading the characteristic with UUID A, it will be read in rows and UUID B will be in columns; is it possible and the right way to do so?


Solution

  • I've just found this unanswered question. Not sure if it's still needed, but here's my answer:

    1. Yes. Page 2224 (Vol.3, PartG: Generic Attribute Profile: 3.3.1.Characteristic Declaration) of Core_v4.2.pdf says: "A service may have multiple characteristic definitions with the same Characteristic UUID".

    2. Yes, it's possible. But in this case you must implement ServiceChanged characteristic. See Vol.3, PartG: Generic Attribute Profile: 2.5.2.Attribute Caching and 7.1.Service Changed.

    3. Yes. It is up to your implementation to define what data is hidden behind custom characteristics.