5.5.4.2.1 Attribute Table Definition
Each service or group of GATT attributes must define a fixed size attribute table that gets passed into GATT. This table, in simpleGATTProfile.c, is defined as follows:
Each attribute in the following table is of the type:
The elements of this attribute type are as follows:
- type: This is the UUID associated with the attribute. This UUID is defined as the following:
The length can be either ATT_BT_UUID_SIZE (2 bytes), or ATT_UUID_SIZE (16 bytes). The *uuid is a pointer to a number either reserved by Bluetooth SIG (defined in gatt_uuid.c) or a custom UUID in the profile.
- Permissions – This element enforces how and if a GATT client device can access the value of the attribute. Possible permissions are defined in gatt.h as the following:
- GATT_PERMIT_READ // Attribute is Readable
- GATT_PERMIT_WRITE // Attribute is Writable
- GATT_PERMIT_AUTHEN_READ // Read requires Authentication
- GATT_PERMIT_AUTHEN_WRITE // Write requires Authentication
- GATT_PERMIT_AUTHOR_READ // Read requires Authorization
- GATT_PERMIT_ENCRYPT_READ // Read requires Encryption
- GATT_PERMIT_ENCRYPT_WRITE // Write requires Encryption
Section 5.4 describes authentication, authorization, and encryption further.
- Handle – This is a placeholder in the table where GATTServApp assigns a handle. Handles are assigned sequentially.
- pValue – This is a pointer to the attribute value. The size cannot be changed after initialization. The maximum size is 512 octets.
The following sections provide examples of attribute definitions for common attribute types.