Revision:
1:e143afe9a7ea
Parent:
0:01c9f535e512
Child:
2:6f49c74ab3b9
--- a/GPSParser.h	Tue Mar 27 04:39:16 2012 +0000
+++ b/GPSParser.h	Wed Mar 28 21:25:38 2012 +0000
@@ -1,9 +1,48 @@
-#include "mbed.h"
-
-#include "MODSERIAL.h"
-
-
-void gps_init (int num_sentence, MODSERIAL &gps);
-void ready_buffer (MODSERIAL_IRQ_INFO *q);
-//void get_gps (int num_sentences, MODSERIAL_IRQ_INFO *q);
-void read_gps (MODSERIAL &gps, MODSERIAL &pc);
\ No newline at end of file
+#include "mbed.h"
+#include "MODSERIAL.h"
+
+class GPSParser
+{
+    public:
+        
+        struct GPS
+        {
+            float latitude, lat_deg, lat_min, deg_latitude, longitude, long_deg, long_min, deg_longitude, altitude, HDOP, geoidal_sep, AODC, heading, mag_heading, speed_knots, speed_kph;
+            char ns, ew, mode;
+            int hours, minutes, seconds, m_seconds, fix, sats_used, DGPS_ID;
+            unsigned short checksum_gga, checksum_vtg;
+        };
+    
+        struct GPS readings;
+        
+        
+        GPSParser (PinName tx, PinName rx, int baud, int num_sentence, MODSERIAL &pc);
+        
+        void process_readings ();
+        
+        virtual void ready_buffer(MODSERIAL_IRQ_INFO *q);
+        /*{
+            MODSERIAL *serial = q->serial;
+        
+            if (serial->rxGetLastChar() == '\n')
+                ctr++;
+        
+            if (ctr == num_sentences)
+            {
+                read_gps();
+                ctr = 0;
+            }
+        };*/
+
+    protected:
+        
+        int GLL, RMC, VTG, GGA, GSA, GSV, GRS, GST, MALM, MEPH, MDGP, MDBG, ZDA, MCHN;
+        int num_sentences;// = 0;
+        volatile int ctr;// = 0;
+        int baudrate = 9600;
+    
+        MODSERIAL gps;
+        MODSERIAL pc;
+        
+
+};
\ No newline at end of file