- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
lets say I have a characteristic:
CHARACTERISTIC_UUID128 (0x0029, HANDLE_HELLO_SENSOR_VALUE_NOTIFY, UUID_HELLO_CHARACTERISTIC_NOTIFY,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY | LEGATTDB_CHAR_PROP_INDICATE,
LEGATTDB_PERM_READABLE, 7),
'H','e','l','l','o',' ','0',
now I want to change the message and its length and then send it:
void update_message( UINT8 *data, INT32 len)
{
int i;
BLEPROFILE_DB_PDU db_pdu;
bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);
for( i = 0; i<len; i++)
{
db_pdu.pdu = data;
}
db_pdu.len = len;
bleprofile_WriteHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);
ble_trace1("len1: %d\n", db_pdu.len);
bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);
ble_trace1("len2: %d\n", db_pdu.len);
}
the problem I am having with my above function is that the data gets modified correctly, but the length remains the same.
lets say I pass the new length to be 3.
At line 15 the output I get is 3.
but at line 18, after reading the handle back the output goes back to 7.
Then when I send my data over BLE, I send 3 bytes of my new data plus the original remaining bytes.
Is there a way to have the length of the data payload change? How can i do this?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try to add LEGATTDB_PERM_VARIABLE_LENGTH bit to the characteristic definition. For example
LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ
| LEGATTDB_PERM_VARIABLE_LENGTH