Added ftm attributes to WiFiMeasurement
This commit is contained in:
@@ -64,6 +64,7 @@ namespace Offline {
|
||||
std::vector<TS<GPSData>> gps;
|
||||
std::vector<TS<CompassData>> compass;
|
||||
std::vector<TS<MagnetometerData>> magnetometer;
|
||||
std::vector<TS<WiFiMeasurement>> wifiFtm;
|
||||
|
||||
/** all entries in linear order as they appeared while recording */
|
||||
std::vector<Entry> entries;
|
||||
@@ -102,6 +103,7 @@ namespace Offline {
|
||||
lin_acc.clear();
|
||||
gravity.clear();
|
||||
magnetometer.clear();
|
||||
wifiFtm.clear();
|
||||
}
|
||||
|
||||
const std::vector<Entry>& getEntries() const {return entries;}
|
||||
@@ -130,6 +132,8 @@ namespace Offline {
|
||||
|
||||
const std::vector<TS<MagnetometerData>>& getMagnetometer() const {return magnetometer;}
|
||||
|
||||
const std::vector<TS<WiFiMeasurement>>& getWifiFtm() const { return wifiFtm; }
|
||||
|
||||
/** get an interpolateable ground-truth based on the time-clicks during recording */
|
||||
GroundTruth getGroundTruth(const Floorplan::IndoorMap* map, const std::vector<int> groundTruthPoints) const {
|
||||
|
||||
@@ -199,6 +203,7 @@ namespace Offline {
|
||||
else if (idx == (int)Sensor::COMPASS) {parseCompass(ts,data);}
|
||||
else if (idx == (int)Sensor::GPS) {parseGPS(ts,data);}
|
||||
else if (idx == (int)Sensor::MAGNETOMETER) {parseMagnetometer(ts,data);}
|
||||
else if (idx == (int)Sensor::WIFI_FTM) {parseWifiFtm(ts, data);}
|
||||
else if (idx == (int)Sensor::ACTIVITY) {parseActivity(ts, data);}
|
||||
|
||||
// TODO: this is a hack...
|
||||
@@ -313,6 +318,33 @@ namespace Offline {
|
||||
|
||||
}
|
||||
|
||||
void parseWifiFtm(const uint64_t ts, const std::string& data) {
|
||||
|
||||
Splitter s(data, sep);
|
||||
|
||||
const int successMeas = s.getInteger(0);
|
||||
const std::string mac = s.get(1);
|
||||
const float dist = s.getFloat(2) / 1000; // mm -> m
|
||||
const float distStdDev = s.getFloat(3) / 1000;
|
||||
const float rssi = s.getFloat(4);
|
||||
|
||||
const int numAttempts = !s.isEmpty(5) ? s.getInteger(5) : 0;
|
||||
const int numSuccess = !s.isEmpty(6) ? s.getInteger(6) : 0;
|
||||
|
||||
// append AP to current scan-entry
|
||||
if (successMeas)
|
||||
{
|
||||
WiFiMeasurement meas(AccessPoint(mac), rssi, Timestamp::fromMS(ts), dist, distStdDev, numAttempts, numSuccess);
|
||||
|
||||
wifiFtm.push_back(TS<WiFiMeasurement>(ts, meas));
|
||||
entries.push_back(Entry(Sensor::WIFI_FTM, ts, this->wifiFtm.size() - 1));
|
||||
}
|
||||
|
||||
// inform listener
|
||||
//if (listener) {listener->onWiFi(Timestamp::fromMS(ts), wifi);}
|
||||
|
||||
}
|
||||
|
||||
void parseBeacons(const uint64_t ts, const std::string& data) {
|
||||
|
||||
const auto pos1 = data.find(';');
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* © Copyright 2014 – Urheberrechtshinweis
|
||||
* <EFBFBD> Copyright 2014 <EFBFBD> Urheberrechtshinweis
|
||||
* Alle Rechte vorbehalten / All Rights Reserved
|
||||
*
|
||||
* Programmcode ist urheberrechtlich geschuetzt.
|
||||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||||
* Keine Verwendung ohne explizite Genehmigung.
|
||||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||||
* (vgl. <EFBFBD> 106 ff UrhG / <EFBFBD> 97 UrhG)
|
||||
*/
|
||||
|
||||
#ifndef OFFLINE_SENSORS_H
|
||||
@@ -24,6 +24,7 @@ namespace Offline {
|
||||
WIFI = 8,
|
||||
BEACON = 9,
|
||||
GPS = 16,
|
||||
WIFI_FTM = 17,
|
||||
ACTIVITY = 50,
|
||||
GROUND_TRUTH = 99,
|
||||
POS = 1001, // IPIN2016
|
||||
|
||||
@@ -34,12 +34,15 @@ public:
|
||||
|
||||
const std::string& get(const int idx) const {return split.at(idx);}
|
||||
|
||||
const float getFloat(const int idx) const {return std::stof(get(idx));}
|
||||
const float getFloat (const int idx) const {return std::stof(get(idx));}
|
||||
const int getInteger(const int idx) const {return std::stoi(get(idx));}
|
||||
|
||||
size_t size() const {return split.size();}
|
||||
|
||||
bool empty() const {return split.empty();}
|
||||
|
||||
bool isEmpty(int idx) const { return has(idx) ? get(idx) == "" : true; }
|
||||
|
||||
private:
|
||||
|
||||
void build() {
|
||||
|
||||
Reference in New Issue
Block a user