Instrument Neutral Distributed Interface INDI 2.2.5
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
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 virtual IPState AbortCap() override;
44
45 virtual void TimerHit() override;
46 virtual bool saveConfigItems(FILE *fp) override;
47
48 private:
49 INDI::PropertySwitch CalibrateToggleSP {2};
50
51 // Position
52 INDI::PropertyNumber PositionNP {1};
53
54 INDI::PropertySwitch MotionSpeedSP {2};
55 enum
56 {
57 Slow,
58 Fast
59 };
60
61 INDI::PropertySwitch MotionCommandSP {3};
62 enum
63 {
64 Open,
65 Close,
66 Stop
67 };
68
69 typedef enum
70 {
71 Idle,
72 findClosePosition,
73 findOpenPosition,
74 } CalibrationStatus;
75
76 CalibrationStatus m_CalibrationStatus {Idle};
77
78 Connection::Serial *serialConnection{ nullptr };
79 int PortFD{ -1 };
80 std::unique_ptr<PrimalucaLabs::ALTO> m_ALTO;
81 uint8_t m_TargetPosition {0};
82};
Definition alto.h:24
bool Handshake()
Definition alto.cpp:122
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:79
ALTO()
Definition alto.cpp:25
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
Definition alto.cpp:260
const char * getDefaultName() override
Definition alto.cpp:141
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition alto.cpp:309
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition alto.cpp:149
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition alto.cpp:176
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition alto.cpp:300
virtual IPState AbortCap() override
Abort motion. Must be implemented by child.
Definition alto.cpp:292
virtual bool initProperties() override
Initialize 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:276
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:148
IPState
Property state.
Definition indiapi.h:158