Instrument Neutral Distributed Interface INDI  2.0.2
roll_off.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2014 Jasem Mutlaq. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7  .
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12  .
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 *******************************************************************************/
18 
19 #pragma once
20 
21 #include "indidome.h"
22 
23 class RollOff : public INDI::Dome
24 {
25  public:
26  RollOff();
27  virtual ~RollOff() = default;
28 
29  virtual bool initProperties() override;
30  const char *getDefaultName() override;
31  bool updateProperties() override;
32  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
33  virtual bool saveConfigItems(FILE *fp) override;
34  virtual bool ISSnoopDevice(XMLEle *root) override;
35 
36  protected:
37  bool Connect() override;
38  bool Disconnect() override;
39 
40  void TimerHit() override;
41 
42  virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override;
43  virtual IPState Park() override;
44  virtual IPState UnPark() override;
45  virtual bool Abort() override;
46 
47  virtual bool getFullOpenedLimitSwitch();
48  virtual bool getFullClosedLimitSwitch();
49 
50  private:
51  bool SetupParms();
52  float CalcTimeLeft(timeval);
53 
54  ISState fullOpenLimitSwitch { ISS_ON };
55  ISState fullClosedLimitSwitch { ISS_OFF };
56  double MotionRequest { 0 };
57  struct timeval MotionStart
58  {
59  0, 0
60  };
61 };
Class to provide general functionality of a Dome device.
Definition: indidome.h:75
DomeMotionCommand
Definition: indidome.h:97
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: roll_off.cpp:100
RollOff()
Definition: roll_off.cpp:34
virtual bool getFullOpenedLimitSwitch()
Definition: roll_off.cpp:259
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: roll_off.cpp:84
virtual ~RollOff()=default
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override
Move the Dome in a particular direction.
Definition: roll_off.cpp:165
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
Definition: roll_off.cpp:160
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: roll_off.cpp:53
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: roll_off.cpp:42
bool Disconnect() override
Disconnect from device.
Definition: roll_off.cpp:90
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
Definition: roll_off.cpp:215
virtual bool Abort() override
Abort all dome motion.
Definition: roll_off.cpp:227
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
Definition: roll_off.cpp:203
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: roll_off.cpp:117
const char * getDefaultName() override
Definition: roll_off.cpp:95
virtual bool getFullClosedLimitSwitch()
Definition: roll_off.cpp:272
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: roll_off.cpp:105
ISState
Switch state.
Definition: indiapi.h:150
@ ISS_OFF
Definition: indiapi.h:151
@ ISS_ON
Definition: indiapi.h:152
IPState
Property state.
Definition: indiapi.h:160