Instrument Neutral Distributed Interface INDI 2.2.5
perfectstar.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3
4 PerfectStar Focuser
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
9 .
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14 .
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*******************************************************************************/
20
21#pragma once
22
23#include "indifocuser.h"
24
25#ifdef _USE_SYSTEM_HIDAPILIB
26#include <hidapi/hidapi.h>
27#else
28#include <indi_hidapi.h>
29#endif
30
32{
33 public:
34 // Perfect Star (PS) status
36
38 virtual ~PerfectStar() override = default;
39
40 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
41
42 const char *getDefaultName() override;
43 virtual bool initProperties() override;
44 virtual bool updateProperties() override;
45 //virtual bool saveConfigItems(FILE *fp) override;
46
47 virtual bool Connect() override;
48 virtual bool Disconnect() override;
49
50 virtual void TimerHit() override;
51
52 virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
53 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
54 virtual bool AbortFocuser() override;
55 virtual bool SyncFocuser(uint32_t ticks) override;
56
57 private:
58 bool setPosition(uint32_t ticks);
59 bool getPosition(uint32_t *ticks);
60
61 bool setStatus(PS_STATUS targetStatus);
62 bool getStatus(PS_STATUS *currentStatus);
63
64 //bool sync(uint32_t ticks);
65
66 hid_device *handle { nullptr };
67 PS_STATUS status { PS_NOOP };
68 bool sim { false };
69 uint32_t simPosition { 0 };
70 uint32_t targetPosition { 0 };
71
72 // Max position in ticks
73 // INumber MaxPositionN[1];
74 // INumberVectorProperty MaxPositionNP;
75
76 // // Sync to a particular position
77 // INumber SyncN[1];
78 // INumberVectorProperty SyncNP;
79};
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
virtual ~PerfectStar() override=default
virtual bool SyncFocuser(uint32_t ticks) override
SyncFocuser Set current position to ticks without moving the focuser.
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
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...
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool Disconnect() override
Disconnect from device.
virtual bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
const char * getDefaultName() override
IPState
Property state.
Definition indiapi.h:158