Instrument Neutral Distributed Interface INDI 2.2.5
io/ipx800v4.h
Go to the documentation of this file.
1/*
2 IPX800 Controller
3 Copyright (C) 2025 Jasem Mutlaq
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#pragma once
21
22#include "defaultdevice.h"
23#include "indiinputinterface.h"
24#include "indioutputinterface.h"
25
26namespace Connection
27{
28class TCP;
29}
30
32{
33 public:
35 virtual ~IPX800() = default;
36
37 virtual bool initProperties() override;
38 virtual bool updateProperties() override;
39 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
40 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
41 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
42 virtual bool saveConfigItems(FILE *fp) override;
43 virtual void ISGetProperties(const char *dev) override;
44
45 protected:
46 const char *getDefaultName() override;
47 void TimerHit() override;
48 bool Handshake();
49
50 // Output Interface
51 virtual bool UpdateDigitalOutputs() override;
52 virtual bool CommandOutput(uint32_t index, OutputState command) override;
53
54 private:
55 bool sendCommand(const char *cmd, char *response);
56 bool UpdateDigitalInputs() override;
57 bool UpdateAnalogInputs() override;
58
59
60 Connection::TCP *tcpConnection { nullptr };
61 int PortFD { -1 };
62
63 INDI::PropertyText ModelVersionTP {1};
64 INDI::PropertyText APIKeyTP {1}; // API key for JSON requests
65
66 static constexpr const uint8_t DIGITAL_INPUTS {8};
67 static constexpr const uint8_t DIGITAL_OUTPUTS {8};
68 static constexpr const uint8_t ANALOG_INPUTS {4};
69};
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...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
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 ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool CommandOutput(uint32_t index, OutputState command) override
Send command to output.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual ~IPX800()=default
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool Handshake()
const char * getDefaultName() override
virtual bool UpdateDigitalOutputs() override
Update all digital outputs.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
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
uint8_t cmd[4]
Definition pwc-ioctl.h:2