added code from fusion2016

This commit is contained in:
Toni
2016-03-01 15:04:46 +01:00
commit 8d2be0f8a0
97 changed files with 19831 additions and 0 deletions

41
code/frank/BeaconObservation.h Executable file
View File

@@ -0,0 +1,41 @@
#ifndef BEACONOBSERVATION_H
#define BEACONOBSERVATION_H
#include "MACAddress.h"
#include <vector>
/** one observed AP and its signal strength */
struct BeaconObservationEntry {
/** the timestamp this beacon was discovered at */
uint64_t ts;
/** the beacon's mac address */
std::string mac;
/** the beacon's rssi */
int rssi;
BeaconObservationEntry() : ts(0), mac(), rssi(0) {;}
BeaconObservationEntry(const uint64_t ts, const std::string& mac, const int rssi) : ts(ts), mac(mac), rssi(rssi) {;}
};
/** all APs observed during one scan */
struct BeaconObservation {
std::vector<BeaconObservationEntry> entries;
void removeOld(uint64_t latestTS) {
auto lambda = [latestTS] (const BeaconObservationEntry& e) {
uint64_t age = latestTS - e.ts;
return age > 1000*3;
};
entries.erase(std::remove_if(entries.begin(), entries.end(), lambda), entries.end());
}
};
#endif // BEACONOBSERVATION_H