111 BLEEvent(esp_gap_ble_cb_event_t e, esp_ble_gap_cb_param_t *p) {
113 this->init_gap_data_(e, p);
121 BLEEvent(esp_gattc_cb_event_t e, esp_gatt_if_t i, esp_ble_gattc_cb_param_t *p) {
123 this->init_gattc_data_(e, i, p);
131 BLEEvent(esp_gatts_cb_event_t e, esp_gatt_if_t i, esp_ble_gatts_cb_param_t *p) {
133 this->init_gatts_data_(e, i, p);
148 delete this->
event_.gattc.gattc_param;
149 delete this->
event_.gattc.data;
150 this->
event_.gattc.gattc_param =
nullptr;
151 this->
event_.gattc.data =
nullptr;
155 delete this->
event_.gatts.gatts_param;
156 delete this->
event_.gatts.data;
157 this->
event_.gatts.gatts_param =
nullptr;
158 this->
event_.gatts.data =
nullptr;
166 this->init_gap_data_(e, p);
169 void load_gattc_event(esp_gattc_cb_event_t e, esp_gatt_if_t i, esp_ble_gattc_cb_param_t *p) {
172 this->init_gattc_data_(e, i, p);
175 void load_gatts_event(esp_gatts_cb_event_t e, esp_gatt_if_t i, esp_ble_gatts_cb_param_t *p) {
178 this->init_gatts_data_(e, i, p);
221 std::vector<uint8_t> *
data;
238 void init_gap_data_(esp_gap_ble_cb_event_t e, esp_ble_gap_cb_param_t *p) {
239 this->
event_.gap.gap_event = e;
247 case ESP_GAP_BLE_SCAN_RESULT_EVT:
248 memcpy(this->
event_.gap.scan_result.bda, p->scan_rst.bda,
sizeof(esp_bd_addr_t));
249 this->
event_.gap.scan_result.ble_addr_type = p->scan_rst.ble_addr_type;
250 this->
event_.gap.scan_result.rssi = p->scan_rst.rssi;
251 this->
event_.gap.scan_result.adv_data_len = p->scan_rst.adv_data_len;
252 this->
event_.gap.scan_result.scan_rsp_len = p->scan_rst.scan_rsp_len;
253 this->
event_.gap.scan_result.search_evt = p->scan_rst.search_evt;
254 memcpy(this->
event_.gap.scan_result.ble_adv, p->scan_rst.ble_adv,
255 ESP_BLE_ADV_DATA_LEN_MAX + ESP_BLE_SCAN_RSP_DATA_LEN_MAX);
258 case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT:
259 this->
event_.gap.scan_complete.status = p->scan_param_cmpl.status;
262 case ESP_GAP_BLE_SCAN_START_COMPLETE_EVT:
263 this->
event_.gap.scan_complete.status = p->scan_start_cmpl.status;
266 case ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT:
267 this->
event_.gap.scan_complete.status = p->scan_stop_cmpl.status;
272 case ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT:
273 this->
event_.gap.adv_complete.status = p->adv_data_cmpl.status;
275 case ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT:
276 this->
event_.gap.adv_complete.status = p->scan_rsp_data_cmpl.status;
278 case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
279 this->
event_.gap.adv_complete.status = p->adv_data_raw_cmpl.status;
281 case ESP_GAP_BLE_ADV_START_COMPLETE_EVT:
282 this->
event_.gap.adv_complete.status = p->adv_start_cmpl.status;
284 case ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT:
285 this->
event_.gap.adv_complete.status = p->adv_stop_cmpl.status;
290 case ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT:
291 this->
event_.gap.read_rssi_complete.status = p->read_rssi_cmpl.status;
292 this->
event_.gap.read_rssi_complete.rssi = p->read_rssi_cmpl.rssi;
293 memcpy(this->
event_.gap.read_rssi_complete.remote_addr, p->read_rssi_cmpl.remote_addr,
sizeof(esp_bd_addr_t));
298 case ESP_GAP_BLE_AUTH_CMPL_EVT:
299 case ESP_GAP_BLE_SEC_REQ_EVT:
300 case ESP_GAP_BLE_PASSKEY_NOTIF_EVT:
301 case ESP_GAP_BLE_PASSKEY_REQ_EVT:
302 case ESP_GAP_BLE_NC_REQ_EVT:
303 memcpy(&this->
event_.gap.security, &p->ble_security,
sizeof(esp_ble_sec_t));
316 void init_gattc_data_(esp_gattc_cb_event_t e, esp_gatt_if_t i, esp_ble_gattc_cb_param_t *p) {
317 this->
event_.gattc.gattc_event = e;
318 this->
event_.gattc.gattc_if = i;
321 this->
event_.gattc.gattc_param =
nullptr;
322 this->
event_.gattc.data =
nullptr;
333 this->
event_.gattc.gattc_param =
new esp_ble_gattc_cb_param_t(*p);
339 case ESP_GATTC_NOTIFY_EVT:
340 this->
event_.gattc.data =
new std::vector<uint8_t>(p->notify.value, p->notify.value + p->notify.value_len);
341 this->
event_.gattc.gattc_param->notify.value = this->
event_.gattc.data->data();
343 case ESP_GATTC_READ_CHAR_EVT:
344 case ESP_GATTC_READ_DESCR_EVT:
345 this->
event_.gattc.data =
new std::vector<uint8_t>(p->read.value, p->read.value + p->read.value_len);
346 this->
event_.gattc.gattc_param->read.value = this->
event_.gattc.data->data();
349 this->
event_.gattc.data =
nullptr;
355 void init_gatts_data_(esp_gatts_cb_event_t e, esp_gatt_if_t i, esp_ble_gatts_cb_param_t *p) {
356 this->
event_.gatts.gatts_event = e;
357 this->
event_.gatts.gatts_if = i;
360 this->
event_.gatts.gatts_param =
nullptr;
361 this->
event_.gatts.data =
nullptr;
372 this->
event_.gatts.gatts_param =
new esp_ble_gatts_cb_param_t(*p);
378 case ESP_GATTS_WRITE_EVT:
379 this->
event_.gatts.data =
new std::vector<uint8_t>(p->write.value, p->write.value + p->write.len);
380 this->
event_.gatts.gatts_param->write.value = this->
event_.gatts.data->data();
383 this->
event_.gatts.data =
nullptr;