Instrument Neutral Distributed Interface INDI 2.2.5
dome_script.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2023 Jasem Mutlaq
3 Copyright(c) 2016 CloudMakers, s. r. o.. All rights reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
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 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 *******************************************************************************/
19
20#pragma once
21
22#include "indidome.h"
23#include "indipropertyswitch.h"
24#include "indipropertytext.h"
25
26class DomeScript : public INDI::Dome
27{
28 public:
29 DomeScript();
30 virtual ~DomeScript() = default;
31
32 virtual const char *getDefaultName() override;
33 virtual bool initProperties() override;
34 virtual bool saveConfigItems(FILE *fp) override;
35
36 void ISGetProperties(const char *dev) override;
37 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
38 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
39
40 bool updateProperties() override;
41
42 protected:
43 void TimerHit() override;
44 virtual bool Connect() override;
45 virtual bool Disconnect() override;
46 virtual IPState Move(DomeDirection dir, DomeMotionCommand operation) override;
47 virtual IPState MoveAbs(double az) override;
48 virtual IPState Park() override;
49 virtual IPState UnPark() override;
50 virtual IPState ControlShutter(ShutterOperation operation) override;
51 virtual bool Abort() override;
52
53 private:
54 bool ReadDomeStatus();
55 bool RunScript(int script, ...);
56
57 INDI::PropertyText ScriptsTP {15};
58
59 INDI::PropertySwitch TypeSP {2};
60 enum
61 {
62 Dome,
63 Rolloff
64 };
65
66 double TargetAz { 0 };
67 int TimeSinceUpdate { 0 };
68};
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual const char * getDefaultName() override
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.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, 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
Initialize properties initial state and value. The child class must implement this function.
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
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...
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.
Definition dome.h:33
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
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158