Instrument Neutral Distributed Interface INDI  1.9.5
rbfocus.h
Go to the documentation of this file.
1 
2 
3 #pragma once
4 
5 #include "indifocuser.h"
6 #include <chrono>
7 
8 class RBFOCUS : public INDI::Focuser
9 {
10  public:
11  RBFOCUS();
12  virtual ~RBFOCUS() override = default;
13  typedef enum {HOLD_OFF, HOLD_ON } focuserHold;
14  typedef enum {REVERSED, NORMAL } dir;
15 
16  const char * getDefaultName() override;
17  virtual bool initProperties() override;
18  virtual bool updateProperties() override;
19  virtual bool ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n) override;
20  protected:
25  virtual bool Handshake() override;
26 
32  virtual IPState MoveAbsFocuser(uint32_t targetTicks) override;
33 
47  virtual bool SyncFocuser(uint32_t ticks) override;
48  virtual bool SetFocuserMaxPosition(uint32_t ticks) override;
49  virtual bool AbortFocuser() override;
50  virtual void TimerHit() override;
51 
52  private:
53  bool Ack();
61  bool sendCommand(const char * cmd, char * res = nullptr);
62 
63  // Read and update Temperature
64  bool readTemperature();
65  // Read and update Position
66  bool readPosition();
67  // Read Version
68  bool readVersion();
69  bool readHold();
70  bool setHold();
71  bool readDir();
72  bool setDir();
73  bool isMoving();
74  bool MaxPos();
75  // Read Only Temperature Reporting
76  INumber TemperatureN[1];
77  INumberVectorProperty TemperatureNP;
78  ISwitch focuserHoldS[2];
79  ISwitchVectorProperty focuserHoldSP;
80  ISwitch dirS[3];
82  double targetPos { 0 }, lastPos { 0 };
83  double lastTemperature { 0 };
84 
85 
86  static const uint32_t DRIVER_RES { 32 };
87 
88  static const char DRIVER_DEL { '#' };
89  static const char DRIVER_DEL2 { ' ' };
90 
91  static const uint8_t DRIVER_TIMEOUT { 10 };
92 
93 
94 };
RBFOCUS::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveAbsFocuser Move to an absolute target position.
Definition: rbfocus.cpp:298
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
IPState
IPState
Property state.
Definition: indiapi.h:158
RBFOCUS::NORMAL
@ NORMAL
Definition: rbfocus.h:14
ISwitch
One switch descriptor.
INumber
One number descriptor.
RBFOCUS::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: rbfocus.cpp:366
RBFOCUS::~RBFOCUS
virtual ~RBFOCUS() override=default
indifocuser.h
RBFOCUS::dir
dir
Definition: rbfocus.h:14
RBFOCUS::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: rbfocus.cpp:56
RBFOCUS::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: rbfocus.cpp:21
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
RBFOCUS::AbortFocuser
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition: rbfocus.cpp:354
RBFOCUS::Handshake
virtual bool Handshake() override
Handshake Try to communicate with Focuser and see if there is a valid response.
Definition: rbfocus.cpp:77
RBFOCUS
Definition: rbfocus.h:8
RBFOCUS::RBFOCUS
RBFOCUS()
Definition: rbfocus.cpp:14
name
const char * name
Definition: indiserver.c:116
RBFOCUS::TimerHit
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: rbfocus.cpp:312
RBFOCUS::getDefaultName
const char * getDefaultName() override
Definition: rbfocus.cpp:94
RBFOCUS::focuserHold
focuserHold
Definition: rbfocus.h:13
ISState
ISState
Switch state.
Definition: indiapi.h:148
RBFOCUS::SyncFocuser
virtual bool SyncFocuser(uint32_t ticks) override
MoveRelFocuser Move focuser for a relative amount of ticks in a specific direction.
Definition: rbfocus.cpp:291
RBFOCUS::HOLD_ON
@ HOLD_ON
Definition: rbfocus.h:13
RBFOCUS::HOLD_OFF
@ HOLD_OFF
Definition: rbfocus.h:13
INDI::Focuser
Definition: indifocuser.h:43
RBFOCUS::REVERSED
@ REVERSED
Definition: rbfocus.h:14
RBFOCUS::SetFocuserMaxPosition
virtual bool SetFocuserMaxPosition(uint32_t ticks) override
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
Definition: rbfocus.cpp:277
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365