Instrument Neutral Distributed Interface INDI  2.0.2
dome_script.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2016 CloudMakers, s. r. o.. 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 DomeScript : public INDI::Dome
24 {
25  public:
26  DomeScript();
27  virtual ~DomeScript() = default;
28 
29  virtual const char *getDefaultName() override;
30  virtual bool initProperties() override;
31  virtual bool saveConfigItems(FILE *fp) override;
32 
33  void ISGetProperties(const char *dev) override;
34  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
35  bool updateProperties() override;
36 
37  protected:
38  void TimerHit() override;
39  virtual bool Connect() override;
40  virtual bool Disconnect() override;
41  virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override;
42  virtual IPState MoveAbs(double az) override;
43  virtual IPState Park() override;
44  virtual IPState UnPark() override;
45  virtual IPState ControlShutter(ShutterOperation operation) override;
46  virtual bool Abort() override;
47 
48  private:
49  bool ReadDomeStatus();
50  bool RunScript(int script, ...);
51 
52  ITextVectorProperty ScriptsTP;
53  IText ScriptsT[15] {};
54  double TargetAz { 0 };
55  int TimeSinceUpdate { 0 };
56 };
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual const char * getDefaultName() override
Definition: dome_script.cpp:56
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
virtual bool Abort() override
Abort all dome motion.
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override
Move the Dome in a particular direction.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: dome_script.cpp:61
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
Definition: dome_script.cpp:88
virtual ~DomeScript()=default
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: dome_script.cpp:95
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close shutter.
virtual bool Disconnect() override
Disconnect from device.
Class to provide general functionality of a Dome device.
Definition: indidome.h:75
ShutterOperation
Shutter operation command.
Definition: indidome.h:114
DomeMotionCommand
Definition: indidome.h:97
IPState
Property state.
Definition: indiapi.h:160
One text descriptor.
Text vector property descriptor.
Definition: indiapi.h:246