mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
Copy missing BLE client characteristic read data (#1818)
Co-authored-by: Ben Buxton <bb@cactii.net>
This commit is contained in:
parent
afa436fe8f
commit
a3756a9600
1 changed files with 14 additions and 5 deletions
|
@ -66,10 +66,19 @@ class BLEEvent {
|
||||||
this->event_.gattc.gattc_event = e;
|
this->event_.gattc.gattc_event = e;
|
||||||
this->event_.gattc.gattc_if = i;
|
this->event_.gattc.gattc_if = i;
|
||||||
memcpy(&this->event_.gattc.gattc_param, p, sizeof(esp_ble_gattc_cb_param_t));
|
memcpy(&this->event_.gattc.gattc_param, p, sizeof(esp_ble_gattc_cb_param_t));
|
||||||
// Need to also make a copy of notify event data.
|
// Need to also make a copy of relevant event data.
|
||||||
if (e == ESP_GATTC_NOTIFY_EVT) {
|
switch (e) {
|
||||||
memcpy(this->event_.gattc.notify_data, p->notify.value, p->notify.value_len);
|
case ESP_GATTC_NOTIFY_EVT:
|
||||||
this->event_.gattc.gattc_param.notify.value = this->event_.gattc.notify_data;
|
memcpy(this->event_.gattc.data, p->notify.value, p->notify.value_len);
|
||||||
|
this->event_.gattc.gattc_param.notify.value = this->event_.gattc.data;
|
||||||
|
break;
|
||||||
|
case ESP_GATTC_READ_CHAR_EVT:
|
||||||
|
case ESP_GATTC_READ_DESCR_EVT:
|
||||||
|
memcpy(this->event_.gattc.data, p->read.value, p->read.value_len);
|
||||||
|
this->event_.gattc.gattc_param.read.value = this->event_.gattc.data;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
this->type_ = 1;
|
this->type_ = 1;
|
||||||
};
|
};
|
||||||
|
@ -84,7 +93,7 @@ class BLEEvent {
|
||||||
esp_gattc_cb_event_t gattc_event;
|
esp_gattc_cb_event_t gattc_event;
|
||||||
esp_gatt_if_t gattc_if;
|
esp_gatt_if_t gattc_if;
|
||||||
esp_ble_gattc_cb_param_t gattc_param;
|
esp_ble_gattc_cb_param_t gattc_param;
|
||||||
uint8_t notify_data[64];
|
uint8_t data[64];
|
||||||
} gattc;
|
} gattc;
|
||||||
} event_;
|
} event_;
|
||||||
uint8_t type_; // 0=gap 1=gattc
|
uint8_t type_; // 0=gap 1=gattc
|
||||||
|
|
Loading…
Reference in a new issue