-
Notifications
You must be signed in to change notification settings - Fork 1
/
Calculations.h
47 lines (41 loc) · 1.33 KB
/
Calculations.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Developed by Mohammad Mahdi Ramezanpour, Feb. 2020 ([email protected])
#if !defined(CALCULATIONS_H)
#define CALCULATIONS_H
#include "Beacon.h"
#include "Point.h"
#include <vector>
#include <ctime>
#include <chrono>
#include <math.h>
#include <algorithm>
#include <functional>
#include <numeric>
#include <map>
#include <stack>
class Calculations
{
public:
Calculations(int thershold = 2);
void StartCalculations(const std::function<void(Point)> &callback);
void FillBeacons(const std::vector<Beacon> &beacons);
void SetRecognizedBeacons(const std::vector<Beacon> &recognizedBeacons);
const std::vector<Beacon> ParseBeacons(const std::string &str);
private:
std::vector<Beacon> m_recognizedBeacons;
std::vector<Beacon> m_beacons;
std::vector<Beacon> m_beaconsToProcess;
int m_threshold;
time_t m_nextCalculationTime;
std::function<void(Point)> m_callbackFunc;
Point m_lastLocation;
std::stack<Point> m_lastKnownLocations;
void SelectBestBeaconsToProcess();
void RemoveWeakBeacons();
bool IsRecognized(const Beacon &b, Beacon &correspondingBeacon);
bool IsDuplicate(const Beacon &beacon);
const Point CalculateLocation();
Beacon ParseBeacon(const std::string &str);
void ResetCalculationTime();
double CalculateAvgDistance(Beacon &beacon);
};
#endif // CALCULATIONS_H