Instrument Neutral Distributed Interface INDI  2.0.2
pegasus_flatmaster.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2021 Chrysikos Efstathios. All rights reserved.
3 
4  Pegasus FlatMaster
5 
6  2022-06-07 Jasem Mutlaq: Use lightbox interface properly.
7 
8  This program is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by the Free
10  Software Foundation; either version 2 of the License, or (at your option)
11  any later version.
12 
13  This program is distributed in the hope that it will be useful, but WITHOUT
14  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 
23  The full GNU General Public License is included in this distribution in the
24  file called LICENSE.
25 *******************************************************************************/
26 #pragma once
27 
28 #include "indilightboxinterface.h"
29 #include "defaultdevice.h"
30 
31 
33 {
34  public:
36  virtual ~PegasusFlatMaster() override = default;
37 
38  const char *getDefaultName() override;
39  void ISGetProperties(const char *dev) override;
40  virtual bool initProperties() override;
41  virtual bool updateProperties() override;
42 
43  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
44  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
45  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
46  virtual bool ISSnoopDevice(XMLEle *root) 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 
53 
54  private:
55  bool Ack();
56  int PortFD{ -1 };
57  bool sendCommand(const char* cmd, char* response);
58  void updateFirmwareVersion();
59 
60  // Firmware version
61  ITextVectorProperty FirmwareTP;
62  IText FirmwareT[1] {};
63 
64  Connection::Serial *serialConnection{ nullptr };
65 };
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be impelemented in the child class, if supported.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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 ~PegasusFlatMaster() override=default
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 impelemented in the child class.
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 ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
ISState
Switch state.
Definition: indiapi.h:150
__u8 cmd[4]
Definition: pwc-ioctl.h:2
One text descriptor.
Text vector property descriptor.
Definition: indiapi.h:246