00001 /* 00002 * Roadnav 00003 * GPSMonitorThread.h 00004 * 00005 * Copyright (c) 2004 - 2008 Richard L. Lynch <rllynch@users.sourceforge.net> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of version 2 of the GNU General Public License 00009 * as published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 ////////////////////////////////////////////////////////////////////////////// 00022 /// \file 00023 /// 00024 /// Contains a thread that reads the current coordinates from a NMEA GPS 00025 /// unit and passes this to the update thread. 00026 /// 00027 ////////////////////////////////////////////////////////////////////////////// 00028 00029 #ifndef GPSMONITORTHREAD_H 00030 #define GPSMONITORTHREAD_H 00031 00032 #include <wx/wx.h> 00033 #include <wx/thread.h> 00034 #include <wx/event.h> 00035 #include <wx/socket.h> 00036 00037 #include <vector> 00038 00039 #include "libroadnav/Point.h" 00040 #include "SerialIO.h" 00041 #include "GPSInterface.h" 00042 #include "GPSInterface_GPSD.h" 00043 #include "GPSInterface_Serial.h" 00044 #include "GPSInterface_Simulated.h" 00045 #include "GPSInterface_None.h" 00046 00047 enum EGPSType 00048 { 00049 GPSTypeNone = 0, 00050 00051 #ifdef ROADNAV_SERIAL_SUPPORT 00052 GPSTypeSerial = 1, 00053 #endif 00054 00055 #ifdef HAVE_LIBGPS 00056 GPSTypeGPSD = 2, 00057 #endif 00058 00059 #ifdef HAVE_SIMULATED_GPS_SUPPORT 00060 GPSTypeSimulated = 3, 00061 #endif 00062 00063 GPSTypeAutoDetect = 4, 00064 GPSTypeAutoDetectInProgress = 5, 00065 }; 00066 00067 #define GPSTYPE_MAX GPSTypeAutoDetectInProgress 00068 00069 ////////////////////////////////////////////////////////////////////////////// 00070 /// 00071 /// \brief Monitors a serial port for NMEA sentences from a GPS unit. 00072 /// 00073 ////////////////////////////////////////////////////////////////////////////// 00074 class GPSMonitorThread : public wxThread 00075 { 00076 public: 00077 GPSMonitorThread(class MapFrame * pFrame); 00078 virtual void * Entry(); 00079 IGPSInterface * CreateGPSObject(EGPSType eGPSType); 00080 00081 static EGPSType GetGPSType(); 00082 static void SetGPSType(EGPSType eType); 00083 00084 static EGPSType GetLastSuccessfulAutoDetectGPSType(); 00085 static void SetLastSuccessfulAutoDetectGPSType(EGPSType eType); 00086 00087 private: 00088 /// Pointer to parent 00089 class MapFrame * m_pFrame; 00090 }; 00091 00092 #endif
1.5.5