some fixes [multithreading,..]
needed interface changes [new options] logger for android wifi-ap-optimization new test-cases
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include "AccessPoint.h"
|
||||
#include "../../misc/Debug.h"
|
||||
|
||||
/**
|
||||
* rssi model-estimation for one AP, denoted by its index [among all APs present within the map]
|
||||
@@ -100,9 +101,11 @@ template <int maxAccessPoints> struct WiFiGridNode {
|
||||
* returns 0 if unknown
|
||||
*/
|
||||
float getRSSI(const MACAddress mac) const {
|
||||
for (const WiFiGridNodeAP ap : strongestAPs) {
|
||||
if (!ap.isValid()) {break;} // reached the end
|
||||
if (getMapAPs()[ap.getAPIdx()].getMAC() == mac) {return ap.getRSSI();}
|
||||
for (const WiFiGridNodeAP& ap : strongestAPs) {
|
||||
//std::cout << getMapAPs()[ap.getAPIdx()].getMAC().asString() << std::endl;
|
||||
//std::cout << mac.asString() << std::endl;
|
||||
if (!ap.isValid()) {break;} // reached the end of all APs visible on this node
|
||||
if (getMapAPs()[ap.getAPIdx()].getMAC() == mac) {return ap.getRSSI();} // does this APs MAC match with the requested MAC? -> found!
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -124,6 +127,8 @@ template <int maxAccessPoints> struct WiFiGridNode {
|
||||
|
||||
protected:
|
||||
|
||||
static constexpr const char* name = "WiFiGridNode";
|
||||
|
||||
/** serialize static members */
|
||||
static void staticSerialize(std::ostream& out) {
|
||||
|
||||
@@ -134,6 +139,8 @@ protected:
|
||||
out.write((const char*) &numAPs, sizeof(numAPs));
|
||||
out.write((const char*) getMapAPs().data(), sizeof(getMapAPs()[0])*numAPs);
|
||||
|
||||
Log::add(name, "serialized " + std::to_string(numAPs) + " APs");
|
||||
|
||||
}
|
||||
|
||||
/** deserialize static members */
|
||||
@@ -149,6 +156,10 @@ protected:
|
||||
// deserialize APs within map
|
||||
inp.read((char*) getMapAPs().data(), sizeof(getMapAPs()[0])*numAPs);
|
||||
|
||||
Log::add(name, "de-serialized " + std::to_string(numAPs) + " APs");
|
||||
std::string aps; for (const AccessPoint& ap : getMapAPs()) {aps += ap.getMAC().asString() + " ";}
|
||||
Log::add(name, aps);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user