@@ -199,25 +199,35 @@ std::string BLECharacteristic::getValue() {
199
199
} // getValue
200
200
201
201
202
+ /* *
203
+ * Handle a GATT server event.
204
+ */
202
205
void BLECharacteristic::handleGATTServerEvent (
203
206
esp_gatts_cb_event_t event,
204
207
esp_gatt_if_t gatts_if,
205
208
esp_ble_gatts_cb_param_t * param) {
209
+ ESP_LOGD (LOG_TAG, " >> handleGATTServerEvent: %s" , BLEUtils::gattServerEventTypeToString (event).c_str ());
210
+
206
211
switch (event) {
207
212
// Events handled:
213
+ //
208
214
// ESP_GATTS_ADD_CHAR_EVT
209
- // ESP_GATTS_WRITE_EVT
215
+ // ESP_GATTS_CONF_EVT
216
+ // ESP_GATTS_CONNECT_EVT
217
+ // ESP_GATTS_DISCONNECT_EVT
218
+ // ESP_GATTS_EXEC_WRITE_EVT
210
219
// ESP_GATTS_READ_EVT
211
- //
220
+ // ESP_GATTS_WRITE_EVT
212
221
222
+ //
213
223
// ESP_GATTS_EXEC_WRITE_EVT
214
224
// When we receive this event it is an indication that a previous write long needs to be committed.
215
225
//
216
226
// exec_write:
217
227
// - uint16_t conn_id
218
228
// - uint32_t trans_id
219
229
// - esp_bd_addr_t bda
220
- // - uint8_t exec_write_flag
230
+ // - uint8_t exec_write_flag - Either ESP_GATT_PREP_WRITE_EXEC or ESP_GATT_PREP_WRITE_CANCEL
221
231
//
222
232
case ESP_GATTS_EXEC_WRITE_EVT: {
223
233
if (param->exec_write .exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
@@ -428,13 +438,15 @@ void BLECharacteristic::handleGATTServerEvent(
428
438
break ;
429
439
}
430
440
431
- case ESP_GATTS_CONNECT_EVT:
441
+ case ESP_GATTS_CONNECT_EVT: {
432
442
m_semaphoreConfEvt.give ();
433
443
break ;
444
+ }
434
445
435
- case ESP_GATTS_DISCONNECT_EVT:
446
+ case ESP_GATTS_DISCONNECT_EVT: {
436
447
m_semaphoreConfEvt.give ();
437
448
break ;
449
+ }
438
450
439
451
default : {
440
452
break ;
@@ -446,7 +458,7 @@ void BLECharacteristic::handleGATTServerEvent(
446
458
// event.
447
459
448
460
m_descriptorMap.handleGATTServerEvent (event, gatts_if, param);
449
-
461
+ ESP_LOGD (LOG_TAG, " << handleGATTServerEvent " );
450
462
} // handleGATTServerEvent
451
463
452
464
@@ -699,6 +711,7 @@ void BLECharacteristic::setWriteProperty(bool value) {
699
711
}
700
712
} // setWriteProperty
701
713
714
+
702
715
/* *
703
716
* @brief Return a string representation of the characteristic.
704
717
* @return A string representation of the characteristic.
@@ -717,8 +730,10 @@ std::string BLECharacteristic::toString() {
717
730
return stringstream.str ();
718
731
} // toString
719
732
733
+
720
734
BLECharacteristicCallbacks::~BLECharacteristicCallbacks () {}
721
735
736
+
722
737
/* *
723
738
* @brief Callback function to support a read request.
724
739
* @param [in] pCharacteristic The characteristic that is the source of the event.
0 commit comments