@@ -624,22 +624,30 @@ ble_error_t GattServer::write(
624
624
// successful
625
625
uint16_t conn_id = 0 ;
626
626
uint16_t conn_found = 0 ;
627
+ size_t updates_sent = 0 ;
628
+
627
629
while ((conn_found < DM_CONN_MAX) && (conn_id < CONNECTION_ID_LIMIT)) {
628
630
if (DmConnInUse (conn_id) == true ) {
629
631
++conn_found;
630
632
if (is_update_authorized (conn_id, att_handle)) {
631
633
uint16_t cccd_config = AttsCccEnabled (conn_id, cccd_index);
632
634
if (cccd_config & ATT_CLIENT_CFG_NOTIFY) {
633
635
AttsHandleValueNtf (conn_id, att_handle, len, (uint8_t *)buffer);
636
+ updates_sent++;
634
637
}
635
638
if (cccd_config & ATT_CLIENT_CFG_INDICATE) {
636
639
AttsHandleValueInd (conn_id, att_handle, len, (uint8_t *)buffer);
640
+ updates_sent++;
637
641
}
638
642
}
639
643
}
640
644
++conn_id;
641
645
}
642
646
647
+ if (updates_sent) {
648
+ handleDataSentEvent (updates_sent);
649
+ }
650
+
643
651
return BLE_ERROR_NONE;
644
652
}
645
653
@@ -674,16 +682,24 @@ ble_error_t GattServer::write(
674
682
}
675
683
676
684
// This characteristic has a CCCD attribute. Handle notifications and indications.
685
+ size_t updates_sent = 0 ;
686
+
677
687
if (is_update_authorized (connection, att_handle)) {
678
688
uint16_t cccEnabled = AttsCccEnabled (connection, cccd_index);
679
689
if (cccEnabled & ATT_CLIENT_CFG_NOTIFY) {
680
690
AttsHandleValueNtf (connection, att_handle, len, (uint8_t *)buffer);
691
+ updates_sent++;
681
692
}
682
693
if (cccEnabled & ATT_CLIENT_CFG_INDICATE) {
683
694
AttsHandleValueInd (connection, att_handle, len, (uint8_t *)buffer);
695
+ updates_sent++;
684
696
}
685
697
}
686
698
699
+ if (updates_sent) {
700
+ handleDataSentEvent (updates_sent);
701
+ }
702
+
687
703
return BLE_ERROR_NONE;
688
704
}
689
705
0 commit comments