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

why does GATT use Characteristic

Suppose I want my BT peripheral to provide Measured value of sensor X and Location of sensor.

Currently I have to send the following attributes

Service Attrinbute Characteristic attribute for measurement Attribute with actual measured value Characteristic attribute for location Attribute with actual location

Why do we need the Characteristic row? All the information in it seems redundant to me and and I can get all of the info by just looking at the columns of the Attribute with the actual value (e.g the three things in the value field of the Characteristic attribute

  1. read/write/notify can be judged from Permission column of the attribute corresponding to the value,
  2. UUID of measurement can be obtained from UUID column of the attribute corresponding to the value,
  3. Handle from the Handle column of the attribute corresponding to the value,

Hence, it just seems meaningless overhead to me?

I am sure I'm missing something, so enlighten me! :)

Parents
  • This is purely due to how the core spec defines it, as you probably know :)

    The characteristic declaration in the table exists mainly because it should be possible to discover the database layout and still keep the actual values locked by permission settings. GATT defines that all declarations should be readable, but the value handles can have varying permission settings through authorization or authentication.

    A declaration itself also has its own UUID saying what it is (e.g. 0x2803 for characteristic), meaning it is possible to enumerate every (primary/secondary) service or every characteristic in relatively few messages. It would of course be possible to simply skip the declaration part and strip out the metadata once asked for it, but you would have to introduce some concept of "sub-UUIDs" to preserve the same functionality you have today.

Reply
  • This is purely due to how the core spec defines it, as you probably know :)

    The characteristic declaration in the table exists mainly because it should be possible to discover the database layout and still keep the actual values locked by permission settings. GATT defines that all declarations should be readable, but the value handles can have varying permission settings through authorization or authentication.

    A declaration itself also has its own UUID saying what it is (e.g. 0x2803 for characteristic), meaning it is possible to enumerate every (primary/secondary) service or every characteristic in relatively few messages. It would of course be possible to simply skip the declaration part and strip out the metadata once asked for it, but you would have to introduce some concept of "sub-UUIDs" to preserve the same functionality you have today.

Children
No Data
Related