new wifi helper method

This commit is contained in:
2016-10-02 18:27:39 +02:00
parent 87d5e2ab4c
commit 7f53f83da0

View File

@@ -6,6 +6,8 @@
#include "../../../Assertions.h" #include "../../../Assertions.h"
#include "WiFiModel.h" #include "WiFiModel.h"
#include "LogDistanceModel.h" #include "LogDistanceModel.h"
#include "../VAPGrouper.h"
#include "../../../misc/Debug.h"
/** /**
* signal-strength estimation using log-distance model * 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 */ /** make the given AP (and its parameters) known to the model */
void addAP(const MACAddress& accessPoint, const APEntry& params) { 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.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::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 // add
accessPoints.insert( std::pair<MACAddress, APEntry>(accessPoint, params) ); accessPoints.insert( std::pair<MACAddress, APEntry>(accessPoint, params) );