Instrument Neutral Distributed Interface INDI 2.2.5
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"
23#include "indipropertynumber.h"
24#include "indipropertyswitch.h"
25
26namespace Connection
27{
28class Serial;
29class TCP;
30}
44namespace INDI
45{
46
48{
49 public:
50 Rotator();
51 virtual ~Rotator();
52
56 enum
57 {
58 CONNECTION_NONE = 1 << 0,
60 CONNECTION_TCP = 1 << 2
62
63 virtual bool initProperties() override;
64 virtual void ISGetProperties(const char *dev) override;
65 virtual bool updateProperties() override;
66 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
67 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
68
74 void setRotatorConnection(const uint8_t &value);
75
79 uint8_t getRotatorConnection() const;
80
81 protected:
87 virtual bool saveConfigItems(FILE *fp) override;
88
90 virtual bool Handshake();
91
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 successful connection...
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
Initialize properties initial state and value. The child class must implement this function.
enum INDI::Rotator::@466 RotatorConnection
virtual bool Handshake()
perform handshake with device to check communication
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.
INDI::PropertyNumber PresetNP
Definition indirotator.h:92
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...
INDI::PropertySwitch PresetGotoSP
Definition indirotator.h:93
virtual ~Rotator()
uint8_t getRotatorConnection() const
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void setRotatorConnection(const uint8_t &value)
setRotatorConnection Set Rotator connection mode. Child class should call this in the constructor bef...
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:148
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.