Feedback
Feedback

If you are having issues with the exercises, please create a ticket on DevZone: devzone.nordicsemi.com
Click or drag files to this area to upload. You can upload up to 2 files.

Attribute table

To best visualize how attributes are stored in a GATT server, let’s examine an example attribute table. An attribute table is how attributes are stored in the GATT server. The attribute table below is derived from a custom service that we will create in exercise 2 of this lesson.

my_lbs attribute table

This attribute table depicts a custom service called “my_lbs”. The my_lbs service holds three characteristics:

  • Button Characteristic
  • LED Characteristic
  • MySensor Characteristic

Service declaration

The first line in the table declares this service with a service declaration attribute. As previously discussed, the Type field in a declaration attribute holds a unique SIG-defined value, and for service declarations, the UUID is 0x2800. There is no reason to write to a declaration attribute, therefore its permissions are always Read-only. Lastly, the value field of the service declaration attribute holds the UUID of the service it’s declaring.

Button characteristic

The Button characteristic is defined first. The Button characteristic is first declared with the Button Characteristic Declaration. The Type field of a characteristic declaration attribute is always 0x2803 to declare a characteristic and the permissions are always Read-only. The Value field holds the handle of the value attribute, properties, and the UUID of the characteristic it’s declaring.

Then comes the button characteristic value attribute which holds the actual user data, in this case, whether the button is pushed or not.

Lastly, since the button characteristic supports the Indicate operation, there is a CCCD to enable indications for the Button characteristic. The CCCD will always have the UUID 0x2902 and the permission to Read and write. In this specific table, we can see that the Indicate bit-field has been enabled. Notice that the CCCD isn’t referenced in the characteristic declaration like the value declaration is, but can be recognized by the distinct UUID.

Even though it is not refenced in the characteristic declaration, the central knows which characteristic it belongs to based on the handle, because it is listed “under” the characteristic declaration. All items under the characteristic declaration belong to that specific characteristic until there is a new characteristic declaration (UUID 0x2803) in the list.

Button characteristic definition

LED characteristic

After this comes the LED characteristic, which is very similar to the button characteristic. Notice that this characteristic only supports the Write operation, and therefore does not have a CCCD. It has only 2 characteristics, declaration and value.

LED characteristic definition

MySensor characteristic

Lastly, the definition of the MySensor characteristic, which only supports the Notify operation. Notice how the bitfield for the Notify operation has been enabled in the CCCD of the MySensor characteristic.

MySensor characteristic definition
Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.