Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
94
Ver.1.0.0
3.4.2.3 uuid, uuidLen
As introduced above, UUID supports two types: BLE standard 2-byte UUID, and Telink
proprietary 16-
byte UUID. The “uuid” and “uuidLen” can be used to describe the two
UUID types simultaneously.
The
“uuid” is an u8-type pointer, and “uuidLen” specifies current UUID length, i.e. the
uuidLen bytes starting from the pointer are current UUID. Since Attribute Table and all
UUIDs are stored in F
lash, the “uuid” is a pointer pointing to Flash.
1) BLE standard 2-byte UUID:
For example, f
or Attribute “devNameCharacter” with Attribute Handle of 2, related
code is shown as below:
#define GATT_UUID_CHARACTER 0x2803
static const u16 my_characterUUID = GATT_UUID_CHARACTER;
{0, 1,
2
, sizeof(my_devNameCharacter),
(u8*)(&my_characterUUID)
,
(u8*)(&my_devNameCharacter), 0,0},
“UUID=0x2803” indicates “character” in BLE and the “uuid” points to the address of
“my_characterUUID” in Flash. The “uuidLen” is 2. When Master reads this Attribute,
the UUID would be “0x2803”.
2) Telink proprietary 16-byte UUID :
For example, for Attribute of OTA, related code is shown as below:
#define
TELINK_SPP_DATA_OTA
{0x12,0x2B,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,
0x01,0x00}
const
u8
my_OtaUUID[16]
= TELINK_SPP_DATA_OTA;
{0,ATT_PERMISSIONS_RDWR,16,
sizeof
(my_OtaData),(
u8
*)(&my_OtaUUID),
(&my_OtaData), &otaWrite, &otaRead},
The “uuid” points to the address of “my_OtaUUID” in Flash, and the “uuidLen” is 16.
When Master reads this Attribute, the UUID would be
“0x000102030405060708090a0b0c0d2b12”.
3.4.2.4 pAttrValue, attrLen
Each
Attribute corresponds to an Attribute Value. The “pAttrValue” is an u8-type pointer
which points to starting address of Attribute Value in RAM/Flash
, while the “attrLen”
specifies the data length. When Master reads the Attribute Value of certain Attribute from
Slave, the “attrLen” bytes of data starting from the area (RAM/Flash) pointed by the
“pAttrValue” will be read by 5316 BLE SDK to Master.
Since UUID is read only,
the “uuid” is a pointer pointing to Flash; while Attribute Value
may involve write opera
tion into RAM, so the “pAttrValue” may points to RAM or Flash.
For Attribute hid Information with Attribute Handle being 35, related code is as shown
below
const u8 hidInformation[] =
{