Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble/audio: Modify BASS control point write access. #1833

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions nimble/host/audio/services/bass/src/ble_audio_svc_bass.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,16 @@ ble_svc_audio_bass_find_handler(uint8_t opcode)
static int
ble_svc_audio_bass_ctrl_point_write_access(struct ble_gatt_access_ctxt *ctxt, uint16_t conn_handle)
{
uint8_t opcode;
struct os_mbuf *om;
uint16_t mbuf_len = OS_MBUF_PKTLEN(ctxt->om);
struct ble_svc_audio_bass_ctrl_point_handler *handler;

uint8_t opcode = ctxt->om->om_data[0];
opcode = ctxt->om->om_data[0];

handler = ble_svc_audio_bass_find_handler(opcode);

if (!handler) {
if (handler == NULL) {
return BLE_SVC_AUDIO_BASS_ERR_OPCODE_NOT_SUPPORTED;
}

Expand All @@ -633,7 +636,12 @@ ble_svc_audio_bass_ctrl_point_write_access(struct ble_gatt_access_ctxt *ctxt, ui
return BLE_ATT_ERR_WRITE_REQ_REJECTED;
}

return handler->handler_cb(&ctxt->om->om_data[1], ctxt->om->om_len - 1, conn_handle);
ctxt->om = os_mbuf_pullup(ctxt->om, mbuf_len);
if (!ctxt->om) {
return BLE_ATT_ERR_UNLIKELY;
}

return handler->handler_cb(&om->om_data[1], mbuf_len - 1, conn_handle);
}

static int
Expand Down
Loading