@@ -0,0 +1,113 | |||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
|
2 | <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | |
|
3 | <storageModule moduleId="org.eclipse.cdt.core.settings"> | |
|
4 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1949920268"> | |
|
5 | <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1949920268" moduleId="org.eclipse.cdt.core.settings" name="Debug"> | |
|
6 | <externalSettings/> | |
|
7 | <extensions> | |
|
8 | <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
9 | <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
10 | <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
11 | <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
12 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
13 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |
|
14 | </extensions> | |
|
15 | </storageModule> | |
|
16 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
17 | <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1949920268" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug"> | |
|
18 | <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1949920268." name="/" resourcePath=""> | |
|
19 | <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.978140244" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> | |
|
20 | <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.108327079" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> | |
|
21 | <builder buildPath="${workspace_loc:/libnmea++}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.2095836823" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/> | |
|
22 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.540888476" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> | |
|
23 | <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1590703900" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> | |
|
24 | <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1393629439" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> | |
|
25 | <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.477013815" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> | |
|
26 | <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.975501949" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> | |
|
27 | </tool> | |
|
28 | <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.186973249" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"> | |
|
29 | <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.53019835" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/> | |
|
30 | <option id="gnu.c.compiler.exe.debug.option.debugging.level.1752391011" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/> | |
|
31 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1413233866" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> | |
|
32 | </tool> | |
|
33 | <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.949856218" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/> | |
|
34 | <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.315633593" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"> | |
|
35 | <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1677926797" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> | |
|
36 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | |
|
37 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> | |
|
38 | </inputType> | |
|
39 | </tool> | |
|
40 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1976679165" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"> | |
|
41 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1769600803" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> | |
|
42 | </tool> | |
|
43 | </toolChain> | |
|
44 | </folderInfo> | |
|
45 | </configuration> | |
|
46 | </storageModule> | |
|
47 | <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | |
|
48 | </cconfiguration> | |
|
49 | <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.957946712"> | |
|
50 | <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.957946712" moduleId="org.eclipse.cdt.core.settings" name="Release"> | |
|
51 | <externalSettings/> | |
|
52 | <extensions> | |
|
53 | <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
54 | <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
55 | <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
56 | <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
57 | <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | |
|
58 | <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> | |
|
59 | </extensions> | |
|
60 | </storageModule> | |
|
61 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
62 | <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.957946712" name="Release" parent="cdt.managedbuild.config.gnu.exe.release"> | |
|
63 | <folderInfo id="cdt.managedbuild.config.gnu.exe.release.957946712." name="/" resourcePath=""> | |
|
64 | <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1565343331" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release"> | |
|
65 | <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.781880630" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/> | |
|
66 | <builder buildPath="${workspace_loc:/libnmea++}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.2000184085" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/> | |
|
67 | <tool id="cdt.managedbuild.tool.gnu.archiver.base.2039418116" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> | |
|
68 | <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.279828679" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release"> | |
|
69 | <option id="gnu.cpp.compiler.exe.release.option.optimization.level.758016715" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/> | |
|
70 | <option id="gnu.cpp.compiler.exe.release.option.debugging.level.1363867102" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> | |
|
71 | <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.527598583" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> | |
|
72 | </tool> | |
|
73 | <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1934022143" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"> | |
|
74 | <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1281158377" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/> | |
|
75 | <option id="gnu.c.compiler.exe.release.option.debugging.level.46143779" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/> | |
|
76 | <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.974731053" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> | |
|
77 | </tool> | |
|
78 | <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.858494656" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/> | |
|
79 | <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1668715572" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"> | |
|
80 | <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1492596694" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> | |
|
81 | <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | |
|
82 | <additionalInput kind="additionalinput" paths="$(LIBS)"/> | |
|
83 | </inputType> | |
|
84 | </tool> | |
|
85 | <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1157465308" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"> | |
|
86 | <inputType id="cdt.managedbuild.tool.gnu.assembler.input.793439175" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> | |
|
87 | </tool> | |
|
88 | </toolChain> | |
|
89 | </folderInfo> | |
|
90 | </configuration> | |
|
91 | </storageModule> | |
|
92 | </cconfiguration> | |
|
93 | </storageModule> | |
|
94 | <storageModule moduleId="cdtBuildSystem" version="4.0.0"> | |
|
95 | <project id="libnmea++.cdt.managedbuild.target.gnu.exe.1186727730" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> | |
|
96 | </storageModule> | |
|
97 | <storageModule moduleId="scannerConfiguration"> | |
|
98 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
99 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1949920268;cdt.managedbuild.config.gnu.exe.debug.1949920268.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.186973249;cdt.managedbuild.tool.gnu.c.compiler.input.1413233866"> | |
|
100 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
101 | </scannerConfigBuildInfo> | |
|
102 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.957946712;cdt.managedbuild.config.gnu.exe.release.957946712.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1934022143;cdt.managedbuild.tool.gnu.c.compiler.input.974731053"> | |
|
103 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
104 | </scannerConfigBuildInfo> | |
|
105 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.957946712;cdt.managedbuild.config.gnu.exe.release.957946712.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.279828679;cdt.managedbuild.tool.gnu.cpp.compiler.input.527598583"> | |
|
106 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
107 | </scannerConfigBuildInfo> | |
|
108 | <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1949920268;cdt.managedbuild.config.gnu.exe.debug.1949920268.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1590703900;cdt.managedbuild.tool.gnu.cpp.compiler.input.975501949"> | |
|
109 | <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | |
|
110 | </scannerConfigBuildInfo> | |
|
111 | </storageModule> | |
|
112 | <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | |
|
113 | </cproject> |
@@ -0,0 +1,27 | |||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
2 | <projectDescription> | |
|
3 | <name>libnmea++</name> | |
|
4 | <comment></comment> | |
|
5 | <projects> | |
|
6 | </projects> | |
|
7 | <buildSpec> | |
|
8 | <buildCommand> | |
|
9 | <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | |
|
10 | <triggers>clean,full,incremental,</triggers> | |
|
11 | <arguments> | |
|
12 | </arguments> | |
|
13 | </buildCommand> | |
|
14 | <buildCommand> | |
|
15 | <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | |
|
16 | <triggers>full,incremental,</triggers> | |
|
17 | <arguments> | |
|
18 | </arguments> | |
|
19 | </buildCommand> | |
|
20 | </buildSpec> | |
|
21 | <natures> | |
|
22 | <nature>org.eclipse.cdt.core.cnature</nature> | |
|
23 | <nature>org.eclipse.cdt.core.ccnature</nature> | |
|
24 | <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | |
|
25 | <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | |
|
26 | </natures> | |
|
27 | </projectDescription> |
@@ -0,0 +1,18 | |||
|
1 | /* | |
|
2 | * gnss_info.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "gnss_info.h" | |
|
9 | ||
|
10 | gnss_info::gnss_info() { | |
|
11 | // TODO Auto-generated constructor stub | |
|
12 | ||
|
13 | } | |
|
14 | ||
|
15 | gnss_info::~gnss_info() { | |
|
16 | // TODO Auto-generated destructor stub | |
|
17 | } | |
|
18 |
@@ -0,0 +1,134 | |||
|
1 | /* | |
|
2 | * gnss_info.h | |
|
3 | * based on: | |
|
4 | * | |
|
5 | * NMEA library | |
|
6 | * URL: http://nmea.sourceforge.net | |
|
7 | * Author: Tim (xtimor@gmail.com) | |
|
8 | * Licence: http://www.gnu.org/licenses/lgpl.html | |
|
9 | * $Id: info.h 10 2007-11-15 14:50:15Z xtimor $ | |
|
10 | * | |
|
11 | * Modified on: Oct 29, 2014 | |
|
12 | * Author: Alan Aguilar Sologuren | |
|
13 | */ | |
|
14 | ||
|
15 | #ifndef GNSS_INFO_H_ | |
|
16 | #define GNSS_INFO_H_ | |
|
17 | ||
|
18 | ||
|
19 | #define NMEA_SIG_BAD (0) | |
|
20 | #define NMEA_SIG_LOW (1) | |
|
21 | #define NMEA_SIG_MID (2) | |
|
22 | #define NMEA_SIG_HIGH (3) | |
|
23 | ||
|
24 | #define NMEA_FIX_BAD (1) | |
|
25 | #define NMEA_FIX_2D (2) | |
|
26 | #define NMEA_FIX_3D (3) | |
|
27 | ||
|
28 | #define NMEA_MAXSAT (12) | |
|
29 | #define NMEA_SATINPACK (4) | |
|
30 | #define NMEA_NSATPACKS (NMEA_MAXSAT / NMEA_SATINPACK) | |
|
31 | ||
|
32 | #define NMEA_DEF_LAT (5001.2621) | |
|
33 | #define NMEA_DEF_LON (3613.0595) | |
|
34 | ||
|
35 | /** | |
|
36 | * Position data in fractional degrees or radians | |
|
37 | */ | |
|
38 | typedef struct _gnss_pos | |
|
39 | { | |
|
40 | double lat; /**< Latitude */ | |
|
41 | double lon; /**< Longitude */ | |
|
42 | ||
|
43 | } gnss_pos; | |
|
44 | ||
|
45 | ||
|
46 | /** | |
|
47 | * Date and time data | |
|
48 | * @see gnss_time_now | |
|
49 | */ | |
|
50 | typedef struct _gnss_time | |
|
51 | { | |
|
52 | int year; /**< Years since 1900 */ | |
|
53 | int mon; /**< Months since January - [0,11] */ | |
|
54 | int day; /**< Day of the month - [1,31] */ | |
|
55 | int hour; /**< Hours since midnight - [0,23] */ | |
|
56 | int min; /**< Minutes after the hour - [0,59] */ | |
|
57 | int sec; /**< Seconds after the minute - [0,59] */ | |
|
58 | int hsec; /**< Hundredth part of second - [0,99] */ | |
|
59 | ||
|
60 | } gnss_time; | |
|
61 | ||
|
62 | ||
|
63 | /** | |
|
64 | * Information about satellite | |
|
65 | * @see gnss_satinfo | |
|
66 | * @see nmeaGPGSV | |
|
67 | */ | |
|
68 | typedef struct _gnss_sat | |
|
69 | { | |
|
70 | int id; /**< Satellite PRN number */ | |
|
71 | int in_use; /**< Used in position fix */ | |
|
72 | int elv; /**< Elevation in degrees, 90 maximum */ | |
|
73 | int azimuth; /**< Azimuth, degrees from true north, 000 to 359 */ | |
|
74 | int sig; /**< Signal, 00-99 dB */ | |
|
75 | ||
|
76 | } gnss_sat; | |
|
77 | ||
|
78 | ||
|
79 | /** | |
|
80 | * Information about all satellites in view | |
|
81 | * @see gnss_info | |
|
82 | * @see nmeaGPGSV | |
|
83 | */ | |
|
84 | typedef struct _gnss_satinfo | |
|
85 | { | |
|
86 | int inuse; /**< Number of satellites in use (not those in view) */ | |
|
87 | int inview; /**< Total number of satellites in view */ | |
|
88 | gnss_sat sat[NMEA_MAXSAT]; /**< Satellites information */ | |
|
89 | ||
|
90 | } gnss_satinfo; | |
|
91 | ||
|
92 | ||
|
93 | ||
|
94 | ||
|
95 | ||
|
96 | /** | |
|
97 | * Summary GPS information from all parsed packets, | |
|
98 | * used also for generating NMEA stream | |
|
99 | * @see gnss_parse | |
|
100 | * @see gnss_GPGGA2info, gnss_...2info | |
|
101 | */ | |
|
102 | class gnss_info { | |
|
103 | public: | |
|
104 | gnss_info(); | |
|
105 | virtual ~gnss_info(); | |
|
106 | void gnss_zero_info(gnss_info *info); | |
|
107 | void gnss_time_now(gnss_time *t); | |
|
108 | ||
|
109 | private: | |
|
110 | int smask; /**< Mask specifying types of packages from which data have been obtained */ | |
|
111 | gnss_time utc; /**< UTC of position */ | |
|
112 | int sig; /**< GPS quality indicator (0 = Invalid; 1 = Fix; 2 = Differential, 3 = Sensitive) */ | |
|
113 | int fix; /**< Operating mode, used for navigation (1 = Fix not available; 2 = 2D; 3 = 3D) */ | |
|
114 | double PDOP; /**< Position Dilution Of Precision */ | |
|
115 | double HDOP; /**< Horizontal Dilution Of Precision */ | |
|
116 | double VDOP; /**< Vertical Dilution Of Precision */ | |
|
117 | double lat; /**< Latitude in NDEG - +/-[degree][min].[sec/60] */ | |
|
118 | double lon; /**< Longitude in NDEG - +/-[degree][min].[sec/60] */ | |
|
119 | double elv; /**< Antenna altitude above/below mean sea level (geoid) in meters */ | |
|
120 | double speed; /**< Speed over the ground in kilometers/hour */ | |
|
121 | double direction; /**< Track angle in degrees True */ | |
|
122 | double declination; /**< Magnetic variation degrees (Easterly var. subtracts from true course) */ | |
|
123 | gnss_satinfo satinfo;/**< Satellites information */ | |
|
124 | }; | |
|
125 | ||
|
126 | ||
|
127 | ||
|
128 | ||
|
129 | ||
|
130 | ||
|
131 | ||
|
132 | ||
|
133 | ||
|
134 | #endif /* GNSS_INFO_H_ */ |
@@ -0,0 +1,19 | |||
|
1 | #include <cstdio> | |
|
2 | #include "nmea_code.h" | |
|
3 | #include "gnss_info.h" | |
|
4 | #include "parse/code_parser.h" | |
|
5 | ||
|
6 | int main(){ | |
|
7 | ||
|
8 | nmea_code a; | |
|
9 | gnss_info b; | |
|
10 | code_parser p; | |
|
11 | ||
|
12 | a.set_string("$GpgLL,rewwe,456,789,0"); | |
|
13 | ||
|
14 | p.parse_nmea(&a,&b); | |
|
15 | ||
|
16 | printf("ffrtrt %s %s %s",a.get_parameter(0),a.get_parameter(1),a.get_parameter(2)); | |
|
17 | ||
|
18 | return 0; | |
|
19 | } |
@@ -0,0 +1,91 | |||
|
1 | /* | |
|
2 | * nmea_code.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include <cassert> | |
|
9 | #include <cstring> | |
|
10 | #include <cstddef> | |
|
11 | #include "nmea_code.h" | |
|
12 | ||
|
13 | nmea_code::nmea_code(): | |
|
14 | p_next(NULL),p_prev(NULL), | |
|
15 | nmeastring(NULL),nmeasplit(NULL), | |
|
16 | num_params(0){ | |
|
17 | ||
|
18 | } | |
|
19 | ||
|
20 | nmea_code::~nmea_code() { | |
|
21 | ||
|
22 | } | |
|
23 | ||
|
24 | nmea_code& nmea_code::operator <<(nmea_code& pcd) { | |
|
25 | assert(&pcd!=0); | |
|
26 | this->p_next = &pcd; | |
|
27 | pcd.set_prev(this); | |
|
28 | return pcd; | |
|
29 | } | |
|
30 | ||
|
31 | nmea_code& nmea_code::operator >>(nmea_code& pcd) { | |
|
32 | pcd.set_string(this->nmeastring); | |
|
33 | pcd.set_next(this->p_next); | |
|
34 | pcd.set_prev(this->p_prev); | |
|
35 | return *pcd.prev(); | |
|
36 | } | |
|
37 | ||
|
38 | bool nmea_code::set_string(const char* strnmea){ | |
|
39 | size_t len = strlen(strnmea); | |
|
40 | nmeastring = new char[len+1]; | |
|
41 | nmeastring[len] = '\0'; | |
|
42 | strcpy(nmeastring,strnmea); | |
|
43 | split_code(); | |
|
44 | return true; | |
|
45 | } | |
|
46 | ||
|
47 | char* nmea_code::get_string() { | |
|
48 | size_t len = strlen(nmeastring); | |
|
49 | char* strnmea = new char[len]; | |
|
50 | strcpy(strnmea,nmeastring); | |
|
51 | return strnmea; | |
|
52 | } | |
|
53 | ||
|
54 | char* nmea_code::get_parameter(int index){ | |
|
55 | if( (index >= 0 ) && ( index < num_params ) ) | |
|
56 | { | |
|
57 | char *elem = new char[strlen(nmeasplit[index])]; | |
|
58 | strcpy(elem,nmeasplit[index]); | |
|
59 | return elem; | |
|
60 | } | |
|
61 | return NULL; | |
|
62 | } | |
|
63 | ||
|
64 | ||
|
65 | void nmea_code::split_code(void) { | |
|
66 | char* params[20]; | |
|
67 | ||
|
68 | size_t sz = strlen(nmeastring); | |
|
69 | char* code = new char[sz+1]; | |
|
70 | //code[sz]='\0'; | |
|
71 | strcpy(code,nmeastring); | |
|
72 | ||
|
73 | code = strtok(code,"$,"); | |
|
74 | int i=0; | |
|
75 | while (code != NULL) | |
|
76 | { | |
|
77 | sz = strlen(code); | |
|
78 | params[i] = new char[sz+1]; | |
|
79 | params[i][sz]='\0'; | |
|
80 | strcpy(params[i++],code); | |
|
81 | code = strtok (NULL, " ,.-"); | |
|
82 | } | |
|
83 | num_params=i; | |
|
84 | nmeasplit = new char* [i]; | |
|
85 | ||
|
86 | for(int j=0;j<i;j++){ | |
|
87 | nmeasplit[j] = params[j]; | |
|
88 | } | |
|
89 | } | |
|
90 | ||
|
91 |
@@ -0,0 +1,39 | |||
|
1 | /* | |
|
2 | * nmea_code.h | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #ifndef PARSE_NMEA_CODE_H_ | |
|
9 | #define PARSE_NMEA_CODE_H_ | |
|
10 | ||
|
11 | class nmea_code { | |
|
12 | public: | |
|
13 | nmea_code(); | |
|
14 | virtual ~nmea_code(); | |
|
15 | ||
|
16 | bool set_string(const char*); | |
|
17 | char* get_string(); | |
|
18 | char* get_parameter(int); | |
|
19 | ||
|
20 | ||
|
21 | ||
|
22 | nmea_code* next(void){return p_next;}; | |
|
23 | nmea_code* prev(void){return p_prev;}; | |
|
24 | nmea_code& operator >>(nmea_code&); | |
|
25 | nmea_code& operator <<(nmea_code&); | |
|
26 | ||
|
27 | bool set_next(nmea_code* ptr){p_next = ptr; return true;}; | |
|
28 | bool set_prev(nmea_code* ptr){p_prev = ptr; return true;}; | |
|
29 | ||
|
30 | private: | |
|
31 | nmea_code* p_next; | |
|
32 | nmea_code* p_prev; | |
|
33 | char* nmeastring; | |
|
34 | char** nmeasplit; | |
|
35 | int num_params; | |
|
36 | void split_code(void); | |
|
37 | }; | |
|
38 | ||
|
39 | #endif /* PARSE_NMEA_CODE_H_ */ |
@@ -0,0 +1,33 | |||
|
1 | /* | |
|
2 | * code_parser.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "code_parser.h" | |
|
9 | #include <algorithm> | |
|
10 | #include <string> | |
|
11 | #include <cstring> | |
|
12 | ||
|
13 | code_parser::code_parser(): | |
|
14 | parser(NULL){ | |
|
15 | subscribe_nmea_codes(supported_codes); | |
|
16 | } | |
|
17 | ||
|
18 | code_parser::~code_parser() { | |
|
19 | ||
|
20 | } | |
|
21 | ||
|
22 | bool code_parser::parse_nmea(nmea_code* nc, gnss_info* gi) { | |
|
23 | std::string cd(nc->get_parameter(0)); | |
|
24 | std::transform(cd.begin(), cd.end(),cd.begin(), ::toupper); | |
|
25 | parser=supported_codes[cd]; | |
|
26 | if(parser!=NULL) | |
|
27 | { | |
|
28 | parser(nc,gi); | |
|
29 | return true; | |
|
30 | } | |
|
31 | return false; | |
|
32 | } | |
|
33 |
@@ -0,0 +1,29 | |||
|
1 | /* | |
|
2 | * code_parser.h | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #ifndef PARSE_CODE_PARSER_H_ | |
|
9 | #define PARSE_CODE_PARSER_H_ | |
|
10 | ||
|
11 | #include "nmea_defs.h" | |
|
12 | /** | |
|
13 | * class code_parser | |
|
14 | * se encarga de decodificar la informacion de una trama NMEA | |
|
15 | * | |
|
16 | */ | |
|
17 | class code_parser { | |
|
18 | public: | |
|
19 | code_parser(); | |
|
20 | virtual ~code_parser(); | |
|
21 | ||
|
22 | bool parse_nmea(nmea_code*, gnss_info*); | |
|
23 | ||
|
24 | private: | |
|
25 | pnmea_parse parser; | |
|
26 | code supported_codes; | |
|
27 | }; | |
|
28 | ||
|
29 | #endif /* PARSE_CODE_PARSER_H_ */ |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpalm_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpalm_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpgga_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpgga_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpgll_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpgll_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpgsa_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpgsa_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpgsv_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpgsv_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gprmc_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gprmc_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * gpvtg_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int gpvtg_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,39 | |||
|
1 | /* | |
|
2 | * nmea_defs.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 30, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | #include <map> | |
|
10 | #include <string> | |
|
11 | ||
|
12 | ||
|
13 | void subscribe_nmea_codes(code& supported_codes){ | |
|
14 | // standard NMEA codes | |
|
15 | supported_codes["GPALM"] = &gpalm_parse; | |
|
16 | // GARMIN's NMEA codes | |
|
17 | supported_codes["PGRMI"] = &pgrmi_parse; | |
|
18 | supported_codes["PGRMC"] = &pgrmc_parse; | |
|
19 | supported_codes["PGRMC1"] = &pgrmc1_parse; | |
|
20 | supported_codes["PGRMO"] = &pgrmo_parse; | |
|
21 | ||
|
22 | /** | |
|
23 | * receptor transmite estos codigos | |
|
24 | */ | |
|
25 | // standard NMEA codes | |
|
26 | supported_codes["GPGGA"] = &gpgga_parse; | |
|
27 | supported_codes["GPGSA"] = &gpgsa_parse; | |
|
28 | supported_codes["GPGSV"] = &gpgsv_parse; | |
|
29 | supported_codes["GPRMC"] = &gprmc_parse; | |
|
30 | supported_codes["GPVTG"] = &gpvtg_parse; | |
|
31 | supported_codes["GPGLL"] = &gpgll_parse; | |
|
32 | // GARMIN's NMEA codes | |
|
33 | supported_codes["PGRME"] = &pgrme_parse; | |
|
34 | supported_codes["PGRMF"] = &pgrmf_parse; | |
|
35 | supported_codes["PGRMM"] = &pgrmm_parse; | |
|
36 | supported_codes["PGRMT"] = &pgrmt_parse; | |
|
37 | supported_codes["PGRMV"] = &pgrmv_parse; | |
|
38 | supported_codes["PGRMB"] = &pgrmb_parse; | |
|
39 | } |
@@ -0,0 +1,46 | |||
|
1 | /* | |
|
2 | * nmea_defs.h | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #pragma once | |
|
9 | ||
|
10 | #ifndef PARSE_NMEA_DEFS_H_ | |
|
11 | #define PARSE_NMEA_DEFS_H_ | |
|
12 | ||
|
13 | #include "../nmea_code.h" | |
|
14 | #include "../gnss_info.h" | |
|
15 | #include <map> | |
|
16 | #include <string> | |
|
17 | ||
|
18 | ||
|
19 | typedef int (*pnmea_parse)(nmea_code*, gnss_info*); | |
|
20 | typedef std::map<std::string, pnmea_parse> code; | |
|
21 | ||
|
22 | ||
|
23 | int gpalm_parse(nmea_code*, gnss_info*); | |
|
24 | int pgrmi_parse(nmea_code*, gnss_info*); | |
|
25 | int pgrmc_parse(nmea_code*, gnss_info*); | |
|
26 | int pgrmc1_parse(nmea_code*, gnss_info*); | |
|
27 | int pgrmo_parse(nmea_code*, gnss_info*); | |
|
28 | ||
|
29 | int gpgga_parse(nmea_code*, gnss_info*); | |
|
30 | int gpgsa_parse(nmea_code*, gnss_info*); | |
|
31 | int gpgsv_parse(nmea_code*, gnss_info*); | |
|
32 | int gprmc_parse(nmea_code*, gnss_info*); | |
|
33 | int gpvtg_parse(nmea_code*, gnss_info*); | |
|
34 | int gpgll_parse(nmea_code*, gnss_info*); | |
|
35 | int pgrme_parse(nmea_code*, gnss_info*); | |
|
36 | int pgrmf_parse(nmea_code*, gnss_info*); | |
|
37 | int pgrmm_parse(nmea_code*, gnss_info*); | |
|
38 | int pgrmt_parse(nmea_code*, gnss_info*); | |
|
39 | int pgrmv_parse(nmea_code*, gnss_info*); | |
|
40 | int pgrmb_parse(nmea_code*, gnss_info*); | |
|
41 | ||
|
42 | ||
|
43 | ||
|
44 | void subscribe_nmea_codes(code&); | |
|
45 | ||
|
46 | #endif /* PARSE_NMEA_DEFS_H_ */ |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmb_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmb_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmc1_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmc1_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmc_parce.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmc_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrme_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrme_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmf_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmf_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmi_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmi_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmm_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmm_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
@@ -0,0 +1,12 | |||
|
1 | /* | |
|
2 | * pgrmo_parse.cpp | |
|
3 | * | |
|
4 | * Created on: Oct 29, 2014 | |
|
5 | * Author: Alan Aguilar Sologuren | |
|
6 | */ | |
|
7 | ||
|
8 | #include "nmea_defs.h" | |
|
9 | ||
|
10 | int pgrmo_parse(nmea_code*, gnss_info*){ | |
|
11 | return 0; | |
|
12 | } |
General Comments 0
You need to be logged in to leave comments.
Login now