Allows for a GPS module to be connected to a serial port and exposes an easy to use API to get the GPS data. New feature, added Mbed/LPC17xx RTC synchronisation

Dependents:   SatGPS AntiTheftGPS FLIGHT_CONTROL_AND_COMMUNICATIONS_SYSTEM GPS-Lora ... more

Revision:
6:64771e31464e
Parent:
3:28a1b60b0f37
--- a/GPS.h	Wed Apr 20 09:15:07 2011 +0000
+++ b/GPS.h	Thu Apr 21 14:06:17 2011 +0000
@@ -697,6 +697,80 @@
     //! A callback object for the NMEA RMS message processed signal user API.
     FunctionPointer cb_vtg;
     
+    //! Attach a user callback function to the unknown NMEA message.
+    /**
+     * Attach a user callback object/method to call when an unknown NMEA packet. 
+     *
+     * @code
+     *     class FOO {
+     *     public:
+     *         void myCallback(void);
+     *     };
+     *
+     *     GPS gps(NC, p9); 
+     *     Foo foo;
+     *
+     *     gps.attach_ukn(foo, &FOO::myCallback);
+     * 
+     * @endcode
+     *
+     * @ingroup API 
+     * @param tptr pointer to the object to call the member function on
+     * @param mptr pointer to the member function to be called
+     */
+    template<typename T>
+    void attach_ukn(T* tptr, void (T::*mptr)(void)) { cb_ukn.attach(tptr, mptr); }
+    
+    //! Attach a user callback function to the unknown NMEA message.
+    /**
+     * Attach a user callback function pointer to call when an unknown NMEA. 
+     *
+     * @code
+     *     void myCallback(void) { ... }
+     *
+     *     GPS gps(NC, p9); 
+     *     Foo foo;
+     *
+     *     gps.attach_ukn(&myCallback);
+     * 
+     * @endcode
+     *
+     * @ingroup API 
+     * @param fptr Callback function pointer.
+     */
+    void attach_ukn(void (*fptr)(void)) { cb_ukn.attach(fptr); } 
+    
+    //! A callback object for the NMEA RMS message processed signal user API.
+    FunctionPointer cb_ukn;
+    
+    /**
+     * Set's the GGA string memory pointer.
+     * @param s char pointer ti string.
+     * @return char s passed in.
+     */
+    char * setGga(char *s) { _gga = s; return s; }
+    
+    /**
+     * Set's the RMC string memory pointer.
+     * @param s char pointer ti string.
+     * @return char s passed in.
+     */
+    char * setRmc(char *s) { _rmc = s; return s; };
+    
+    /**
+     * Set's the VTG string memory pointer.
+     * @param s char pointer ti string.
+     * @return char s passed in.
+     */
+    char * setVtg(char *s) { _vtg = s; return s; };
+    
+    /**
+     * Set's the UKN string memory pointer.
+     * @param s char pointer ti string.
+     * @return char s passed in.
+     */
+    char * setUkn(char *s) { _ukn = s; return s; };
+    
     //! Set the baud rate the GPS module is using.
     /** 
      * Set the baud rate of the serial port
@@ -762,6 +836,11 @@
     //! Used to record the previous byte received.
     char _lastByte;
     
+    char *_gga;
+    char *_rmc;
+    char *_vtg;
+    char *_ukn;
+    
     //! Used for debugging.
     bool _nmeaOnUart0;      
 };