Instrument Neutral Distributed Interface INDI  1.9.2
hitecastrodcfocuser.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2016 Andy Kirkham. All rights reserved.
3 
4  HitecAstroDCFocuser 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 "hidapi.h"
24 #include "indifocuser.h"
25 #include "indiusbdevice.h"
26 
28 {
29  public:
30  typedef enum { IDLE, SLEWING } STATE;
31 
33  virtual ~HitecAstroDCFocuser() override;
34 
35  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
36 
37  protected:
38  const char *getDefaultName() override;
39  virtual bool initProperties() override;
40  virtual bool updateProperties() override;
41  virtual bool saveConfigItems(FILE *fp) override;
42 
43  bool Connect() override;
44  bool Disconnect() override;
45 
46  void TimerHit() override;
47 
48  virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
49  virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration) override;
50  virtual bool ReverseFocuser(bool enabled) override
51  {
52  INDI_UNUSED(enabled);
53  return true;
54  }
55 
56  private:
57  hid_device *m_HIDHandle;
58  char m_StopChar;
59  STATE m_State;
60  uint16_t m_Duration;
61 
62  // INumber MaxPositionN[1];
63  // INumberVectorProperty MaxPositionNP;
64 
65  INumber SlewSpeedN[1];
66  INumberVectorProperty SlewSpeedNP;
67 
68  // ISwitch ReverseDirectionS[1];
69  // ISwitchVectorProperty ReverseDirectionSP;
70 };
HitecAstroDCFocuser::~HitecAstroDCFocuser
virtual ~HitecAstroDCFocuser() override
Definition: hitecastrodcfocuser.cpp:41
INDI::USBDevice
Definition: indiusbdevice.h:37
HitecAstroDCFocuser::SLEWING
@ SLEWING
Definition: hitecastrodcfocuser.h:66
HitecAstroDCFocuser::IDLE
@ IDLE
Definition: hitecastrodcfocuser.h:66
IPState
IPState
Property state.
Definition: indiapi.h:158
HitecAstroDCFocuser::HitecAstroDCFocuser
HitecAstroDCFocuser()
Definition: hitecastrodcfocuser.cpp:34
HitecAstroDCFocuser
Definition: hitecastrodcfocuser.h:27
hidapi.h
INumber
One number descriptor.
HitecAstroDCFocuser::TimerHit
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: hitecastrodcfocuser.cpp:148
HitecAstroDCFocuser::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: hitecastrodcfocuser.cpp:92
INDI_UNUSED
#define INDI_UNUSED(x)
Definition: indidevapi.h:799
indifocuser.h
hid_device_
Definition: hid_libusb.c:93
HitecAstroDCFocuser::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition: hitecastrodcfocuser.cpp:198
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
HitecAstroDCFocuser::MoveFocuser
virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration) override
MoveFocuser the focuser in a particular direction with a specific speed for a finite duration.
Definition: hitecastrodcfocuser.cpp:272
HitecAstroDCFocuser::saveConfigItems
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
Definition: hitecastrodcfocuser.cpp:337
INDI::USBDevice::dev
libusb_device * dev
Definition: indiusbdevice.h:40
indiusbdevice.h
HitecAstroDCFocuser::ReverseFocuser
virtual bool ReverseFocuser(bool enabled) override
ReverseFocuser Reverse focuser motion direction.
Definition: hitecastrodcfocuser.h:68
HitecAstroDCFocuser::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: hitecastrodcfocuser.cpp:128
HitecAstroDCFocuser::Disconnect
bool Disconnect() override
Disconnect from device.
Definition: hitecastrodcfocuser.cpp:75
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
HitecAstroDCFocuser::Connect
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: hitecastrodcfocuser.cpp:50
HitecAstroDCFocuser::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: hitecastrodcfocuser.cpp:171
INDI::Focuser
Definition: indifocuser.h:43
HitecAstroDCFocuser::STATE
STATE
Definition: hitecastrodcfocuser.h:48
HitecAstroDCFocuser::getDefaultName
const char * getDefaultName() override
Definition: hitecastrodcfocuser.cpp:87