Instrument Neutral Distributed Interface INDI 2.2.5
Excalibur.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2022 RBFocus. All rights reserved.
3 Copyright(c) 2025 Jasem Mutlaq. All rights reserved.
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2 of the License, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19
20 The full GNU General Public License is included in this distribution in the
21 file called LICENSE.
22*******************************************************************************/
23
24#pragma once
25
27#include "defaultdevice.h"
29
31{
32 public:
33 Excalibur();
34 virtual ~Excalibur() override = default;
35
36 const char *getDefaultName() override;
37 virtual bool initProperties() override;
38 virtual bool updateProperties() override;
39
40 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
41 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
42 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
43 virtual bool ISSnoopDevice(XMLEle *root) override;
44 virtual void TimerHit() override;
45
46 virtual bool Disconnect() override;
47
48 protected:
49 virtual bool SetLightBoxBrightness(uint16_t value) override;
50 virtual bool EnableLightBox(bool enable) override;
51 virtual bool saveConfigItems(FILE *fp) override;
52 virtual IPState ParkCap() override;
53 virtual IPState UnParkCap() override;
54
55
56 private:
57 bool Ack();
58 int PortFD{ -1 };
59 bool sendCommand(const char * cmd, char * res = nullptr);
60 void getParkingStatus();
61 void getLightIntensity();
62
63 static const uint32_t DRIVER_RES { 32 };
64 static const char DRIVER_DEL { '#' };
65 static const char DRIVER_DEL2 { ' ' };
66 static const uint8_t DRIVER_TIMEOUT { 10 };
67
68 Connection::Serial *serialConnection{ nullptr };
69};
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition Excalibur.cpp:84
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be implemented in the child class.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
Definition Excalibur.cpp:54
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual ~Excalibur() override=default
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool Disconnect() override
Disconnect from device.
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be implemented in the child class, if supported.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
const char * getDefaultName() override
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
uint8_t cmd[4]
Definition pwc-ioctl.h:2