Instrument Neutral Distributed Interface INDI  2.0.2
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 #include "hidapi.h"
25 
26 class PerfectStar : public INDI::Focuser
27 {
28  public:
29  // Perfect Star (PS) status
31 
32  PerfectStar();
33  virtual ~PerfectStar() override = default;
34 
35  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
36 
37  const char *getDefaultName() override;
38  virtual bool initProperties() override;
39  virtual bool updateProperties() override;
40  //virtual bool saveConfigItems(FILE *fp) override;
41 
42  virtual bool Connect() override;
43  virtual bool Disconnect() override;
44 
45  virtual void TimerHit() override;
46 
47  virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
48  virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
49  virtual bool AbortFocuser() override;
50  virtual bool SyncFocuser(uint32_t ticks) override;
51 
52  private:
53  bool setPosition(uint32_t ticks);
54  bool getPosition(uint32_t *ticks);
55 
56  bool setStatus(PS_STATUS targetStatus);
57  bool getStatus(PS_STATUS *currentStatus);
58 
59  //bool sync(uint32_t ticks);
60 
61  hid_device *handle { nullptr };
62  PS_STATUS status { PS_NOOP };
63  bool sim { false };
64  uint32_t simPosition { 0 };
65  uint32_t targetPosition { 0 };
66 
67  // Max position in ticks
68  // INumber MaxPositionN[1];
69  // INumberVectorProperty MaxPositionNP;
70 
71  // // Sync to a particular position
72  // INumber SyncN[1];
73  // INumberVectorProperty SyncNP;
74 };
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: perfectstar.cpp:79
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
Process the client newNumber command.
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: perfectstar.cpp:40
virtual bool Disconnect() override
Disconnect from device.
Definition: perfectstar.cpp:63
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
const char * getDefaultName() override
Definition: perfectstar.cpp:74
IPState
Property state.
Definition: indiapi.h:160