Charactaristic, Charactaristic Valueから構成
att.h
/// UUID - 128-bit type
struct att_uuid_128
{
/// 128-bit UUID
uint8_t uuid[ATT_UUID_128_LEN];
};
/// Characteristic Value Descriptor
struct att_char128_desc
{
/// properties
uint8_t prop;
/// attribute handle
uint8_t attr_hdl[ATT_HANDLE_LEN];
/// attribute type
uint8_t attr_type[ATT_UUID_128_LEN];
};
名称 | 値 | Bluetooth SIG | |
---|---|---|---|
GATT Primary Service Declaration | 0x2800 | Link | |
GATT Characteristic Declaration | 0x2802 | Link | |
Client Characteristic Configuration | 0x2902 | Link | 0x01: Notification有効, 0x02: Indication有効, 0x03: NotificationとIndicationを有効 |
Databaseへの登録
service databaseを attmdb_add_serviceで追加した後に、Serviceデータベースのそれぞれのattributeのために1回呼び出す。service bufferの中のattrite valueとattribure descriptionの構造体をallocateし、service description構造体のポインターのハンドルのTableを更新する。
uint8_t attmdb_add_attribute(uint16_t start_hdl, att_size_t max_length,
uint8_t uuid_len, uint8_t* uuid, uint16_t perm,
uint16_t *handle);
引数 | 意味 |
---|---|
start_hdl | Service start handle. |
max_length | Maximum attribute value. |
uuid_len | UUID length (2bytes - 16bits, or 4bytes - 32bits, or 16bytes - 128bits UUID). |
uuid | UUID value (as an array of bytes). |
perm | Attribute permission |
handle | Allocated attribute handle. |
NotidficationもIndicationも取りがねにならない、値の更新 (GATT Task内でおこなう)
uint8_t attmdb_att_set_value(uint16_t handle, att_size_t length, uint8_t* value);
引数 | 意味 |
---|---|
start_hdl | Service start handle. |
length | Size of new attribute value. |
value | Attribute value payload. |