Update blecsan.cpp

added: CWA-handling
This commit is contained in:
August Quint 2020-09-01 11:59:00 +02:00 committed by GitHub
parent b8fc516a01
commit 1f388d6430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()
//