-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPSParser.h
More file actions
executable file
·90 lines (80 loc) · 2.78 KB
/
GPSParser.h
File metadata and controls
executable file
·90 lines (80 loc) · 2.78 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef GPSPARSER_H
#define GPSPARSER_H
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <thread>
#include <chrono>
#include <iomanip>
#include <iostream>
#include "PaulNovackGlobals.h"
#include "Navigation.h"
#include "GPSUtils.h"
#include "AppConfig.h"
using namespace std;
namespace PaulNovack {
class Navigation;
class AppConfig;
class GPSParser {
public:
GPSParser();
GPSParser(const GPSParser& orig);
void setNavigation(Navigation& navigation);
void setGPSUtils(GPSUtils& gu);
void setConfig(AppConfig& config);
string secondsToTime(int seconds);
float convertToDecimal(const string coordinate, const string direction);
virtual ~GPSParser();
bool parse(const string& message);
float getSpeedInKnots();
float getSpeedInMPH();
float calcLatitude;
float calcLongitude;
float calcSpeedInNMPH;
float calcSpeedInMPH;
float calcCourse;
// _timeSinceStart is used for if we are calculating speed based on travel
// over n seconds instead of GPS output speed which is pretty inaccurate
// when stationary or moving slowly
int _timeSinceStart;
// How far back in seconds to try and calculate speed
// works getting a coordinate a couple seonds back
// and calculating speed from that rather than direct speed
// output from GPS to disable just set to 0 then uses GPS speed
// output
float _gpsSpeedInNMPH;
float _gpsCourse;
string _gpsGllLatitude;
string _gpsLatitudeDirection;
string _gpsGllLongitude;
string _gpsLongitudeDirection;
string _gpsDataValidFlag;
string _gpsFixQuality;
string _gpsSatellites;
string _gpsHdop;
string _gpsAltitude;
string _gpsTime;
string _gpsStatus;
string _messageType;
string _hdop;
string _pdop;
int _goBackSecondsSpeedCalculation;
long _validReadingCount; // The number of valid latitude longitude readings from gps receiver
float getHistoryDecimalLongitude();
float getHistoryDecimalLatitude();
static const int MAX_SIZE = 300;
PaulNovack::LatLong latLongArray[MAX_SIZE] = {};
void pushLocationHistoryToFront(const LatLong& element);
Navigation* _navigation = nullptr;
GPSUtils* _gu = nullptr;
AppConfig* _config = nullptr;
private:
void processGGA(const vector<string>& tokens);
void processVTG(const vector<string>& tokens);
void processGLL(const vector<string>& tokens);
void processRMC(const vector<string>& tokens);
void processGSA(const vector<string>& tokens);
};
}
#endif // GPSPARSER_H