Instrument Neutral Distributed Interface INDI  2.0.0
indifilterwheel.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2010, 2011 Gerry Rozema. 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 "indifilterinterface.h"
23 
33 namespace INDI
34 {
35 
37 {
38  protected:
39  FilterWheel();
40  virtual ~FilterWheel() = default;
41 
42  public:
47  enum
48  {
49  CONNECTION_NONE = 1 << 0,
50  CONNECTION_SERIAL = 1 << 1,
51  CONNECTION_TCP = 1 << 2
53 
54  virtual bool initProperties() override;
55  virtual bool updateProperties() override;
56  virtual void ISGetProperties(const char *dev) override;
57  virtual bool ISSnoopDevice(XMLEle *root) override;
58  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
59  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
60  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
61 
62  static void joystickHelper(const char *joystick_n, double mag, double angle, void *context);
63  static void buttonHelper(const char *button_n, ISState state, void *context);
64 
70  void setFilterConnection(const uint8_t &value);
71 
75  uint8_t getFilterConnection() const;
76 
77  protected:
78  virtual bool saveConfigItems(FILE *fp) override;
79  virtual int QueryFilter() override;
80  virtual bool SelectFilter(int) override;
81 
83  virtual bool Handshake();
84 
85  void processJoystick(const char *joystick_n, double mag, double angle);
86  void processButton(const char *button_n, ISState state);
87 
89 
92 
94  int PortFD = -1;
95 
96  private:
97  bool callHandshake();
98  uint8_t filterConnection = CONNECTION_NONE;
99 };
100 }
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
The Controller class provides functionality to access a controller (e.g. joystick) input and send it ...
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
static void buttonHelper(const char *button_n, ISState state, void *context)
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...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Controller * controller
void processJoystick(const char *joystick_n, double mag, double angle)
virtual bool Handshake()
perform handshake with device to check communication
uint8_t getFilterConnection() const
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Connection::TCP * tcpConnection
virtual int QueryFilter() override
Return current filter position.
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Connection::Serial * serialConnection
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual ~FilterWheel()=default
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
void processButton(const char *button_n, ISState state)
void setFilterConnection(const uint8_t &value)
setFilterConnection Set Filter connection mode. Child class should call this in the constructor befor...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
static void joystickHelper(const char *joystick_n, double mag, double angle, void *context)
virtual bool SelectFilter(int) override
Select a new filter position.
int PortFD
For Serial & TCP connections.
enum INDI::FilterWheel::@220 FilterConnection
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
ISState
Switch state.
Definition: indiapi.h:150
Namespace to encapsulate INDI client, drivers, and mediator classes.