Instrument Neutral Distributed Interface INDI  2.0.2
indigps.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3 
4  INDI GPS Device Class
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "defaultdevice.h"
28 
44 namespace INDI
45 {
46 
47 class GPS : public DefaultDevice
48 {
49  public:
51  {
55  };
56 
57  GPS() = default;
58  virtual ~GPS() = default;
59 
60  virtual bool initProperties() override;
61  virtual bool updateProperties() override;
62  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
63  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
64 
65  protected:
70  virtual IPState updateGPS();
71 
75  virtual void TimerHit() override;
76 
82  virtual bool saveConfigItems(FILE *fp) override;
83 
90  virtual bool setSystemTime(time_t &raw_time);
91 
92  // A number vector that stores latitude, longitude and altitude.
94 
95  // UTC and UTC Offset
97 
98  // Refresh data
100 
101  // Refresh Period
103 
104  int timerID = -1;
105 };
106 }
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indigps.cpp:59
INDI::PropertySwitch RefreshSP
Definition: indigps.h:99
virtual ~GPS()=default
GPSLocation
Definition: indigps.h:51
@ LOCATION_LONGITUDE
Definition: indigps.h:53
@ LOCATION_LATITUDE
Definition: indigps.h:52
@ LOCATION_ELEVATION
Definition: indigps.h:54
virtual IPState updateGPS()
updateGPS Retrieve Location & Time from GPS. Update LocationNP & TimeTP properties (value and state) ...
Definition: indigps.cpp:153
INDI::PropertyNumber LocationNP
Definition: indigps.h:93
INDI::PropertyText TimeTP
Definition: indigps.h:96
INDI::PropertyNumber PeriodNP
Definition: indigps.h:102
GPS()=default
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indigps.cpp:204
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indigps.cpp:186
int timerID
Definition: indigps.h:104
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indigps.cpp:32
virtual void TimerHit() override
TimerHit Keep calling updateGPS() until it is successfull, if it fails upon first connection.
Definition: indigps.cpp:103
virtual bool setSystemTime(time_t &raw_time)
SetSystemTime Update system-wide time.
Definition: indigps.cpp:163
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save refresh period
Definition: indigps.cpp:241
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
Namespace to encapsulate INDI client, drivers, and mediator classes.