This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/sensors/radio/WiFiMeasurements.h
kazu 4439123e5b fixed some issues
some new helper methods
added listener-support to offline-reader
2017-03-28 21:03:17 +02:00

38 lines
765 B
C++

#ifndef WIFIMEASUREMENTS_H
#define WIFIMEASUREMENTS_H
#include <vector>
#include "WiFiMeasurement.h"
/**
* group of several wifi measurements
*/
struct WiFiMeasurements {
/** all contained measurements */
std::vector<WiFiMeasurement> entries;
/** convert to string */
std::string asString() const {
std::string res;
for (const WiFiMeasurement& m : entries) {
res += m.getAP().getMAC().asString() + ": " + std::to_string(m.getRSSI()) + "\n";
}
return res;
}
/** get the measurements for the given MAC [if available] otherwise null */
WiFiMeasurement* getForMac(const MACAddress& mac) {
for (WiFiMeasurement& m : entries) {
if (m.getAP().getMAC() == mac) {
return &m;
}
}
return nullptr;
}
};
#endif // WIFIMEASUREMENTS_H