From ba9559e5dfb2883476d5f125de7dbf485d417d10 Mon Sep 17 00:00:00 2001 From: kazu Date: Tue, 6 Jun 2017 15:03:33 +0200 Subject: [PATCH] minor changes --- sensors/radio/model/LogDistanceModel.h | 12 ++++++++++++ sensors/radio/model/WiFiModelLogDist.h | 11 +++++++++++ sensors/radio/model/WiFiModelLogDistCeiling.h | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/sensors/radio/model/LogDistanceModel.h b/sensors/radio/model/LogDistanceModel.h index 6a0b1e4..3f7ea4d 100644 --- a/sensors/radio/model/LogDistanceModel.h +++ b/sensors/radio/model/LogDistanceModel.h @@ -18,6 +18,18 @@ public: return (txPower - (10 * pathLoss * std::log10(distance_m))); } +// static float distanceAndRssiToPathLoss(const float txPower, const float rssi, const float distance_m) { +// const float delta = txPower - rssi; +// const float log = std::log10(distance_m) * 10.0f; +// const float res = delta/log; + +// // sanity check +// const float err = std::abs(rssi - distanceToRssi(txPower, res, distance_m)); +// if (err > 0.01) {throw Exception("error too high!");} + +// return res; +// } + }; #include diff --git a/sensors/radio/model/WiFiModelLogDist.h b/sensors/radio/model/WiFiModelLogDist.h index 417f19c..ab62660 100644 --- a/sensors/radio/model/WiFiModelLogDist.h +++ b/sensors/radio/model/WiFiModelLogDist.h @@ -55,6 +55,17 @@ public: } + /** does the model know the given AP? */ + bool knowsAP(const MACAddress& accessPoint) { + + // try to get the corresponding parameters + const auto it = accessPoints.find(accessPoint); + + // AP known? + return (it != accessPoints.end()); + + } + virtual float getRSSI(const MACAddress& accessPoint, const Point3 position_m) const override { // try to get the corresponding parameters diff --git a/sensors/radio/model/WiFiModelLogDistCeiling.h b/sensors/radio/model/WiFiModelLogDistCeiling.h index d9834d6..7d29ab1 100644 --- a/sensors/radio/model/WiFiModelLogDistCeiling.h +++ b/sensors/radio/model/WiFiModelLogDistCeiling.h @@ -107,6 +107,17 @@ public: accessPoints.clear(); } + /** does the model know the given AP? */ + bool knowsAP(const MACAddress& accessPoint) { + + // try to get the corresponding parameters + const auto it = accessPoints.find(accessPoint); + + // AP known? + return (it != accessPoints.end()); + + } + float getRSSI(const MACAddress& accessPoint, const Point3 position_m) const override { // try to get the corresponding parameters