Instrument Neutral Distributed Interface INDI 2.2.5
astromech_focuser.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2019 Christian Liska. All rights reserved.
3
4 Implementation based on Lacerta MFOC driver
5 (written 2018 by Franck Le Rhun and Christian Liska).
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation.
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 Library General Public License for 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
22#pragma once
23
24#include "indifocuser.h"
25
27{
28 public:
30 bool initProperties() override;
31 bool updateProperties() override;
32 const char *getDefaultName() override;
33 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
34
35 protected:
36 virtual bool Disconnect() override;
37 virtual bool Handshake() override;
38 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
39 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
40
41 private:
42 virtual uint32_t GetAbsFocuserPosition();
43 virtual bool SetApperture(uint32_t index);
44
45 INDI::PropertyNumber AppertureNP {1};
46
47 bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
48 void hexDump(char * buf, const char * data, int size);
49 std::vector<std::string> split(const std::string &input, const std::string &regex);
50
51 // # is the stop char
52 static const char DRIVER_STOP_CHAR { 0x23 };
53 // Wait up to a maximum of 3 seconds for serial input
54 static constexpr const uint8_t DRIVER_TIMEOUT {3};
55 // Maximum buffer for sending/receving.
56 static constexpr const uint8_t DRIVER_LEN {64};
57};
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
const char * getDefaultName() override
bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool Disconnect() override
Disconnect from device.
virtual bool Handshake() override
Performs a device-specific handshake after a connection is established. This method should be overrid...
IPState
Property state.
Definition indiapi.h:158
uint8_t cmd[4]
Definition pwc-ioctl.h:2