- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
During i call bleprofile_WriteHandle(UINT16 hdl, BLEPROFILE_DB_PDU *p_pdu), i find that the BLEPROFILE_DB_PDU structure as following:
// GATT_PDU
typedef PACKED struct
{
UINT8 len;
UINT8 header;
UINT8 pdu[LEATT_ATT_MTU-1];
} BLEPROFILE_DB_PDU;
The LEATT_ATT_MTU value is 23, so the max length of data i can update the characteristic is 22 bytes, if i define a characteristic whose value length is more than 22 bytes, how can i update using bleprofile_WriteHandle()? Although BLE spec requires the MTU of characteristic is 22, but i find if i define one characteristic value length more than 22, it will split into 2 packets and send to host.
Solved! Go to Solution.
- Labels:
-
BLE_PROFILE_CFG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
Yes LEATT_ATT_MTU is a 23. That's because MTU (maximum transmission unit) for BLE is 23 bytes.
However you can have a something called "long characteristic". Pretty much it's a characteristic that has length greater 23 bytes.
Reading and writing to characteristics from client are done by the BLE stack. So you don't have to worry about that.
There is an example of long characteristic in the SDK apps under "long_characteristic".
You can take a look at this app and test it with LightBlue or some other app equivalent to it.
Using LightBlue, I was able to easily read and write to the BLE device with long characteristic.
The app also shows how you can use bleprofile_ReadHandleData and bleprofile_WriteHandleData to read and write to long characteristic.
You can find this part in the interrupt handler function. Basically you allocate memory space big enough for the characteristic and use its pointer after casting it to BLEPROFILE_DB_PDU pointer. You don't actually use the struct. You just use its pointer type.
Let us know if this helps. Thank you.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
Yes LEATT_ATT_MTU is a 23. That's because MTU (maximum transmission unit) for BLE is 23 bytes.
However you can have a something called "long characteristic". Pretty much it's a characteristic that has length greater 23 bytes.
Reading and writing to characteristics from client are done by the BLE stack. So you don't have to worry about that.
There is an example of long characteristic in the SDK apps under "long_characteristic".
You can take a look at this app and test it with LightBlue or some other app equivalent to it.
Using LightBlue, I was able to easily read and write to the BLE device with long characteristic.
The app also shows how you can use bleprofile_ReadHandleData and bleprofile_WriteHandleData to read and write to long characteristic.
You can find this part in the interrupt handler function. Basically you allocate memory space big enough for the characteristic and use its pointer after casting it to BLEPROFILE_DB_PDU pointer. You don't actually use the struct. You just use its pointer type.
Let us know if this helps. Thank you.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content