added corresponding test-cases switched to newer version of tinyxml due to some issues adjusted affected code-parts accordingly for better re-use, moved ceiling-calculation to a new class some minor fixes new helper methods worked on wifi-opt
62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
#ifndef WIFIOPTIMIZER_H
|
|
#define WIFIOPTIMIZER_H
|
|
|
|
#include "WiFiFingerprints.h"
|
|
#include "WiFiOptimizerStructs.h"
|
|
#include "../VAPGrouper.h"
|
|
|
|
#include <unordered_map>
|
|
|
|
namespace WiFiOptimizer {
|
|
|
|
/** base-class for all WiFiOptimizers */
|
|
class Base {
|
|
|
|
protected:
|
|
|
|
/** each MAC-Adress has several position->rssi entries */
|
|
std::unordered_map<MACAddress, std::vector<RSSIatPosition>> apMap;
|
|
|
|
/** how to handle virtual access points [group, not-group, ..] */
|
|
const VAPGrouper vg;
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
Base(const VAPGrouper vg) : vg(vg) {;}
|
|
|
|
/** get a list of all to-be-optimized access-points (given by their mac-address) */
|
|
virtual std::vector<MACAddress> getAllMACs() const {
|
|
std::vector<MACAddress> res;
|
|
for (const auto& it : apMap) {res.push_back(it.first);}
|
|
return res;
|
|
}
|
|
|
|
/** add a new fingerprint to the optimizer as data-source */
|
|
virtual void addFingerprint(const WiFiFingerprint& fp) {
|
|
|
|
// group the fingerprint's measurements by VAP (if configured)
|
|
const WiFiMeasurements measurements = vg.group(fp.measurements);
|
|
|
|
// add each available AP to its slot (lookup map)
|
|
for (const WiFiMeasurement& m : measurements.entries) {
|
|
const RSSIatPosition rap(fp.pos_m, m.getRSSI());
|
|
apMap[m.getAP().getMAC()].push_back(rap);
|
|
}
|
|
|
|
}
|
|
|
|
/** add new fingerprints to the optimizer as data-source */
|
|
virtual void addFingerprints(const WiFiFingerprints& fps) {
|
|
for (const WiFiFingerprint& fp : fps.getFingerprints()) {
|
|
addFingerprint(fp);
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
#endif // WIFIOPTIMIZER_H
|