How to read "Write Response" with BLE client?

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

How to read "Write Response" with BLE client?

Postby S-Yamamoto » Thu Sep 14, 2023 3:59 am

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.

S-Yamamoto
Posts: 6
Joined: Thu Aug 31, 2023 1:19 am

Re: How to read "Write Response" with BLE client?

Postby S-Yamamoto » Thu Sep 14, 2023 6:01 am

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;

・・・

Who is online

Users browsing this forum: Bing [Bot] and 136 guests