#ifndef WIFISENSORREADER_H #define WIFISENSORREADER_H #include "../reader/SensorReader.h" #include "WiFiObservation.h" #include class WiFiSensorReader { public: /** get wifi observation data from one CSV entry */ static WiFiObservation readWifi(const SensorEntry& se) { std::string tmp = se.data; WiFiObservation obs; // process all APs while(!tmp.empty()) { std::string mac = tmp.substr(0, 17); tmp = tmp.substr(17); assert(tmp[0] == ';'); tmp = tmp.substr(1); std::string freq = tmp.substr(0, 4); tmp = tmp.substr(4); assert(tmp[0] == ';'); tmp = tmp.substr(1); int pos = tmp.find(';'); std::string rssi = tmp.substr(0, pos); tmp = tmp.substr(pos); assert(tmp[0] == ';'); tmp = tmp.substr(1); WiFiObservationEntry e(se.ts, mac, std::stoi(freq), std::stoi(rssi)); obs.entries.push_back(e); } return obs; } }; #endif // WIFISENSORREADER_H