Instrument Neutral Distributed Interface INDI  1.9.5
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 "indibase/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::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: onfocus.cpp:48
IPState
IPState
Property state.
Definition: indiapi.h:158
ISwitch
One switch descriptor.
INumber
One number descriptor.
OnFocus::~OnFocus
~OnFocus()
Definition: onfocus.cpp:44
OnFocus::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: onfocus.cpp:323
OnFocus::getDefaultName
const char * getDefaultName() override
Definition: onfocus.cpp:108
indifocuser.h
OnFocus
Definition: onfocus.h:25
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
OnFocus::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
Definition: onfocus.cpp:387
OnFocus::OnFocus
OnFocus()
Definition: onfocus.cpp:38
OnFocus::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: onfocus.cpp:341
OnFocus::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t ticks) override
MoveFocuser the focuser to an absolute position.
Definition: onfocus.cpp:371
OnFocus::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: onfocus.cpp:76
name
const char * name
Definition: indiserver.c:116
OnFocus::Handshake
virtual bool Handshake() override
perform handshake with device to check communication
Definition: onfocus.cpp:98
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
ISState
ISState
Switch state.
Definition: indiapi.h:148
OnFocus::TimerHit
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: onfocus.cpp:408
INDI::Focuser
Definition: indifocuser.h:43
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365
OnFocus::AbortFocuser
virtual bool AbortFocuser() override
AbortFocuser all focus motion.
Definition: onfocus.cpp:443