Instrument Neutral Distributed Interface INDI 2.2.5
aaf2.h
Go to the documentation of this file.
1/*
2 Arduino ASCOM Focuser 2 (AAF2) INDI Focuser
3
4 Copyright (C) 2019 Jasem Mutlaq ([email protected])
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22#pragma once
23
24#include "indifocuser.h"
25
26class AAF2 : public INDI::Focuser
27{
28 public:
29 AAF2();
30 virtual ~AAF2() override = default;
31
32 const char * getDefaultName() override;
33 virtual bool initProperties() override;
34 virtual bool updateProperties() override;
35
36 protected:
41 virtual bool Handshake() override;
42
48 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
49
56 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
57
63 virtual bool SyncFocuser(uint32_t ticks) override;
64
65 virtual bool AbortFocuser() override;
66 virtual void TimerHit() override;
67
68 private:
69 bool Ack();
77 bool sendCommand(const char * cmd, char * res = nullptr);
78
79 // Read and update Temperature
80 bool readTemperature();
81 // Read and update Position
82 bool readPosition();
83 // Read Version
84 bool readVersion();
85 // Are we moving?
86 bool isMoving();
87
88 // Read Only Temperature Reporting
89 INDI::PropertyNumber TemperatureNP {1};
90
91 double targetPos { 0 }, lastPos { 0 }, lastTemperature { 0 };
92
93 // AAF2 Buffer
94 static const uint8_t DRIVER_RES { 32 };
95 // AAF2 Delimiter
96 static const char DRIVER_DEL { '#' };
97 // AAF2 Timeout
98 static const uint8_t DRIVER_TIMEOUT { 3 };
99};
Definition aaf2.h:27
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition aaf2.cpp:309
virtual ~AAF2() override=default
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveRelFocuser Move focuser for a relative amount of ticks in a specific direction.
Definition aaf2.cpp:245
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set the supplied position as the current focuser position.
Definition aaf2.cpp:222
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition aaf2.cpp:265
AAF2()
Definition aaf2.cpp:35
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
Definition aaf2.cpp:43
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
Definition aaf2.cpp:68
virtual bool Handshake() override
Handshake Try to communicate with Focuser and see if there is a valid response.
Definition aaf2.cpp:86
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveAbsFocuser Move to an absolute target position.
Definition aaf2.cpp:229
const char * getDefaultName() override
Definition aaf2.cpp:101
IPState
Property state.
Definition indiapi.h:158
uint8_t cmd[4]
Definition pwc-ioctl.h:2