Instrument Neutral Distributed Interface INDI  2.0.2
onfocus.h
Go to the documentation of this file.
1 /*
2  OnFocus Focuser
3  Copyright (C) 2018 Paul de Backer (74.0632@gmail.com)
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 #ifndef ONFOCUS_H
21 #define ONFOCUS_H
22 
23 #include "indifocuser.h"
24 
25 class OnFocus : public INDI::Focuser
26 {
27  public:
28  OnFocus();
29  ~OnFocus();
30 
31  virtual bool Handshake() override;
32  const char * getDefaultName() override;
33  virtual bool initProperties() override;
34  virtual bool updateProperties() override;
35  virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) override;
36  virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) override;
37  virtual IPState MoveAbsFocuser(uint32_t ticks) override;
38  virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
39  virtual bool AbortFocuser() override;
40  virtual void TimerHit() override;
41 
42  private:
43 
44  double targetPos, lastPos;
45 
46  void GetFocusParams();
47  void setZero();
48  bool updateMaxPos();
49  bool updateTemperature();
50  bool updatePosition();
51  bool isMoving();
52  bool Ack();
53 
54  bool MoveMyFocuser(uint32_t position);
55  bool setMaxPos(uint32_t maxPos);
56 
57  INumber MaxPosN[1];
58  INumberVectorProperty MaxPosNP;
59  ISwitch SetZeroS[1];
60  ISwitchVectorProperty SetZeroSP;
61 };
62 
63 #endif // ONFOCUS_H
OnFocus()
Definition: onfocus.cpp:38
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: onfocus.cpp:77
virtual IPState MoveAbsFocuser(uint32_t ticks) override
MoveFocuser the focuser to an absolute position.
Definition: onfocus.cpp:373
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition: onfocus.cpp:445
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: onfocus.cpp:48
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: onfocus.cpp:342
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition: onfocus.cpp:389
~OnFocus()
Definition: onfocus.cpp:44
virtual bool Handshake() override
perform handshake with device to check communication
Definition: onfocus.cpp:99
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: onfocus.cpp:324
const char * getDefaultName() override
Definition: onfocus.cpp:109
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: onfocus.cpp:410
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367