Instrument Neutral Distributed Interface INDI 2.2.5
indigps.cpp
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#include "indigps.h"
26
27#include <cstring>
28
29namespace INDI
30{
31
35GPS::GPS() : GPSI(this)
36{
37
38}
39
44{
46
47 GPSI::initProperties("Main Control");
48
50
51 // Default interface, can be overridden by child
53
54 return true;
55}
56
66
70bool GPS::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
71{
72 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
73 {
74 if (GPSI::processSwitch(dev, name, states, names, n))
75 {
78 return true;
79 }
80 }
81
82 return DefaultDevice::ISNewSwitch(dev, name, states, names, n);
83}
84
88bool GPS::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
89{
90 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
91 {
92 if (GPSI::processNumber(dev, name, values, names, n))
93 return true;
94 }
95
96 return DefaultDevice::ISNewNumber(dev, name, values, names, n);
97}
98
103{
106 return true;
107}
108}
const char * getDeviceName() const
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
void setDefaultPollingPeriod(uint32_t msec)
setDefaultPollingPeriod Change the default polling period to call TimerHit() function in the driver.
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
virtual bool saveConfigItems(FILE *fp)
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties()
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
Provides interface to implement GPS functionality.
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
INDI::PropertySwitch SystemTimeUpdateSP
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
virtual bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
void initProperties(const char *groupName)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition indigps.cpp:60
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition indigps.cpp:88
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition indigps.cpp:70
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
Definition indigps.cpp:43
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save refresh period
Definition indigps.cpp:102
const char * getName() const
bool isNameMatch(const char *otherName) const
ISState
Switch state.
Definition indiapi.h:148
Namespace to encapsulate INDI client, drivers, and mediator classes.