00001 /* $Id: gpsd_position.hh,v 1.1 2002/08/23 03:32:45 reed Exp $ */ 00002 00003 /** 00004 Copyright (C) 2001, 2002 Reed Hedges <reed@zerohour.net> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library 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 GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 #ifndef _GPSD_POSITION_H_ 00023 #define _GPSD_POSITION_H_ 00024 00025 #include <stdio.h> 00026 00027 #include "position.hh" 00028 00029 /** This tracker interface class gets its data from gpsd, the Global 00030 Positioning System daemon by Remco Treffkorn: <http://russnelson.com/gpsd/>. 00031 gpsd listens on a TCP port and responds to simple commands with data from a GPS 00032 hooked up to the computer by serial cable. (I have noted most of the commands 00033 in the source, gps_position.cc). The latutude (LAT), longitude (LON) and altitutde 00034 (ALT) of the GPS are used for X, Y and Z, respectively. 00035 00036 */ 00037 00038 /** The default gpsd 1.06 TCP port. */ 00039 #define GPSD_DEFAULT_PORT 2947 00040 00041 00042 class GPSDPosition : public Position { 00043 protected: 00044 00045 int socket_fd; 00046 char* gpsd_host; 00047 int gpsd_port; 00048 00049 public: 00050 00051 /** Constructor: initializes values and oens socket to gpsd */ 00052 GPSDPosition(char* host = "localhost", int port = GPSD_DEFAULT_PORT) throw (DeviceError); 00053 00054 /** Destructor: closes socket. */ 00055 virtual ~GPSDPosition(); 00056 00057 00058 /** Get GPS status */ 00059 int getStatus() throw (DeviceError); 00060 00061 /** Read position from GPSD */ 00062 virtual void getPosition(double *x, double *y, double *z) throw(DeviceError); 00063 }; 00064 00065 00066 00067 00068 00069 #endif