C
I made some try in esp-idf without success. I didn't manage to retrieve ble_evt_type.
My initial goal was to filter the scan response, I will use another solution to do it.
I added bt_event.scan.scan_rst.adv_data_len and bt_event.scan.scan_rst.scan_rsp_len to the values returned by get_adv() pycom function. These values will permit me to identify the scan response.
To do that i made some changes in pycom-micropython-sigfox\esp32\mods\modbt.c line 1275 to 1291:
STATIC mp_obj_t bt_read_scan(mp_obj_t self_in) {
bt_event_result_t bt_event;
STATIC const qstr bt_scan_info_fields[] = {
MP_QSTR_mac, MP_QSTR_addr_type, MP_QSTR_adv_type, MP_QSTR_rssi, MP_QSTR_data, MP_QSTR_adv_len, MP_QSTR_scan_rsp_len,
};
if (xQueueReceive(xScanQueue, &bt_event, (TickType_t)0)) {
mp_obj_t tuple[7];
tuple[0] = mp_obj_new_bytes((const byte *)bt_event.scan.scan_rst.bda, 6);
tuple[1] = mp_obj_new_int(bt_event.scan.scan_rst.ble_addr_type);
tuple[2] = mp_obj_new_int(bt_event.scan.scan_rst.ble_evt_type);
tuple[3] = mp_obj_new_int(bt_event.scan.scan_rst.rssi);
tuple[4] = mp_obj_new_bytes((const byte *)bt_event.scan.scan_rst.ble_adv, sizeof(bt_event.scan.scan_rst.ble_adv));
tuple[5] = mp_obj_new_int(bt_event.scan.scan_rst.adv_data_len);
tuple[6] = mp_obj_new_int(bt_event.scan.scan_rst.scan_rsp_len);
return mp_obj_new_attrtuple(bt_scan_info_fields, 7, tuple);
}
return mp_const_none;
}
These modifications give me access to adv.adv_data_len and adv.scan_rsp_len which are returned by adv = bluetooth.get_adv() function.