Instrument Neutral Distributed Interface INDI 2.2.5
pegasus_flatmaster_wifi.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2026 Jasem Mutlaq. All rights reserved.
3
4 Pegasus FlatMaster WiFi
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20
21 The full GNU General Public License is included in this distribution in the
22 file called LICENSE.
23*******************************************************************************/
24#pragma once
25
27#include "defaultdevice.h"
28
29
31{
32 public:
34 virtual ~PegasusFlatMasterWifi() override = default;
35
36 const char *getDefaultName() override;
37 void ISGetProperties(const char *dev) override;
38 virtual bool initProperties() override;
39 virtual bool updateProperties() override;
40
41 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
42 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
43 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
44 virtual bool ISSnoopDevice(XMLEle *root) override;
45
46 protected:
47 virtual bool SetLightBoxBrightness(uint16_t value) override;
48 virtual bool EnableLightBox(bool enable) override;
49 virtual bool saveConfigItems(FILE *fp) override;
50 virtual void TimerHit() override;
51
52 private:
53 bool Ack();
54 bool getStatusData();
55 bool sendCommand(const char *cmd, char *response);
56 void updateFirmwareVersion();
57
58 int PortFD { -1 };
59
60 // Firmware version
61 INDI::PropertyText FirmwareTP {1};
62
63 // Uptime (read-only)
64 INDI::PropertyNumber UptimeNP {1};
65
66 // Reboot button
67 INDI::PropertySwitch RebootSP {1};
68
69 Connection::Serial *serialConnection { nullptr };
70
71 // FA response field indices: FA:<brightness>:<power>
72 enum
73 {
74 FA_PREFIX = 0,
75 FA_BRIGHTNESS,
76 FA_POWER,
77 FA_N,
78 };
79};
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
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 SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be implemented in the child class, if supported.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be implemented in the child class.
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 ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual ~PegasusFlatMasterWifi() override=default
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
ISState
Switch state.
Definition indiapi.h:148
*brief user defined string literal for JSON values *sa std::size_t n
struct xml_ele_ XMLEle
Definition lilxml.h:81
uint8_t cmd[4]
Definition pwc-ioctl.h:2