Instrument Neutral Distributed Interface INDI 2.2.5
wanderer_eclipse.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2024 Frank Wang/Jérémie Klein. All rights reserved.
3
4 WandererCover V4-EC
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
25#pragma once
26
27#include "defaultdevice.h"
29#include <mutex>
30
31namespace Connection
32{
33class Serial;
34}
35
37{
38public:
40 virtual ~WandererEclipse() = default;
41
42 virtual bool initProperties() override;
43
44 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
45 virtual bool updateProperties() override;
46
47
48protected:
49
50 // From Dust Cap
51 virtual IPState ParkCap() override;
52 virtual IPState UnParkCap() override;
53
54
55
56 const char *getDefaultName() override;
57 virtual void TimerHit() override;
58
59
60private:
61
62 int firmware=0;
63 bool toggleCover(bool open);
64 bool sendCommand(std::string command);
65 //Current Calibrate
66 bool getData();
67 bool parseDeviceData(const char *data);
68
69 double voltageread=0;
70
71 int torqueLevel = -1;
72
73 void updateData(double torqueread,double voltageread);
74
75 INDI::PropertyNumber DataNP{4};
76 enum
77 {
78 torque_read,
79 voltage_read,
80 };
81
82
83 // Torque property (0: low, 1: medium, 2: high)
84 INDI::PropertySwitch TorqueSP{3};
85 enum
86 {
87 TORQUE_LOW,
88 TORQUE_MEDIUM,
89 TORQUE_HIGH,
90 };
91
92 // Firmware information
93 INDI::PropertyText FirmwareTP{1};
94 enum
95 {
96 FIRMWARE_VERSION,
97 };
98
99 int PortFD{ -1 };
100
101 Connection::Serial *serialConnection{ nullptr };
102
103 // Mutex for thread safety
104 std::timed_mutex serialPortMutex;
105};
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 initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual IPState UnParkCap() override
unPark dust cap (open cover). Must be implemented by child.
const char * getDefaultName() override
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual IPState ParkCap() override
Park dust cap (close cover). Must be implemented by child.
virtual ~WandererEclipse()=default
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition arduino_st4.h:34