Instrument Neutral Distributed Interface INDI 2.2.5
indifocuser.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2013 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
24namespace Connection
25{
26class Serial;
27class TCP;
28}
40namespace INDI
41{
42
44{
45 public:
50 Focuser();
55 virtual ~Focuser();
56
60 enum
61 {
62 CONNECTION_NONE = 1 << 0,
64 CONNECTION_TCP = 1 << 2
66
73 virtual bool initProperties() override;
80 virtual void ISGetProperties(const char *dev) override;
87 virtual bool updateProperties() override;
99 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
111 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
123 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
131 virtual bool ISSnoopDevice(XMLEle *root) override;
132
138 void setSupportedConnections(const uint8_t &value);
139
145 {
146 return focuserConnection;
147 }
148
156 static void buttonHelper(const char *button_n, ISState state, void *context);
157
158 protected:
164 virtual bool saveConfigItems(FILE *fp) override;
165
173 virtual bool Handshake();
174
180 virtual bool SetFocuserMaxPosition(uint32_t ticks) override;
181
187 virtual void SyncPresets(uint32_t ticks);
188
198 void processButton(const char *button_n, ISState state);
199
201
204
205 int PortFD = -1;
206
207 private:
208 bool callHandshake();
209 uint8_t focuserConnection = CONNECTION_SERIAL | CONNECTION_TCP;
210};
211}
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...
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...
Provides interface to implement focuser functionality.
virtual bool ISSnoopDevice(XMLEle *root) override
Processes properties snooped from other devices. Delegates processing to the controller and the base ...
void processButton(const char *button_n, ISState state)
Processes button press events received from the controller via buttonHelper. Handles actions like "Fo...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
enum INDI::Focuser::@447 FocuserConnection
virtual bool saveConfigItems(FILE *fp) override
Focuser()
Construct a new Focuser object. Initializes the controller and sets up the FocuserInterface.
virtual void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Connection::TCP * tcpConnection
virtual ~Focuser()
Destroy the Focuser object. Cleans up the controller resource.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
INDI::PropertySwitch PresetGotoSP
virtual void SyncPresets(uint32_t ticks)
Synchronizes the range (min, max, step) of the preset number properties (PresetNP) based on the focus...
Connection::Serial * serialConnection
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Processes incoming new text values from the client for this device. Delegates processing to the contr...
Controller * controller
static void buttonHelper(const char *button_n, ISState state, void *context)
Static callback function used by the Controller class. Forwards button press events to the appropriat...
INDI::PropertyNumber PresetNP
uint8_t getSupportedConnections() const
Get the currently configured supported connection modes.
void setSupportedConnections(const uint8_t &value)
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
virtual bool Handshake()
Performs a device-specific handshake after a connection is established. This method should be overrid...
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.