Index: trunk/firmware/sources/saigd/libnmea++/.cproject
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/.cproject b/trunk/firmware/sources/saigd/libnmea++/.cproject
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/.cproject (revision 118)
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/firmware/sources/saigd/libnmea++/.project
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/.project b/trunk/firmware/sources/saigd/libnmea++/.project
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/.project (revision 118)
@@ -0,0 +1,27 @@
+
+
+ libnmea++
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
Index: trunk/firmware/sources/saigd/libnmea++/gnss_info.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/gnss_info.cpp b/trunk/firmware/sources/saigd/libnmea++/gnss_info.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/gnss_info.cpp (revision 118)
@@ -0,0 +1,18 @@
+/*
+ * gnss_info.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "gnss_info.h"
+
+gnss_info::gnss_info() {
+ // TODO Auto-generated constructor stub
+
+}
+
+gnss_info::~gnss_info() {
+ // TODO Auto-generated destructor stub
+}
+
Index: trunk/firmware/sources/saigd/libnmea++/gnss_info.h
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/gnss_info.h b/trunk/firmware/sources/saigd/libnmea++/gnss_info.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/gnss_info.h (revision 118)
@@ -0,0 +1,134 @@
+/*
+ * gnss_info.h
+ * based on:
+ *
+ * NMEA library
+ * URL: http://nmea.sourceforge.net
+ * Author: Tim (xtimor@gmail.com)
+ * Licence: http://www.gnu.org/licenses/lgpl.html
+ * $Id: info.h 10 2007-11-15 14:50:15Z xtimor $
+ *
+ * Modified on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#ifndef GNSS_INFO_H_
+#define GNSS_INFO_H_
+
+
+#define NMEA_SIG_BAD (0)
+#define NMEA_SIG_LOW (1)
+#define NMEA_SIG_MID (2)
+#define NMEA_SIG_HIGH (3)
+
+#define NMEA_FIX_BAD (1)
+#define NMEA_FIX_2D (2)
+#define NMEA_FIX_3D (3)
+
+#define NMEA_MAXSAT (12)
+#define NMEA_SATINPACK (4)
+#define NMEA_NSATPACKS (NMEA_MAXSAT / NMEA_SATINPACK)
+
+#define NMEA_DEF_LAT (5001.2621)
+#define NMEA_DEF_LON (3613.0595)
+
+/**
+ * Position data in fractional degrees or radians
+ */
+typedef struct _gnss_pos
+{
+ double lat; /**< Latitude */
+ double lon; /**< Longitude */
+
+} gnss_pos;
+
+
+/**
+ * Date and time data
+ * @see gnss_time_now
+ */
+typedef struct _gnss_time
+{
+ int year; /**< Years since 1900 */
+ int mon; /**< Months since January - [0,11] */
+ int day; /**< Day of the month - [1,31] */
+ int hour; /**< Hours since midnight - [0,23] */
+ int min; /**< Minutes after the hour - [0,59] */
+ int sec; /**< Seconds after the minute - [0,59] */
+ int hsec; /**< Hundredth part of second - [0,99] */
+
+} gnss_time;
+
+
+/**
+ * Information about satellite
+ * @see gnss_satinfo
+ * @see nmeaGPGSV
+ */
+typedef struct _gnss_sat
+{
+ int id; /**< Satellite PRN number */
+ int in_use; /**< Used in position fix */
+ int elv; /**< Elevation in degrees, 90 maximum */
+ int azimuth; /**< Azimuth, degrees from true north, 000 to 359 */
+ int sig; /**< Signal, 00-99 dB */
+
+} gnss_sat;
+
+
+/**
+ * Information about all satellites in view
+ * @see gnss_info
+ * @see nmeaGPGSV
+ */
+typedef struct _gnss_satinfo
+{
+ int inuse; /**< Number of satellites in use (not those in view) */
+ int inview; /**< Total number of satellites in view */
+ gnss_sat sat[NMEA_MAXSAT]; /**< Satellites information */
+
+} gnss_satinfo;
+
+
+
+
+
+/**
+ * Summary GPS information from all parsed packets,
+ * used also for generating NMEA stream
+ * @see gnss_parse
+ * @see gnss_GPGGA2info, gnss_...2info
+ */
+class gnss_info {
+public:
+ gnss_info();
+ virtual ~gnss_info();
+ void gnss_zero_info(gnss_info *info);
+ void gnss_time_now(gnss_time *t);
+
+private:
+ int smask; /**< Mask specifying types of packages from which data have been obtained */
+ gnss_time utc; /**< UTC of position */
+ int sig; /**< GPS quality indicator (0 = Invalid; 1 = Fix; 2 = Differential, 3 = Sensitive) */
+ int fix; /**< Operating mode, used for navigation (1 = Fix not available; 2 = 2D; 3 = 3D) */
+ double PDOP; /**< Position Dilution Of Precision */
+ double HDOP; /**< Horizontal Dilution Of Precision */
+ double VDOP; /**< Vertical Dilution Of Precision */
+ double lat; /**< Latitude in NDEG - +/-[degree][min].[sec/60] */
+ double lon; /**< Longitude in NDEG - +/-[degree][min].[sec/60] */
+ double elv; /**< Antenna altitude above/below mean sea level (geoid) in meters */
+ double speed; /**< Speed over the ground in kilometers/hour */
+ double direction; /**< Track angle in degrees True */
+ double declination; /**< Magnetic variation degrees (Easterly var. subtracts from true course) */
+ gnss_satinfo satinfo;/**< Satellites information */
+};
+
+
+
+
+
+
+
+
+
+#endif /* GNSS_INFO_H_ */
Index: trunk/firmware/sources/saigd/libnmea++/main.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/main.cpp b/trunk/firmware/sources/saigd/libnmea++/main.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/main.cpp (revision 118)
@@ -0,0 +1,19 @@
+#include
+#include "nmea_code.h"
+#include "gnss_info.h"
+#include "parse/code_parser.h"
+
+int main(){
+
+ nmea_code a;
+ gnss_info b;
+ code_parser p;
+
+ a.set_string("$GpgLL,rewwe,456,789,0");
+
+ p.parse_nmea(&a,&b);
+
+ printf("ffrtrt %s %s %s",a.get_parameter(0),a.get_parameter(1),a.get_parameter(2));
+
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/nmea_code.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/nmea_code.cpp b/trunk/firmware/sources/saigd/libnmea++/nmea_code.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/nmea_code.cpp (revision 118)
@@ -0,0 +1,91 @@
+/*
+ * nmea_code.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include
+#include
+#include
+#include "nmea_code.h"
+
+nmea_code::nmea_code():
+p_next(NULL),p_prev(NULL),
+nmeastring(NULL),nmeasplit(NULL),
+num_params(0){
+
+}
+
+nmea_code::~nmea_code() {
+
+}
+
+nmea_code& nmea_code::operator <<(nmea_code& pcd) {
+ assert(&pcd!=0);
+ this->p_next = &pcd;
+ pcd.set_prev(this);
+ return pcd;
+}
+
+nmea_code& nmea_code::operator >>(nmea_code& pcd) {
+ pcd.set_string(this->nmeastring);
+ pcd.set_next(this->p_next);
+ pcd.set_prev(this->p_prev);
+ return *pcd.prev();
+}
+
+bool nmea_code::set_string(const char* strnmea){
+ size_t len = strlen(strnmea);
+ nmeastring = new char[len+1];
+ nmeastring[len] = '\0';
+ strcpy(nmeastring,strnmea);
+ split_code();
+ return true;
+}
+
+char* nmea_code::get_string() {
+ size_t len = strlen(nmeastring);
+ char* strnmea = new char[len];
+ strcpy(strnmea,nmeastring);
+ return strnmea;
+}
+
+char* nmea_code::get_parameter(int index){
+ if( (index >= 0 ) && ( index < num_params ) )
+ {
+ char *elem = new char[strlen(nmeasplit[index])];
+ strcpy(elem,nmeasplit[index]);
+ return elem;
+ }
+ return NULL;
+}
+
+
+void nmea_code::split_code(void) {
+ char* params[20];
+
+ size_t sz = strlen(nmeastring);
+ char* code = new char[sz+1];
+ //code[sz]='\0';
+ strcpy(code,nmeastring);
+
+ code = strtok(code,"$,");
+ int i=0;
+ while (code != NULL)
+ {
+ sz = strlen(code);
+ params[i] = new char[sz+1];
+ params[i][sz]='\0';
+ strcpy(params[i++],code);
+ code = strtok (NULL, " ,.-");
+ }
+ num_params=i;
+ nmeasplit = new char* [i];
+
+ for(int j=0;j>(nmea_code&);
+ nmea_code& operator <<(nmea_code&);
+
+ bool set_next(nmea_code* ptr){p_next = ptr; return true;};
+ bool set_prev(nmea_code* ptr){p_prev = ptr; return true;};
+
+private:
+ nmea_code* p_next;
+ nmea_code* p_prev;
+ char* nmeastring;
+ char** nmeasplit;
+ int num_params;
+ void split_code(void);
+};
+
+#endif /* PARSE_NMEA_CODE_H_ */
Index: trunk/firmware/sources/saigd/libnmea++/parse/code_parser.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.cpp (revision 118)
@@ -0,0 +1,33 @@
+/*
+ * code_parser.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "code_parser.h"
+#include
+#include
+#include
+
+code_parser::code_parser():
+parser(NULL){
+ subscribe_nmea_codes(supported_codes);
+}
+
+code_parser::~code_parser() {
+
+}
+
+bool code_parser::parse_nmea(nmea_code* nc, gnss_info* gi) {
+ std::string cd(nc->get_parameter(0));
+ std::transform(cd.begin(), cd.end(),cd.begin(), ::toupper);
+ parser=supported_codes[cd];
+ if(parser!=NULL)
+ {
+ parser(nc,gi);
+ return true;
+ }
+ return false;
+}
+
Index: trunk/firmware/sources/saigd/libnmea++/parse/code_parser.h
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.h b/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/code_parser.h (revision 118)
@@ -0,0 +1,29 @@
+/*
+ * code_parser.h
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#ifndef PARSE_CODE_PARSER_H_
+#define PARSE_CODE_PARSER_H_
+
+#include "nmea_defs.h"
+/**
+ * class code_parser
+ * se encarga de decodificar la informacion de una trama NMEA
+ *
+ */
+class code_parser {
+public:
+ code_parser();
+ virtual ~code_parser();
+
+ bool parse_nmea(nmea_code*, gnss_info*);
+
+private:
+ pnmea_parse parser;
+ code supported_codes;
+};
+
+#endif /* PARSE_CODE_PARSER_H_ */
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpalm_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpalm_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpalm_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpalm_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpalm_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpalm_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpgga_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpgga_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpgga_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpgga_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpgga_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpgga_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpgll_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpgll_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpgll_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpgll_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpgll_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpgll_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpgsa_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpgsa_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpgsa_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpgsa_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpgsa_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpgsa_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpgsv_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpgsv_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpgsv_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpgsv_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpgsv_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpgsv_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gprmc_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gprmc_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gprmc_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gprmc_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gprmc_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gprmc_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/gpvtg_parse.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/gpvtg_parse.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/gpvtg_parse.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/gpvtg_parse.cpp (revision 118)
@@ -0,0 +1,12 @@
+/*
+ * gpvtg_parse.cpp
+ *
+ * Created on: Oct 29, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+
+int gpvtg_parse(nmea_code*, gnss_info*){
+ return 0;
+}
Index: trunk/firmware/sources/saigd/libnmea++/parse/nmea_defs.cpp
===================================================================
diff --git a/trunk/firmware/sources/saigd/libnmea++/parse/nmea_defs.cpp b/trunk/firmware/sources/saigd/libnmea++/parse/nmea_defs.cpp
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/firmware/sources/saigd/libnmea++/parse/nmea_defs.cpp (revision 118)
@@ -0,0 +1,39 @@
+/*
+ * nmea_defs.cpp
+ *
+ * Created on: Oct 30, 2014
+ * Author: Alan Aguilar Sologuren
+ */
+
+#include "nmea_defs.h"
+#include