Instrument Neutral Distributed Interface INDI  1.9.5
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 
84  // A number vector that stores lattitude and longitude
87 
88  // UTC and UTC Offset
89  IText TimeT[2] {};
91 
92  // Refresh data
95 
96  // Refresh Period
99 
100  int timerID = -1;
101 };
102 }
INDI::GPS::LocationN
INumber LocationN[3]
Definition: indigps.h:86
IPState
IPState
Property state.
Definition: indiapi.h:158
ISwitch
One switch descriptor.
INDI::GPS::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indigps.cpp:83
INumber
One number descriptor.
INDI::GPS::GPSLocation
GPSLocation
Definition: indigps.h:50
INDI::GPS::timerID
int timerID
Definition: indigps.h:100
INDI::GPS::PeriodN
INumber PeriodN[1]
Definition: indigps.h:97
INDI::GPS::RefreshS
ISwitch RefreshS[1]
Definition: indigps.h:93
INDI::GPS::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save refresh period
Definition: indigps.cpp:227
_ITextVectorProperty
Text vector property descriptor.
Definition: indiapi.h:244
INDI::GPS::LOCATION_ELEVATION
@ LOCATION_ELEVATION
Definition: indigps.h:54
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::GPS::LOCATION_LATITUDE
@ LOCATION_LATITUDE
Definition: indigps.h:52
INDI::GPS::TimeTP
ITextVectorProperty TimeTP
Definition: indigps.h:90
IText
One text descriptor.
INDI::GPS::LOCATION_LONGITUDE
@ LOCATION_LONGITUDE
Definition: indigps.h:53
INDI::GPS::TimerHit
virtual void TimerHit() override
TimerHit Keep calling updateGPS() until it is successfull, if it fails upon first connection.
Definition: indigps.cpp:127
INDI::GPS::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indigps.cpp:54
INDI::GPS::LocationNP
INumberVectorProperty LocationNP
Definition: indigps.h:85
INDI::GPS::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indigps.cpp:173
defaultdevice.h
INDI::GPS::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indigps.cpp:191
INDI::GPS::TimeT
IText TimeT[2]
Definition: indigps.h:89
INDI::GPS
Definition: indigps.h:47
INDI::GPS::RefreshSP
ISwitchVectorProperty RefreshSP
Definition: indigps.h:94
name
const char * name
Definition: indiserver.c:116
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::GPS::GPS
GPS()=default
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::GPS::PeriodNP
INumberVectorProperty PeriodNP
Definition: indigps.h:98
INDI::GPS::~GPS
virtual ~GPS()=default
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365
INDI::GPS::updateGPS
virtual IPState updateGPS()
updateGPS Retrieve Location & Time from GPS. Update LocationNP & TimeTP properties (value and state) ...
Definition: indigps.cpp:166