From 6c7278f50283b19d4d1a15d74ce1780d3d9dcdcb Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 19 Jun 2015 11:46:28 +0200 Subject: [PATCH] fix output of bd addr in advertisements in gatt examples --- example/embedded/gatt_battery_query.c | 6 +----- example/embedded/gatt_browser.c | 6 +----- test/pts/ble_central_test.c | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/example/embedded/gatt_battery_query.c b/example/embedded/gatt_battery_query.c index e4ccfd187..f3762ca39 100644 --- a/example/embedded/gatt_battery_query.c +++ b/example/embedded/gatt_battery_query.c @@ -203,17 +203,13 @@ static void fill_advertising_report_from_packet(advertising_report_t * report, u int pos = 2; report->event_type = packet[pos++]; report->address_type = packet[pos++]; - memcpy(report->address, &packet[pos], 6); + bt_flip_addr(report->address, &packet[pos]); pos += 6; report->rssi = packet[pos++]; report->length = packet[pos++]; report->data = &packet[pos]; pos += report->length; dump_advertising_report(report); - - bd_addr_t found_device_addr; - memcpy(found_device_addr, report->address, 6); - swapX(found_device_addr, report->address, 6); } static void handle_hci_event(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ diff --git a/example/embedded/gatt_browser.c b/example/embedded/gatt_browser.c index 60f81964d..b0a2a39f1 100644 --- a/example/embedded/gatt_browser.c +++ b/example/embedded/gatt_browser.c @@ -160,17 +160,13 @@ static void fill_advertising_report_from_packet(advertising_report_t * report, u int pos = 2; report->event_type = packet[pos++]; report->address_type = packet[pos++]; - memcpy(report->address, &packet[pos], 6); + bt_flip_addr(report->address, &packet[pos]); pos += 6; report->rssi = packet[pos++]; report->length = packet[pos++]; report->data = &packet[pos]; pos += report->length; dump_advertising_report(report); - - bd_addr_t found_device_addr; - memcpy(found_device_addr, report->address, 6); - swapX(found_device_addr, report->address, 6); } diff --git a/test/pts/ble_central_test.c b/test/pts/ble_central_test.c index 4b3349fb0..accc5ad1e 100644 --- a/test/pts/ble_central_test.c +++ b/test/pts/ble_central_test.c @@ -134,17 +134,13 @@ static void fill_advertising_report_from_packet(advertising_report_t * report, u int pos = 2; report->event_type = packet[pos++]; report->address_type = packet[pos++]; - memcpy(report->address, &packet[pos], 6); + bt_flip_addr(report->address, &packet[pos]); pos += 6; report->rssi = packet[pos++]; report->length = packet[pos++]; report->data = &packet[pos]; pos += report->length; dump_advertising_report(report); - - bd_addr_t found_device_addr; - memcpy(found_device_addr, report->address, 6); - swapX(found_device_addr, report->address, 6); } static void gap_run(void){