added support for pillars

some new helper methods/classes
This commit is contained in:
2018-05-22 11:45:35 +02:00
parent a22290415e
commit 9e6d9f4ce7
13 changed files with 185 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
#define WIFIMEASUREMENTS_H
#include <vector>
#include <algorithm>
#include "WiFiMeasurement.h"
@@ -42,6 +43,14 @@ struct WiFiMeasurements {
}
}
/** get the oldest timestamp among all contained measurements */
Timestamp getOldestTS() const {
auto comp = [] (const WiFiMeasurement& m1, const WiFiMeasurement& m2) {return m1.getTimestamp() < m2.getTimestamp();};
auto it = std::max_element(entries.begin(), entries.end(), comp);
if (it == entries.end()) {throw Exception("no element found");}
return it->getTimestamp();
}
/** create a combination */
static WiFiMeasurements mix(const WiFiMeasurements& a, const WiFiMeasurements& b, float sec = 3) {

View File

@@ -12,6 +12,8 @@ class WiFiModelFactory {
private:
static constexpr const char* name = "WifiModelFac";
Floorplan::IndoorMap* map;
public:

View File

@@ -7,6 +7,7 @@
#include "WiFiModelPerFloor.h"
#include "WiFiModelPerBBox.h"
WiFiModel* WiFiModelFactory::loadXML(const std::string& file) {
XMLDoc doc;
@@ -25,10 +26,10 @@ WiFiModel* WiFiModelFactory::readFromXML(XMLDoc* doc, XMLElem* src) {
WiFiModel* mdl = nullptr;
// create an instance for the model
if (type == "WiFiModelLogDist") {mdl = new WiFiModelLogDist();}
else if (type == "WiFiModelLogDistCeiling") {mdl = new WiFiModelLogDistCeiling(map);}
else if (type == "WiFiModelPerFloor") {mdl = new WiFiModelPerFloor(map);}
else if (type == "WiFiModelPerBBox") {mdl = new WiFiModelPerBBox(map);}
if (type == "WiFiModelLogDist") {Log::add(name, "loading WiFiModelLogDist"); mdl = new WiFiModelLogDist();}
else if (type == "WiFiModelLogDistCeiling") {Log::add(name, "loading WiFiModelLogDistCeiling"); mdl = new WiFiModelLogDistCeiling(map);}
else if (type == "WiFiModelPerFloor") {Log::add(name, "loading WiFiModelPerFloor"); mdl = new WiFiModelPerFloor(map);}
else if (type == "WiFiModelPerBBox") {Log::add(name, "loading WiFiModelPerBBox"); mdl = new WiFiModelPerBBox(map);}
else {throw Exception("invalid model type given: " + type);}
// load the model from XML

View File

@@ -18,6 +18,8 @@
*/
class WiFiModelLogDistCeiling : public WiFiModel {
static constexpr const char* name = "WifiModelLDC";
public:
/** parameters describing one AP to the model */
@@ -224,6 +226,8 @@ public:
ceilings.addCeiling(atHeight_m);
}
Log::add(name, "loaded " + std::to_string(accessPoints.size()) + " APs");
}
};

View File

@@ -14,6 +14,8 @@
*/
class WiFiModelPerFloor : public WiFiModel {
static constexpr const char* name = "WiFiModelFlo";
public:
struct ModelForFloor {
@@ -173,6 +175,8 @@ public:
}
Log::add(name, "loaded " + std::to_string(models.size()) + " floor models");
}
void writeToXML(XMLDoc* doc, XMLElem* dst) override {

View File

@@ -74,14 +74,14 @@ namespace WiFiOptimizer {
float exp;
float waf;
Point3 getPos() const {return Point3(x,y,z);}
/** ctor */
APParams() {;}
/** ctor */
APParams(float x, float y, float z, float txp, float exp, float waf) : x(x), y(y), z(z), txp(txp), exp(exp), waf(waf) {;}
Point3 getPos() const {return Point3(x,y,z);}
std::string asString() const {
std::stringstream ss;
ss << "Pos:" << getPos().asString() << " TXP:" << txp << " EXP:" << exp << " WAF:" << waf;