Instrument Neutral Distributed Interface INDI  2.0.2
alto.h
Go to the documentation of this file.
1 /*
2  ALTO driver
3  Copyright (C) 2023 Jasem Mutlaq
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Lesser General Public License for more details.
12  You should have received a copy of the GNU Lesser General Public
13  License along with this library; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16 
17 #pragma once
18 
19 #include "indidustcapinterface.h"
20 #include "defaultdevice.h"
21 #include "../focuser/primalucacommandset.h"
22 
24 {
25  public:
26  ALTO();
27  virtual ~ALTO() override = default;
28 
29  const char *getDefaultName() override;
30  virtual bool initProperties() override;
31  virtual bool updateProperties() override;
32 
33  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
34  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
35 
36  protected:
37  bool Handshake();
38 
39 
40  // From Dust Cap
41  virtual IPState ParkCap() override;
42  virtual IPState UnParkCap() override;
43 
44  virtual void TimerHit() override;
45  virtual bool saveConfigItems(FILE *fp) override;
46 
47  private:
48  INDI::PropertySwitch CalibrateToggleSP {2};
49 
50  INDI::PropertySwitch MotionSpeedSP {2};
51  enum
52  {
53  Slow,
54  Fast
55  };
56 
57  INDI::PropertySwitch MotionCommandSP {3};
58  enum
59  {
60  Open,
61  Close,
62  Stop
63  };
64 
65  typedef enum
66  {
67  Idle,
68  findClosePosition,
69  findOpenPosition,
70  } CalibrationStatus;
71 
72  CalibrationStatus m_CalibrationStatus {Idle};
73 
74  Connection::Serial *serialConnection{ nullptr };
75  int PortFD{ -1 };
76  std::unique_ptr<PrimalucaLabs::ALTO> m_ALTO;
77 };
Definition: alto.h:24
bool Handshake()
Definition: alto.cpp:100
virtual ~ALTO() override=default
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: alto.cpp:75
ALTO()
Definition: alto.cpp:25
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
Definition: alto.cpp:220
const char * getDefaultName() override
Definition: alto.cpp:119
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: alto.cpp:245
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: alto.cpp:127
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: alto.cpp:135
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: alto.cpp:236
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: alto.cpp:33
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
Definition: alto.cpp:228
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...
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160