@@ -223,7 +223,8 @@ void BLECharacteristic::handleGATTServerEvent(
223223m_writeEvt = false ;
224224if (param->exec_write .exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
225225m_value.commit ();
226- m_pCallbacks->onWrite (this ); // Invoke the onWrite callback handler.
226+ // Invoke the onWrite callback handler.
227+ m_pCallbacks->onWrite (this , param);
227228} else {
228229m_value.cancel ();
229230}
@@ -311,7 +312,8 @@ void BLECharacteristic::handleGATTServerEvent(
311312} // Response needed
312313
313314if (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);
315317}
316318} // Match on handles.
317319break ;
@@ -383,7 +385,7 @@ void BLECharacteristic::handleGATTServerEvent(
383385
384386// If is.long is false then this is the first (or only) request to read data, so invoke the callback
385387// Invoke the read callback.
386- m_pCallbacks->onRead (this );
388+ m_pCallbacks->onRead (this , param );
387389
388390std::string value = m_value.getValue ();
389391
@@ -757,46 +759,35 @@ std::string BLECharacteristic::toString() {
757759
758760BLECharacteristicCallbacks::~BLECharacteristicCallbacks () {}
759761
762+ void BLECharacteristicCallbacks::onRead (BLECharacteristic* pCharacteristic, esp_ble_gatts_cb_param_t * param) {
763+ onRead (pCharacteristic);
764+ } // onRead
760765
761- /* *
762- * @brief Callback function to support a read request.
763- * @param [in] pCharacteristic The characteristic that is the source of the event.
764- */
765766void BLECharacteristicCallbacks::onRead (BLECharacteristic* pCharacteristic) {
766- log_d (" BLECharacteristicCallbacks " , " >> onRead: default" );
767- log_d (" BLECharacteristicCallbacks " , " << onRead" );
767+ log_d (" >> onRead: default" );
768+ log_d (" << onRead" );
768769} // onRead
769770
770771
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+
775776void BLECharacteristicCallbacks::onWrite (BLECharacteristic* pCharacteristic) {
776- log_d (" BLECharacteristicCallbacks " , " >> onWrite: default" );
777- log_d (" BLECharacteristicCallbacks " , " << onWrite" );
777+ log_d (" >> onWrite: default" );
778+ log_d (" << onWrite" );
778779} // onWrite
779780
780781
781- /* *
782- * @brief Callback function to support a Notify request.
783- * @param [in] pCharacteristic The characteristic that is the source of the event.
784- */
785782void BLECharacteristicCallbacks::onNotify (BLECharacteristic* pCharacteristic) {
786- log_d (" BLECharacteristicCallbacks " , " >> onNotify: default" );
787- log_d (" BLECharacteristicCallbacks " , " << onNotify" );
783+ log_d (" >> onNotify: default" );
784+ log_d (" << onNotify" );
788785} // onNotify
789786
790787
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- */
797788void 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" );
800791} // onStatus
801792
802793
0 commit comments