Instrument Neutral Distributed Interface INDI  2.0.2
baader_dome.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2014 Jasem Mutlaq. All rights reserved.
3 
4  Baader Planetarium Dome INDI Driver
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9  .
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14  .
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 *******************************************************************************/
20 
21 #pragma once
22 
23 #include "indidome.h"
24 
25 class BaaderDome : public INDI::Dome
26 {
27  public:
29  typedef enum
30  {
37  typedef enum { FLAP_OPEN, FLAP_CLOSE } FlapOperation;
39 
40  BaaderDome();
41  virtual ~BaaderDome() = default;
42 
43  virtual const char *getDefaultName() override;
44  virtual bool initProperties() override;
45  virtual bool updateProperties() override;
46  virtual bool saveConfigItems(FILE *fp) override;
47 
48  virtual bool Handshake() override;
49 
50  virtual void TimerHit() override;
51 
52  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
53 
54  virtual IPState MoveRel(double azDiff) override;
55  virtual IPState MoveAbs(double az) override;
56  virtual IPState ControlShutter(ShutterOperation operation) override;
57  virtual bool Abort() override;
58 
59  // Parking
60  virtual IPState Park() override;
61  virtual IPState UnPark() override;
62  virtual bool SetCurrentPark() override;
63  virtual bool SetDefaultPark() override;
64 
65  protected:
66  // Commands
67  bool Ack();
68  bool UpdatePosition();
69  bool UpdateShutterStatus();
70  int ControlDomeFlap(FlapOperation operation);
71  bool UpdateFlapStatus();
72  bool SaveEncoderPosition();
74 
75  // Misc
76  unsigned short MountAzToDomeAz(double mountAz);
77  double DomeAzToMountAz(unsigned short domeAz);
78  bool SetupParms();
79 
82 
85 
89  double targetAz { 0 };
90  double calibrationStart { 0 };
91  double calibrationTarget1 { 0 };
92  double calibrationTarget2 { 0 };
95  bool sim { false };
96  double simShutterTimer { 0 };
97  double simFlapTimer { 0 };
100 };
FlapStatus simFlapStatus
Definition: baader_dome.h:99
int ControlDomeFlap(FlapOperation operation)
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
bool UpdateShutterStatus()
bool SaveEncoderPosition()
CalibrationStage calibrationStage
Definition: baader_dome.h:88
FlapOperation targetFlap
Definition: baader_dome.h:94
unsigned short MountAzToDomeAz(double mountAz)
ISwitch CalibrateS[1]
Definition: baader_dome.h:80
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
const char * GetFlapStatusString(FlapStatus status)
double simFlapTimer
Definition: baader_dome.h:97
double calibrationTarget1
Definition: baader_dome.h:91
ISwitchVectorProperty DomeFlapSP
Definition: baader_dome.h:84
double calibrationTarget2
Definition: baader_dome.h:92
virtual const char * getDefaultName() override
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close shutter.
FlapStatus flapStatus
Definition: baader_dome.h:87
ShutterState simShutterStatus
Definition: baader_dome.h:98
double simShutterTimer
Definition: baader_dome.h:96
bool UpdateFlapStatus()
bool UpdatePosition()
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
bool SetupParms()
Definition: baader_dome.cpp:84
@ CALIBRATION_UNKNOWN
Definition: baader_dome.h:31
@ CALIBRATION_STAGE1
Definition: baader_dome.h:32
@ CALIBRATION_STAGE3
Definition: baader_dome.h:34
@ CALIBRATION_COMPLETE
Definition: baader_dome.h:35
@ CALIBRATION_STAGE2
Definition: baader_dome.h:33
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool Abort() override
Abort all dome motion.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: baader_dome.cpp:61
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
ShutterOperation targetShutter
Definition: baader_dome.h:93
@ DOME_CALIBRATING
Definition: baader_dome.h:28
double calibrationStart
Definition: baader_dome.h:90
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
double targetAz
Definition: baader_dome.h:89
ISwitchVectorProperty CalibrateSP
Definition: baader_dome.h:81
virtual IPState MoveRel(double azDiff) override
Move the Dome to an relative position.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
ISwitch DomeFlapS[2]
Definition: baader_dome.h:83
double DomeAzToMountAz(unsigned short domeAz)
DomeStatus status
Definition: baader_dome.h:86
virtual ~BaaderDome()=default
Class to provide general functionality of a Dome device.
Definition: indidome.h:75
ShutterOperation
Shutter operation command.
Definition: indidome.h:114
@ SHUTTER_OPEN
Definition: indidome.h:115
@ SHUTTER_OPENED
Definition: indidome.h:147
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
One switch descriptor.
Switch vector property descriptor.
Definition: indiapi.h:367