Skip to content

BLE: fix missing updates sent callback in GattServer using Cordio stack #7981

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

Merged
merged 2 commits into from
Sep 18, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -624,22 +624,30 @@ ble_error_t GattServer::write(
// successful
uint16_t conn_id = 0;
uint16_t conn_found = 0;
size_t updates_sent = 0;

while((conn_found < DM_CONN_MAX) && (conn_id < CONNECTION_ID_LIMIT)) {
if (DmConnInUse(conn_id) == true) {
++conn_found;
if (is_update_authorized(conn_id, att_handle)) {
uint16_t cccd_config = AttsCccEnabled(conn_id, cccd_index);
if (cccd_config & ATT_CLIENT_CFG_NOTIFY) {
AttsHandleValueNtf(conn_id, att_handle, len, (uint8_t*)buffer);
updates_sent++;
}
if (cccd_config & ATT_CLIENT_CFG_INDICATE) {
AttsHandleValueInd(conn_id, att_handle, len, (uint8_t*)buffer);
updates_sent++;
}
}
}
++conn_id;
}

if (updates_sent) {
handleDataSentEvent(updates_sent);
}

return BLE_ERROR_NONE;
}

Expand Down Expand Up @@ -674,16 +682,24 @@ ble_error_t GattServer::write(
}

// This characteristic has a CCCD attribute. Handle notifications and indications.
size_t updates_sent = 0;

if (is_update_authorized(connection, att_handle)) {
uint16_t cccEnabled = AttsCccEnabled(connection, cccd_index);
if (cccEnabled & ATT_CLIENT_CFG_NOTIFY) {
AttsHandleValueNtf(connection, att_handle, len, (uint8_t*)buffer);
updates_sent++;
}
if (cccEnabled & ATT_CLIENT_CFG_INDICATE) {
AttsHandleValueInd(connection, att_handle, len, (uint8_t*)buffer);
updates_sent++;
}
}

if (updates_sent) {
handleDataSentEvent(updates_sent);
}

return BLE_ERROR_NONE;
}

Expand Down