@@ -223,7 +223,8 @@ void BLECharacteristic::handleGATTServerEvent(
223
223
m_writeEvt = false ;
224
224
if (param->exec_write .exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
225
225
m_value.commit ();
226
- m_pCallbacks->onWrite (this ); // Invoke the onWrite callback handler.
226
+ // Invoke the onWrite callback handler.
227
+ m_pCallbacks->onWrite (this , param);
227
228
} else {
228
229
m_value.cancel ();
229
230
}
@@ -311,7 +312,8 @@ void BLECharacteristic::handleGATTServerEvent(
311
312
} // Response needed
312
313
313
314
if (param->write .is_prep != true ) {
314
- m_pCallbacks->onWrite (this ); // Invoke the onWrite callback handler.
315
+ // Invoke the onWrite callback handler.
316
+ m_pCallbacks->onWrite (this , param);
315
317
}
316
318
} // Match on handles.
317
319
break ;
@@ -383,7 +385,7 @@ void BLECharacteristic::handleGATTServerEvent(
383
385
384
386
// If is.long is false then this is the first (or only) request to read data, so invoke the callback
385
387
// Invoke the read callback.
386
- m_pCallbacks->onRead (this );
388
+ m_pCallbacks->onRead (this , param );
387
389
388
390
std::string value = m_value.getValue ();
389
391
@@ -757,46 +759,35 @@ std::string BLECharacteristic::toString() {
757
759
758
760
BLECharacteristicCallbacks::~BLECharacteristicCallbacks () {}
759
761
762
+ void BLECharacteristicCallbacks::onRead (BLECharacteristic* pCharacteristic, esp_ble_gatts_cb_param_t * param) {
763
+ onRead (pCharacteristic);
764
+ } // onRead
760
765
761
- /* *
762
- * @brief Callback function to support a read request.
763
- * @param [in] pCharacteristic The characteristic that is the source of the event.
764
- */
765
766
void BLECharacteristicCallbacks::onRead (BLECharacteristic* pCharacteristic) {
766
- log_d (" BLECharacteristicCallbacks " , " >> onRead: default" );
767
- log_d (" BLECharacteristicCallbacks " , " << onRead" );
767
+ log_d (" >> onRead: default" );
768
+ log_d (" << onRead" );
768
769
} // onRead
769
770
770
771
771
- /* *
772
- * @brief Callback function to support a write request.
773
- * @param [in] pCharacteristic The characteristic that is the source of the event.
774
- */
772
+ void BLECharacteristicCallbacks::onWrite (BLECharacteristic* pCharacteristic, esp_ble_gatts_cb_param_t * param) {
773
+ onWrite (pCharacteristic);
774
+ } // onWrite
775
+
775
776
void BLECharacteristicCallbacks::onWrite (BLECharacteristic* pCharacteristic) {
776
- log_d (" BLECharacteristicCallbacks " , " >> onWrite: default" );
777
- log_d (" BLECharacteristicCallbacks " , " << onWrite" );
777
+ log_d (" >> onWrite: default" );
778
+ log_d (" << onWrite" );
778
779
} // onWrite
779
780
780
781
781
- /* *
782
- * @brief Callback function to support a Notify request.
783
- * @param [in] pCharacteristic The characteristic that is the source of the event.
784
- */
785
782
void BLECharacteristicCallbacks::onNotify (BLECharacteristic* pCharacteristic) {
786
- log_d (" BLECharacteristicCallbacks " , " >> onNotify: default" );
787
- log_d (" BLECharacteristicCallbacks " , " << onNotify" );
783
+ log_d (" >> onNotify: default" );
784
+ log_d (" << onNotify" );
788
785
} // onNotify
789
786
790
787
791
- /* *
792
- * @brief Callback function to support a Notify/Indicate Status report.
793
- * @param [in] pCharacteristic The characteristic that is the source of the event.
794
- * @param [in] s Status of the notification/indication
795
- * @param [in] code Additional code of underlying errors
796
- */
797
788
void BLECharacteristicCallbacks::onStatus (BLECharacteristic* pCharacteristic, Status s, uint32_t code) {
798
- log_d (" BLECharacteristicCallbacks " , " >> onStatus: default" );
799
- log_d (" BLECharacteristicCallbacks " , " << onStatus" );
789
+ log_d (" >> onStatus: default" );
790
+ log_d (" << onStatus" );
800
791
} // onStatus
801
792
802
793
0 commit comments