@@ -560,7 +560,7 @@ ble_error_t GattServer::read(
560
560
) {
561
561
// Check to see if this is a CCCD
562
562
uint8_t cccd_index;
563
- if (get_cccd_id (att_handle, cccd_index)) {
563
+ if (get_cccd_index_by_cccd_handle (att_handle, cccd_index)) {
564
564
if (connection == DM_CONN_ID_NONE) {
565
565
return BLE_ERROR_PARAM_OUT_OF_RANGE;
566
566
}
@@ -588,7 +588,7 @@ ble_error_t GattServer::write(
588
588
// Check to see if this is a CCCD, if it is the case update the value for all
589
589
// connections
590
590
uint8_t cccd_index;
591
- if (get_cccd_id (att_handle, cccd_index)) {
591
+ if (get_cccd_index_by_cccd_handle (att_handle, cccd_index)) {
592
592
if (len != sizeof (uint16_t )) {
593
593
return BLE_ERROR_INVALID_PARAM;
594
594
}
@@ -615,7 +615,7 @@ ble_error_t GattServer::write(
615
615
}
616
616
617
617
// return if the update does not have to be propagated to peers
618
- if (local_only || !has_cccd (att_handle)) {
618
+ if (local_only || !get_cccd_index_by_value_handle (att_handle, cccd_index )) {
619
619
return BLE_ERROR_NONE;
620
620
}
621
621
@@ -660,7 +660,7 @@ ble_error_t GattServer::write(
660
660
) {
661
661
// Check to see if this is a CCCD
662
662
uint8_t cccd_index;
663
- if (get_cccd_id (att_handle, cccd_index)) {
663
+ if (get_cccd_index_by_cccd_handle (att_handle, cccd_index)) {
664
664
if ((connection == DM_CONN_ID_NONE) || (len != 2 )) { // CCCDs are always 16 bits
665
665
return BLE_ERROR_PARAM_OUT_OF_RANGE;
666
666
}
@@ -677,7 +677,7 @@ ble_error_t GattServer::write(
677
677
}
678
678
679
679
// return if the update does not have to be propagated to peers
680
- if (local_only || !has_cccd (att_handle)) {
680
+ if (local_only || !get_cccd_index_by_value_handle (att_handle, cccd_index )) {
681
681
return BLE_ERROR_NONE;
682
682
}
683
683
@@ -1211,7 +1211,7 @@ GattCharacteristic* GattServer::get_auth_char(uint16_t value_handle)
1211
1211
return NULL ;
1212
1212
}
1213
1213
1214
- bool GattServer::get_cccd_id (GattAttribute::Handle_t cccd_handle, uint8_t & idx) const
1214
+ bool GattServer::get_cccd_index_by_cccd_handle (GattAttribute::Handle_t cccd_handle, uint8_t & idx) const
1215
1215
{
1216
1216
for (idx = 0 ; idx < cccd_cnt; idx++) {
1217
1217
if (cccd_handle == cccds[idx].handle ) {
@@ -1221,10 +1221,10 @@ bool GattServer::get_cccd_id(GattAttribute::Handle_t cccd_handle, uint8_t& idx)
1221
1221
return false ;
1222
1222
}
1223
1223
1224
- bool GattServer::has_cccd (GattAttribute::Handle_t char_handle) const
1224
+ bool GattServer::get_cccd_index_by_value_handle (GattAttribute::Handle_t char_handle, uint8_t & idx ) const
1225
1225
{
1226
- for (uint8_t cccd_index = 0 ; cccd_index < cccd_cnt; ++cccd_index ) {
1227
- if (char_handle == cccd_handles[cccd_index ]) {
1226
+ for (idx = 0 ; idx < cccd_cnt; ++idx ) {
1227
+ if (char_handle == cccd_handles[idx ]) {
1228
1228
return true ;
1229
1229
}
1230
1230
}
0 commit comments