22 esp_ble_gattc_cb_param_t *param) {
27 case ESP_GATTC_DISCONNECT_EVT: {
33 case ESP_GATTC_CLOSE_EVT: {
39 case ESP_GATTC_OPEN_EVT: {
40 if (param->open.status != ESP_GATT_OK && param->open.status != ESP_GATT_ALREADY_OPEN) {
51 case ESP_GATTC_CFG_MTU_EVT:
52 case ESP_GATTC_SEARCH_CMPL_EVT: {
64 case ESP_GATTC_READ_DESCR_EVT:
65 case ESP_GATTC_READ_CHAR_EVT: {
66 if (param->read.status != ESP_GATT_OK) {
67 ESP_LOGW(TAG,
"[%d] [%s] Error reading char/descriptor at handle 0x%2X, status=%d", this->
connection_index_,
68 this->
address_str_.c_str(), param->read.handle, param->read.status);
74 resp.
handle = param->read.handle;
75 resp.
data.reserve(param->read.value_len);
77 resp.
data.insert(resp.
data.end(), param->read.value, param->read.value + param->read.value_len);
81 case ESP_GATTC_WRITE_CHAR_EVT:
82 case ESP_GATTC_WRITE_DESCR_EVT: {
83 if (param->write.status != ESP_GATT_OK) {
84 ESP_LOGW(TAG,
"[%d] [%s] Error writing char/descriptor at handle 0x%2X, status=%d", this->
connection_index_,
85 this->
address_str_.c_str(), param->write.handle, param->write.status);
91 resp.
handle = param->write.handle;
95 case ESP_GATTC_UNREG_FOR_NOTIFY_EVT: {
96 if (param->unreg_for_notify.status != ESP_GATT_OK) {
97 ESP_LOGW(TAG,
"[%d] [%s] Error unregistering notifications for handle 0x%2X, status=%d",
99 param->unreg_for_notify.status);
105 resp.
handle = param->unreg_for_notify.handle;
109 case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
110 if (param->reg_for_notify.status != ESP_GATT_OK) {
111 ESP_LOGW(TAG,
"[%d] [%s] Error registering notifications for handle 0x%2X, status=%d", this->
connection_index_,
112 this->
address_str_.c_str(), param->reg_for_notify.handle, param->reg_for_notify.status);
118 resp.
handle = param->reg_for_notify.handle;
122 case ESP_GATTC_NOTIFY_EVT: {
124 param->notify.handle);
127 resp.
handle = param->notify.handle;
128 resp.
data.reserve(param->notify.value_len);
130 resp.
data.insert(resp.
data.end(), param->notify.value, param->notify.value + param->notify.value_len);
144 case ESP_GAP_BLE_AUTH_CMPL_EVT:
145 if (memcmp(param->ble_security.auth_cmpl.bd_addr, this->remote_bda_, 6) != 0)
147 if (param->ble_security.auth_cmpl.success) {