summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-16 22:46:26 +0100
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-03-16 22:46:26 +0100
commit327754a953a87cd0efb6c0749025189faa5a7111 (patch)
tree4ddf2793b78433c6adc79d548489e47f9eaddffa
parent34689722991cb76fda85766a46975e74222c14d3 (diff)
nrf5/bluetooth: capture address type in addition to advertisment type in bluetooth advertisment reports.
-rw-r--r--nrf5/bluetooth/ble_drv.c5
-rw-r--r--nrf5/bluetooth/ble_drv.h3
-rw-r--r--nrf5/modules/ubluepy/ubluepy_scanner.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/nrf5/bluetooth/ble_drv.c b/nrf5/bluetooth/ble_drv.c
index bdfb34657..071fd8d9a 100644
--- a/nrf5/bluetooth/ble_drv.c
+++ b/nrf5/bluetooth/ble_drv.c
@@ -36,7 +36,7 @@
#include "ble.h" // sd_ble_uuid_encode
-#define BLE_DRIVER_VERBOSE 0
+#define BLE_DRIVER_VERBOSE 1
#if BLE_DRIVER_VERBOSE
#define BLE_DRIVER_LOG printf
#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_drv_adv_data_t adv_data = {
.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,
.rssi = p_ble_evt->evt.gap_evt.params.adv_report.rssi,
.data_len = p_ble_evt->evt.gap_evt.params.adv_report.dlen,
.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...
diff --git a/nrf5/bluetooth/ble_drv.h b/nrf5/bluetooth/ble_drv.h
index a7d831911..cf70fe1e3 100644
--- a/nrf5/bluetooth/ble_drv.h
+++ b/nrf5/bluetooth/ble_drv.h
@@ -34,11 +34,12 @@
typedef struct {
uint8_t * p_peer_addr;
+ uint8_t addr_type;
bool is_scan_resp;
int8_t rssi;
uint8_t data_len;
uint8_t * p_data;
- uint8_t type;
+ uint8_t adv_type;
} 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);
diff --git a/nrf5/modules/ubluepy/ubluepy_scanner.c b/nrf5/modules/ubluepy/ubluepy_scanner.c
index e9faf2fe1..39e25b9ed 100644
--- a/nrf5/modules/ubluepy/ubluepy_scanner.c
+++ b/nrf5/modules/ubluepy/ubluepy_scanner.c
@@ -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[5] = data->p_peer_addr[0];
- item->addr_type = data->type;
+ item->addr_type = data->addr_type;
item->rssi = data->rssi;
mp_obj_list_append(self->adv_reports, item);