summaryrefslogtreecommitdiff
path: root/include/nmeaparse/GPSService.h
blob: 8b9e29106e209d022d2df0a70236fc3c4573fa02 (plain)
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
/*
 * GPSService.h
 *
 *  Created on: Aug 14, 2014
 *      Author: Cameron Karlsson
 *
 *  See the license file included with this source.
 */

#ifndef GPSSERVICE_H_
#define GPSSERVICE_H_

#include <string>
#include <chrono>
#include <functional>
#include <nmeaparse/GPSFix.h>
#include <nmeaparse/NMEAParser.h>
#include <nmeaparse/Event.h>

namespace nmea {

class GPSService {
private:

	void read_PSRF150(const NMEASentence& nmea);
	void read_GPGGA	(const NMEASentence& nmea);
	void read_GPGSA	(const NMEASentence& nmea);
	void read_GPGSV	(const NMEASentence& nmea);
	void read_GPRMC	(const NMEASentence& nmea);
	void read_GPVTG	(const NMEASentence& nmea);

public:
	GPSFix fix;

	GPSService(NMEAParser& parser);
	virtual ~GPSService();

	Event<void(bool)> onLockStateChanged;		// user assignable handler, called whenever lock changes
	Event<void()> onUpdate;						// user assignable handler, called whenever fix changes

	void attachToParser(NMEAParser& parser);			// will attach to this parser's nmea sentence events
};


}

#endif /* GPSSERVICE_H_ */