
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
96
Ver.1.0.0
2) opcode = 0x52,
Write Command,
see
Core_v5.0
.
After Slave receives a write command above, if the callback function w is not set, Slave
will
automatically write the area pointed by the “pAttrValue” with the value sent from
Master, and the data length equals the “l2capLen” in Master packet format minus 3; if the
callback function w is set, Slave will execute user-defined callback function w after it
receives the write command, rather than writing data into the area pointed by the
“pAttrValue”. Note: Only one of the two write operations is allowed to take effect.
By setting the callback function w, user can process Write Request and Write Command
in ATT layer of Master. If the callback function w is not set, user needs to evaluate
whether the area pointed by “pAttrValue” can process the command (e.g. If the
“pAttrValue” points to Flash, write operation is not allowed; or if the “attrLen” is not long
enough for Master write operation, some data will be modified unexpectedly.).
Figure 3-32 Write Request in BLE Stack
Figure 3-33 Write Command in BLE Stack
The void-
type pointer “p” of the callback function w points to the value of Master write
command. Actually
“p” points to a memory area, the value of which is shown as the
following structure.
typedef struct
{
u32
dma_len
;
u8
type
;
u8
rf_len
;
u16
l2cap
; //l2cap_length
u16
chanid
;