From 1f388d64302d2eb8925e55c5237f73ea1bffc2b5 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 1 Sep 2020 11:59:00 +0200 Subject: [PATCH] Update blecsan.cpp added: CWA-handling --- src/blecsan.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/blecsan.cpp b/src/blecsan.cpp index d305680e..0806776c 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -6,6 +6,9 @@ #define BT_BD_ADDR_HEX(addr) \ addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] +// checking for CWAs we need this magic bytes: +static const char cwaMagicBytes[] = "\x03\x03\x6F\xfd"; + // local Tag for logging static const char TAG[] = "bluetooth"; @@ -158,10 +161,19 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, // add this device and show new count total if it was not previously added mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); +#if (COUNT_CWA) + // we can call the cwa-functions now + // because we use the hashed max-value + // done in mac_add() + + // check for CWA-signature + if ( 0 == strncmp( (const char*)p->scan_rst.ble_adv, cwaMagicBytes , 4) ) { + cwa_mac_add( p->scan_rst.bda); + } +#endif + + /* to be improved in vendorfilter if: - - - // you can search for elements in the payload using the // function esp_ble_resolve_adv_data() //