void ctx::VisitDetector::onWifiScan(ctx::MacEvent e)
{
- _D("timestamp=%d, curent_interval.end=%d, mac=%s", e.timestamp, __currentInterval.end, std::string(e.mac).c_str());
+ _D("timestamp=%d, current_interval.end=%d, mac=%s, network=%s",
+ e.timestamp,
+ __currentInterval.end,
+ std::string(e.mac).c_str(),
+ e.networkName.c_str());
if (__isValid(e.mac)) {
while (e.timestamp > __currentInterval.end) {
__processCurrentLogger();
if (WIFI_LOGGER_LOW_POWER_MODE
&& (wifiLogger->__connectedToWifiAp || wifiLogger->__duringVisit) ) {
// Add to last scans AP's set
- wifiLogger->__lastScansPool.insert(std::string(bssid));
+ wifiLogger->__lastScansPool.insert(std::pair<std::string, std::string>(std::string(bssid), std::string(essid)));
}
}
if (WIFI_LOGGER_DATABASE)
_D("trying to send fake scan");
if (__listener) {
_D("__listener != false -> CORRECT");
- for (std::string bssid : __lastScansPool) {
- Mac mac(bssid);
- MacEvent scan(now, mac);
- _D("send fake scan (%s)", bssid.c_str());
+ for (std::pair<std::string, std::string> ap : __lastScansPool) {
+ Mac mac(ap.first);
+ MacEvent scan(now, mac, ap.second);
+ _D("send fake scan (%s, %s)", ap.first.c_str(), ap.second.c_str());
__listener->onWifiScan(scan);
}
}
#include <WifiWrapper.h>
#include <time.h>
#include <vector>
-#include <set>
+#include <map>
#include <TimerManager.h>
#include "wifi_listener_iface.h"
#include "visit_listener_iface.h"
IWifiListener * const __listener;
std::vector<MacEvent> __logs;
- std::set<std::string> __lastScansPool;
+ std::map<std::string, std::string> __lastScansPool; // Mac address to network name map
time_t __lastScanTime;
time_t __lasTimerCallbackTime;
bool __duringVisit;