Merge remote-tracking branch 'origin/master' into workingToni

This commit is contained in:
toni
2016-12-01 19:51:23 +01:00
4 changed files with 48 additions and 1 deletions

View File

@@ -184,6 +184,11 @@ namespace Floorplan {
std::string name;
std::string mac;
Point3 pos; // z is relative to the floor's height
struct Model {
float txp;
float exp;
float waf;
} model;
AccessPoint() : name(), mac(), pos() {;}
AccessPoint(const std::string& name, const std::string& mac, const Point3& pos) : name(name), mac(toUpperCase(mac)), pos(pos) {;}
bool operator == (const AccessPoint& o) const {return (o.name == name) && (o.mac == mac) && (o.pos == pos);}
@@ -194,7 +199,15 @@ namespace Floorplan {
struct Beacon {
std::string name;
std::string mac;
std::string major;
std::string minor;
std::string uuid;
Point3 pos; // z is relative to the floor's height
struct Model {
float txp;
float exp;
float waf;
} model;
Beacon() : name(), mac(), pos() {;}
Beacon(const std::string& name, const std::string& mac, const Point3& pos) : name(name), mac(mac), pos(pos) {;}
bool operator == (const Beacon& o) const {return (o.name == name) && (o.mac == mac) && (o.pos == pos);}

View File

@@ -260,6 +260,9 @@ namespace Floorplan {
ap->mac = n->Attribute("mac");
ap->name = n->Attribute("name");
ap->pos = parsePoint3(n);
ap->model.txp = n->FloatAttribute("mdl_txp");
ap->model.exp = n->FloatAttribute("mdl_exp");
ap->model.waf = n->FloatAttribute("mdl_waf");
return ap;
}
@@ -278,6 +281,12 @@ namespace Floorplan {
Beacon* b = new Beacon();
b->mac = n->Attribute("mac");
b->name = n->Attribute("name");
b->major = n->Attribute("major");
b->minor = n->Attribute("minor");
b->uuid = n->Attribute("uuid");
b->model.txp = n->FloatAttribute("mdl_txp");
b->model.exp = n->FloatAttribute("mdl_exp");
b->model.waf = n->FloatAttribute("mdl_waf");
b->pos = parsePoint3(n);
return b;
}

View File

@@ -163,6 +163,9 @@ namespace Floorplan {
accesspoint->SetAttribute("x", ap->pos.x);
accesspoint->SetAttribute("y", ap->pos.y);
accesspoint->SetAttribute("z", ap->pos.z);
accesspoint->SetAttribute("mdl_txp", ap->model.txp);
accesspoint->SetAttribute("mdl_exp", ap->model.exp);
accesspoint->SetAttribute("mdl_waf", ap->model.waf);
accesspoints->InsertEndChild(accesspoint);
}
floor->InsertEndChild(accesspoints);
@@ -172,9 +175,15 @@ namespace Floorplan {
XMLElem* beacon = doc.NewElement("beacon");
beacon->SetAttribute("name", b->name.c_str());
beacon->SetAttribute("mac", b->mac.c_str());
beacon->SetAttribute("major", b->major.c_str());
beacon->SetAttribute("minor", b->minor.c_str());
beacon->SetAttribute("uuid", b->uuid.c_str());
beacon->SetAttribute("x", b->pos.x);
beacon->SetAttribute("y", b->pos.y);
beacon->SetAttribute("z", b->pos.z);
beacon->SetAttribute("mdl_txp", b->model.txp);
beacon->SetAttribute("mdl_exp", b->model.exp);
beacon->SetAttribute("mdl_waf", b->model.waf);
beacons->InsertEndChild(beacon);
}
floor->InsertEndChild(beacons);

View File

@@ -6,6 +6,8 @@
#include "../../../Assertions.h"
#include "WiFiModel.h"
#include "LogDistanceModel.h"
#include "../VAPGrouper.h"
#include "../../../misc/Debug.h"
/**
* signal-strength estimation using log-distance model
@@ -71,6 +73,20 @@ public:
}
/** load AP information from the floorplan. use the given fixed TXP/EXP/WAF for all APs */
void loadAPs(const Floorplan::IndoorMap* map, const VAPGrouper& vg, const float txp = -40.0f, const float exp = 2.5f, const float waf = -8.0f) {
for (const Floorplan::Floor* floor : map->floors) {
for (const Floorplan::AccessPoint* ap : floor->accesspoints) {
const APEntry ape(ap->getPos(floor), txp, exp, waf);
const MACAddress mac = vg.getBaseMAC(MACAddress(ap->mac));
Log::add("WiModLDC", "AP: " + ap->mac + " -> " + mac.asString());
addAP(MACAddress(mac), ape);
}
}
}
/** make the given AP (and its parameters) known to the model */
void addAP(const MACAddress& accessPoint, const APEntry& params) {
@@ -79,7 +95,7 @@ public:
Assert::isBetween(params.txp, -50.0f, -30.0f, "TXP out of bounds [-50:-30]");
Assert::isBetween(params.exp, 1.0f, 4.0f, "EXP out of bounds [1:4]");
Assert::equal(accessPoints.find(accessPoint), accessPoints.end(), "AccessPoint already present!");
Assert::equal(accessPoints.find(accessPoint), accessPoints.end(), "AccessPoint already present! VAP-Grouping issue?");
// add
accessPoints.insert( std::pair<MACAddress, APEntry>(accessPoint, params) );