Instrument Neutral Distributed Interface INDI  2.0.2
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the Free
6  Software Foundation; either version 2 of the License, or (at your option)
7  any later version.
9  This program is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  more details.
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
19  The full GNU General Public License is included in this distribution in the
20  file called LICENSE.
21 *******************************************************************************/
23 #pragma once
25 #include "defaultdevice.h"
26 #include "indilightboxinterface.h"
27 #include "indidustcapinterface.h"
29 #include <stdint.h>
31 namespace Connection
32 {
33 class Serial;
34 }
37 {
38  public:
39  DeepSkyDadFP1();
40  virtual ~DeepSkyDadFP1() = default;
44  virtual bool initProperties() override;
45  virtual void ISGetProperties(const char *dev) override;
46  virtual bool updateProperties() override;
48  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
49  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
50  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
51  virtual bool ISSnoopDevice(XMLEle *root) override;
53  protected:
54  const char *getDefaultName() override;
56  virtual bool saveConfigItems(FILE *fp) override;
57  void TimerHit() override;
59  // From Dust Cap
60  virtual IPState ParkCap() override;
61  virtual IPState UnParkCap() override;
63  // From Light Box
64  virtual bool SetLightBoxBrightness(uint16_t value) override;
65  virtual bool EnableLightBox(bool enable) override;
67  private:
68  bool sendCommand(const char *command, char *response);
69  bool getStartupData();
70  bool ping();
71  bool getStatus();
72  bool getFirmwareVersion();
73  bool getBrightness();
75  bool Handshake();
77  // Status
78  ITextVectorProperty StatusTP;
79  IText StatusT[4] {};
81  // Firmware version
82  ITextVectorProperty FirmwareTP;
83  IText FirmwareT[1] {};
85  int PortFD{ -1 };
87  uint8_t prevCoverStatus{ 255 };
88  uint8_t prevLightStatus{ 255 };
89  uint8_t prevMotorStatus{ 255 };
90  int32_t prevBrightness{ 9999 };
91  uint8_t prevHeaterConnected { 255 };
92  uint8_t prevHeaterMode { 255 };
94  Connection::Serial *serialConnection{ nullptr };
96  // Heater mode
97  ISwitch HeaterModeS[3];
98  ISwitchVectorProperty HeaterModeSP;
99 };
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
virtual bool SetLightBoxBrightness(uint16_t value) override
setBrightness Set light level. Must be impelemented in the child class, if supported.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
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 saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual ~DeepSkyDadFP1()=default
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool EnableLightBox(bool enable) override
EnableLightBox Turn on/off on a light box. Must be impelemented in the child class.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
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 IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
const char * getDefaultName() override
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Switch state.
Definition: indiapi.h:150
Property state.
Definition: indiapi.h:160
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition: arduino_st4.h:34
One switch descriptor.
One text descriptor.
Switch vector property descriptor.
Definition: indiapi.h:367
Text vector property descriptor.
Definition: indiapi.h:246