00001 /* 00002 Copyright (c) 2010 Les Newell. All rights reserved 00003 00004 This program is free software: you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation, either version 3 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00019 00034 //define the module. 00035 class GPS : public Module 00036 { 00037 DECLARE_MODULE(GPS,Module) 00038 00039 00040 //Only use this to expose sockets and parameters. Do most of your 00041 //initialisastion in Init() 00042 GPS() 00043 { 00044 AddSocket("GPS.Latitude", &m_latitude); 00045 AddSocket("GPS.Longitude", &m_longitude); 00046 AddSocket("GPS.Altitude", &m_altitude); 00047 AddSocket("GPS.Heading", &m_heading); 00048 AddSocket("GPS.Speed", &m_speed); 00049 AddSocket("GPS.OK",&m_ok); 00050 } 00051 00052 //A parameter has changed. This happens at bootup if the EEPROM 00053 //contains valid data and at run-time if the user changes a 00054 //parameter over the serial link 00055 virtual void ParamChanged(Socket * param) 00056 { 00057 } 00058 00059 //Initialise the module 00060 //set up hardware etc 00061 virtual void Init() 00062 { 00063 } 00064 00065 //Here is where you do your work. It is called at the rate defined by SetInterval 00066 virtual void Loop(const unsigned long& interval) 00067 { 00068 } 00069 00070 protected: 00071 Socket8 m_ok; 00072 SocketF m_latitude; 00073 SocketF m_longitude; 00074 SocketF m_altitude; 00075 SocketF m_heading; 00076 SocketF m_speed; 00077 00078 }; 00079 00080
1.7.0