-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGPRMC.h
95 lines (69 loc) · 2.65 KB
/
GPRMC.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
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
91
92
93
94
95
/*
Copyright 2013 Daniele Faugiana
This file is part of "WiGPS Arduino Library".
"WiGPS Arduino Library" is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
"WiGPS Arduino Library" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with "WiGPS Arduino Library". If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(ARDUINO) && ARDUINO >= 100
#include <arduino.h>
#elif defined(SPARK)
#include "application.h" //needs to be placed in extra classes
#endif
#ifndef _GPRMC_H
#define _GPRMC_H
#define COMMAS_NUMBER 12
#if !defined TRUE
#define TRUE 1
#endif
#if !defined FALSE
#define FALSE 0
#endif
#define CHECKSUM_VALID 1
#define CHECKSUM_NOT_PERFORMED 0
#define CHECKSUM_INVALID -1
#define PROTOCOL_NAME 0
#define UTC_TIME 1
#define DATA_VALID 2
#define LATITUDE_DEGREES 3
#define LATITUDE_REFERENCE 4
#define LONGITUDE_DEGREES 5
#define LONGITUDE_REFERENCE 6
#define COURSE 7
#define SPEED 8
#define UTC_DATE 9
#define OPERATION_MODE 12
typedef unsigned int uint;
class GPRMC: public String {
/*
* This class inherits from the C++
* String class and expands it to manipulate
* particular types of Strings which are
* GPRMC String from the NMEA protocol.
*/
private:
int commas[COMMAS_NUMBER]; // Array of commas positions in the raw String
int stringChecksum; // The String checksum received value
String findElements(int); // Internal element finder for the parsing
public:
GPRMC(char*);
int checksum(void); // Check if the String is valid or not
String UTCtime(void); // Return the UTC time
String dataValid(void); // Return the data valid character
String UTCdate(void); // Return the UTC date
String latitudeDeg(void); // Return the latitude degrees
String latitudeRef(void); // Return the latitude reference N/S
String longitudeDeg(void); // Return the longitude degrees
String longitudeRef(void); // Return the longitude reference W/E
String course(void); // Return the course degrees
String speed(void); // Return the speed in knots
String opMode(void); // Return the operation mode
};
#endif