Hi @Everyone
I recently started using ESP32.
I'm using Arduino IDE (2.1.1) with ESP32 (2.0.11) installed.
I would like you to help me.
Please tell me how to read "Write Response" with BLE client.
How to read "Write Response" with BLE client?
-
- Posts: 6
- Joined: Thu Aug 31, 2023 1:19 am
-
- Posts: 6
- Joined: Thu Aug 31, 2023 1:19 am
Re: How to read "Write Response" with BLE client?
Hi @Everyone
I understand how to read "Write Response"
"evtParam->write.status" of "gattClientEventHandler()" becomes the value of "Write Response"
I added log_i() to the place marked with "★Added" in the program below and confirmed it.
If you know of another method, please let me know.
[File]
BLERemoteCharacteristic.cpp
[Function]
void BLERemoteCharacteristic::gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam) {
switch(event) {
・・・
case ESP_GATTC_WRITE_CHAR_EVT: {
// Determine if this event is for us and, if not, pass onwards.
if (evtParam->write.handle != getHandle()) break;
// There is nothing further we need to do here. This is merely an indication
// that the write has completed and we can unlock the caller.
m_semaphoreWriteCharEvt.give();
log_i("status Value: %d \n",evtParam->write.status); //★Added
break;
・・・
I understand how to read "Write Response"
"evtParam->write.status" of "gattClientEventHandler()" becomes the value of "Write Response"
I added log_i() to the place marked with "★Added" in the program below and confirmed it.
If you know of another method, please let me know.
[File]
BLERemoteCharacteristic.cpp
[Function]
void BLERemoteCharacteristic::gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t* evtParam) {
switch(event) {
・・・
case ESP_GATTC_WRITE_CHAR_EVT: {
// Determine if this event is for us and, if not, pass onwards.
if (evtParam->write.handle != getHandle()) break;
// There is nothing further we need to do here. This is merely an indication
// that the write has completed and we can unlock the caller.
m_semaphoreWriteCharEvt.give();
log_i("status Value: %d \n",evtParam->write.status); //★Added
break;
・・・
Who is online
Users browsing this forum: Google [Bot] and 98 guests