diff --git a/include/corona.h b/include/corona.h index a11990d5..9af0d314 100644 --- a/include/corona.h +++ b/include/corona.h @@ -9,7 +9,7 @@ #include bool cwa_init(void); -bool cwa_mac_add(uint16_t hashedmac); +void cwa_mac_add(uint16_t hashedmac); void cwa_clear(void); uint16_t cwa_report(void); diff --git a/src/blecsan.cpp b/src/blecsan.cpp index bfc8adc8..73110fdd 100644 --- a/src/blecsan.cpp +++ b/src/blecsan.cpp @@ -160,14 +160,15 @@ IRAM_ATTR void gap_callback_handler(esp_gap_ble_cb_event_t event, } #endif - // hash and add this device and show new count total if it was not previously added - hashedmac = mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); + // hash and add this device and show new count total if it was not + // previously added + hashedmac = + mac_add((uint8_t *)p->scan_rst.bda, p->scan_rst.rssi, MAC_SNIFF_BLE); #if (COUNT_ENS) // check for ens signature - if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) { + if (0 == strncmp((const char *)p->scan_rst.ble_adv, ensMagicBytes, 4)) cwa_mac_add(hashedmac); - } #endif /* to be improved in vendorfilter if: diff --git a/src/corona.cpp b/src/corona.cpp index 00619191..632bff1e 100644 --- a/src/corona.cpp +++ b/src/corona.cpp @@ -15,10 +15,10 @@ static const char TAG[] = __FILE__; #include "corona.h" -// When to forget old senders. +// When to forget old senders ** currently not used ** #define FORGET_AFTER_MINUTES 2 -// array of timestamps for seen notifiers +// array of timestamps for seen notifiers: hash -> timestamp[ms] static std::map cwaSeenNotifiers; // Remove notifiers last seen over FORGET_AFTER_MINUTES ago. @@ -48,23 +48,8 @@ bool cwa_init(void) { return true; } -// similar to mac_add(), found in macsniff.cpp, for comments look into this function -bool cwa_mac_add(uint16_t hashedmac) { - - bool added = false; - - ESP_LOGD(TAG, "hashed ENS mac = %X, ENS count = %d (total=%d)", hashedmac, - cwaSeenNotifiers.count(hashedmac), cwaSeenNotifiers.size()); - added = !(cwaSeenNotifiers.count(hashedmac) > 0); - - // Count only if this ENS MAC was not yet seen - if (added) { - cwaSeenNotifiers[hashedmac] = millis(); // last seen at .... - ESP_LOGD(TAG, "added device with active ENS"); - } - - // True if ENS MAC was new - return added; +void cwa_mac_add(uint16_t hashedmac) { + cwaSeenNotifiers[hashedmac] = millis(); // hash last seen at .... } #endif