Instrument Neutral Distributed Interface INDI  2.0.2
ddw_dome.h
Go to the documentation of this file.
1 /*******************************************************************************
2  DDW Dome INDI Driver
3 
4  Copyright(c) 2020-2023 Jarno Paananen. All rights reserved.
5 
6  based on:
7 
8  ScopeDome Dome INDI Driver
9 
10  Copyright(c) 2017-2023 Jarno Paananen. All rights reserved.
11 
12  and
13 
14  Copyright(c) 2014 Jasem Mutlaq. All rights reserved.
15 
16  Baader Planetarium Dome INDI Driver
17 
18  This library is free software; you can redistribute it and/or
19  modify it under the terms of the GNU Library General Public
20  License version 2 as published by the Free Software Foundation.
21  .
22  This library is distributed in the hope that it will be useful,
23  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25  Library General Public License for more details.
26  .
27  You should have received a copy of the GNU Library General Public License
28  along with this library; see the file COPYING.LIB. If not, write to
29  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
30  Boston, MA 02110-1301, USA.
31 *******************************************************************************/
32 
33 #pragma once
34 
35 #include "indidome.h"
36 #include <memory>
37 
38 class DDW : public INDI::Dome
39 {
40  public:
41  DDW();
42  virtual ~DDW() = default;
43 
44  virtual const char *getDefaultName() override;
45  virtual bool initProperties() override;
46  virtual bool updateProperties() override;
47  virtual bool saveConfigItems(FILE *fp) override;
48 
49  virtual bool Handshake() override;
50 
51  virtual void TimerHit() override;
52 
53  virtual IPState MoveAbs(double az) override;
54  virtual IPState ControlShutter(ShutterOperation operation) override;
55  virtual bool Abort() override;
56 
57  // Parking
58  virtual IPState Park() override;
59  virtual IPState UnPark() override;
60  virtual bool SetCurrentPark() override;
61  virtual bool SetDefaultPark() override;
62 
63  protected:
64  bool SetupParms();
65 
67 
68  private:
69  int writeCmd(const char *cmd);
70  int readStatus(std::string &status);
71  void parseGINF(const char *response);
72 
73  int ticksPerRev { 100 };
74  double homeAz { 0 };
75  int watchdog { 0 };
76 
77  int fwVersion{ -1 };
78 
79  double gotoTarget { 0 };
80  bool gotoPending { false };
81 
82  enum
83  {
84  IDLE,
85  MOVING,
86  SHUTTER_OPERATION,
87  HOMING,
88  PARKING,
89  UNPARKING
90  } cmdState{ IDLE };
91 };
Definition: ddw_dome.h:39
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: ddw_dome.cpp:52
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the Device Port and Dome Presets in the configuration file
Definition: ddw_dome.cpp:528
virtual IPState Park() override
Goto Park Position. The park position is an absolute azimuth value.
Definition: ddw_dome.cpp:451
virtual bool Handshake() override
perform handshake with device to check communication
Definition: ddw_dome.cpp:99
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: ddw_dome.cpp:135
DDW()
Definition: ddw_dome.cpp:45
INDI::PropertyNumber FirmwareVersionNP
Definition: ddw_dome.h:66
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
Definition: ddw_dome.cpp:536
virtual IPState ControlShutter(ShutterOperation operation) override
Open or Close shutter.
Definition: ddw_dome.cpp:491
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: ddw_dome.cpp:280
virtual IPState UnPark() override
UnPark dome. The action of the Unpark command is dome specific, but it may include opening the shutte...
Definition: ddw_dome.cpp:473
virtual IPState MoveAbs(double az) override
Move the Dome to an absolute azimuth.
Definition: ddw_dome.cpp:422
virtual ~DDW()=default
virtual bool Abort() override
Abort all dome motion.
Definition: ddw_dome.cpp:518
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
Definition: ddw_dome.cpp:545
bool SetupParms()
Definition: ddw_dome.cpp:74
virtual const char * getDefaultName() override
Definition: ddw_dome.cpp:127
Class to provide general functionality of a Dome device.
Definition: indidome.h:75
ShutterOperation
Shutter operation command.
Definition: indidome.h:114
IPState
Property state.
Definition: indiapi.h:160
__u8 cmd[4]
Definition: pwc-ioctl.h:2