Instrument Neutral Distributed Interface INDI  2.0.2
indirotator.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 *******************************************************************************/
18 
19 #pragma once
20 
21 #include "defaultdevice.h"
22 #include "indirotatorinterface.h"
23 
24 namespace Connection
25 {
26 class Serial;
27 class TCP;
28 }
42 namespace INDI
43 {
44 
45 class Rotator : public DefaultDevice, public RotatorInterface
46 {
47  public:
48  Rotator();
49  virtual ~Rotator();
50 
54  enum
55  {
56  CONNECTION_NONE = 1 << 0,
57  CONNECTION_SERIAL = 1 << 1,
58  CONNECTION_TCP = 1 << 2
60 
61  virtual bool initProperties() override;
62  virtual void ISGetProperties(const char *dev) override;
63  virtual bool updateProperties() override;
64  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
65  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
66 
72  void setRotatorConnection(const uint8_t &value);
73 
77  uint8_t getRotatorConnection() const;
78 
79  protected:
85  virtual bool saveConfigItems(FILE *fp) override;
86 
88  virtual bool Handshake();
89 
94 
97 
98  int PortFD = -1;
99 
100  private:
101  bool callHandshake();
102  uint8_t rotatorConnection = CONNECTION_SERIAL | CONNECTION_TCP;
103 };
104 }
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
The TCP class manages connection with devices over the network via TCP/IP. Upon successfull connectio...
Definition: connectiontcp.h:38
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Connection::Serial * serialConnection
Definition: indirotator.h:95
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indirotator.cpp:37
virtual bool Handshake()
perform handshake with device to check communication
INumberVectorProperty PresetNP
Definition: indirotator.h:91
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
enum INDI::Rotator::@249 RotatorConnection
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: indirotator.cpp:83
virtual ~Rotator()
Definition: indirotator.cpp:33
INumber PresetN[3]
Definition: indirotator.h:90
uint8_t getRotatorConnection() const
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indirotator.cpp:94
ISwitchVectorProperty PresetGotoSP
Definition: indirotator.h:93
void setRotatorConnection(const uint8_t &value)
setRotatorConnection Set Rotator connection mode. Child class should call this in the constructor bef...
ISwitch PresetGotoS[3]
Definition: indirotator.h:92
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the reverse direction property in the configuration file
Connection::TCP * tcpConnection
Definition: indirotator.h:96
ISState
Switch state.
Definition: indiapi.h:150
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition: arduino_st4.h:34
Namespace to encapsulate INDI client, drivers, and mediator classes.
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367