nrf5/bluetooth: capture address type in addition to advertisment type in bluetooth advertisment reports.

This commit is contained in:
Glenn Ruben Bakke 2017-03-16 22:46:26 +01:00
parent 3468972299
commit 327754a953
3 changed files with 6 additions and 4 deletions

View File

@ -36,7 +36,7 @@
#include "ble.h" // sd_ble_uuid_encode #include "ble.h" // sd_ble_uuid_encode
#define BLE_DRIVER_VERBOSE 0 #define BLE_DRIVER_VERBOSE 1
#if BLE_DRIVER_VERBOSE #if BLE_DRIVER_VERBOSE
#define BLE_DRIVER_LOG printf #define BLE_DRIVER_LOG printf
#else #else
@ -770,11 +770,12 @@ static void ble_evt_handler(ble_evt_t * p_ble_evt) {
BLE_DRIVER_LOG("BLE EVT ADV REPORT\n"); BLE_DRIVER_LOG("BLE EVT ADV REPORT\n");
ble_drv_adv_data_t adv_data = { ble_drv_adv_data_t adv_data = {
.p_peer_addr = p_ble_evt->evt.gap_evt.params.adv_report.peer_addr.addr, .p_peer_addr = p_ble_evt->evt.gap_evt.params.adv_report.peer_addr.addr,
.addr_type = p_ble_evt->evt.gap_evt.params.adv_report.peer_addr.addr_type,
.is_scan_resp = p_ble_evt->evt.gap_evt.params.adv_report.scan_rsp, .is_scan_resp = p_ble_evt->evt.gap_evt.params.adv_report.scan_rsp,
.rssi = p_ble_evt->evt.gap_evt.params.adv_report.rssi, .rssi = p_ble_evt->evt.gap_evt.params.adv_report.rssi,
.data_len = p_ble_evt->evt.gap_evt.params.adv_report.dlen, .data_len = p_ble_evt->evt.gap_evt.params.adv_report.dlen,
.p_data = p_ble_evt->evt.gap_evt.params.adv_report.data, .p_data = p_ble_evt->evt.gap_evt.params.adv_report.data,
.type = p_ble_evt->evt.gap_evt.params.adv_report.type .adv_type = p_ble_evt->evt.gap_evt.params.adv_report.type
}; };
// TODO: Fix unsafe callback to possible undefined callback... // TODO: Fix unsafe callback to possible undefined callback...

View File

@ -34,11 +34,12 @@
typedef struct { typedef struct {
uint8_t * p_peer_addr; uint8_t * p_peer_addr;
uint8_t addr_type;
bool is_scan_resp; bool is_scan_resp;
int8_t rssi; int8_t rssi;
uint8_t data_len; uint8_t data_len;
uint8_t * p_data; uint8_t * p_data;
uint8_t type; uint8_t adv_type;
} ble_drv_adv_data_t; } ble_drv_adv_data_t;
typedef void (*ble_drv_gap_evt_callback_t)(mp_obj_t self, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data); typedef void (*ble_drv_gap_evt_callback_t)(mp_obj_t self, uint16_t event_id, uint16_t conn_handle, uint16_t length, uint8_t * data);

View File

@ -48,7 +48,7 @@ STATIC void adv_event_handler(mp_obj_t self_in, uint16_t event_id, ble_drv_adv_d
item->addr[4] = data->p_peer_addr[1]; item->addr[4] = data->p_peer_addr[1];
item->addr[5] = data->p_peer_addr[0]; item->addr[5] = data->p_peer_addr[0];
item->addr_type = data->type; item->addr_type = data->addr_type;
item->rssi = data->rssi; item->rssi = data->rssi;
mp_obj_list_append(self->adv_reports, item); mp_obj_list_append(self->adv_reports, item);