fix(ble_audio): Allow empty reading value for BLE Audio implementation

This commit is contained in:
Liu Linyan
2026-09-03 17:42:34 +08:00
committed by Linyan Liu
parent a86a78bb6a
commit 8180fab0d3
2 changed files with 11 additions and 1 deletions

View File

@@ -1759,7 +1759,7 @@ static void handle_gattc_read_chrc_event(struct bt_le_gattc_read_chrc_event *eve
goto end;
}
val = event->value;
val = READ_VALUE(event);
vlen = event->len;
/* By-UUID read: report the matched handle in params->by_uuid.start_handle (like

View File

@@ -81,6 +81,16 @@ struct bt_le_gattc_notify_rx_event {
((const void *)((_event)->value != NULL ? (const uint8_t *)(_event)->value \
: (const uint8_t *)""))
/* Same collision on the read path: NULL data marks the end of a read, so a lib read
* handler that sees it reports ATT invalid-length. A zero-length value is a real
* response - MCS 3.5 requires an empty Track Title when there is no current track -
* so keep the pointer non-NULL for the value callback. The adapter emits the
* end-of-read callback itself and still passes NULL there, so the two stay distinct.
*/
#define READ_VALUE(_event) \
((const uint8_t *)((_event)->value != NULL ? (const uint8_t *)(_event)->value \
: (const uint8_t *)""))
struct bt_le_gatts_notify_tx_event {
bool is_notify;
uint16_t conn_handle;