1 /******************************************************************************* 2 DDW Dome INDI Driver 3 4 Copyright(c) 2020-2021 Jarno Paananen. All rights reserved. 5 6 based on: 7 8 ScopeDome Dome INDI Driver 9 10 Copyright(c) 2017-2021 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 bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override; 54 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override; 55 56 virtual IPState MoveAbs(double az) override; 57 virtual IPState ControlShutter(ShutterOperation operation) override; 58 virtual bool Abort() override; 59 60 // Parking 61 virtual IPState Park() override; 62 virtual IPState UnPark() override; 63 virtual bool SetCurrentPark() override; 64 virtual bool SetDefaultPark() override; 65 66 protected: 67 bool SetupParms(); 68 69 INumber FirmwareVersionN[1]; 70 INumberVectorProperty FirmwareVersionNP; 71 72 private: 73 int writeCmd(const char *cmd); 74 int readStatus(std::string &status); 75 void parseGINF(const char *response); 76 77 int ticksPerRev { 100 }; 78 double homeAz { 0 }; 79 int watchdog { 0 }; 80 81 int fwVersion{ -1 }; 82 83 double gotoTarget { 0 }; 84 bool gotoPending { false }; 85 86 enum 87 { 88 IDLE, 89 MOVING, 90 SHUTTER_OPERATION, 91 HOMING, 92 PARKING, 93 UNPARKING 94 } cmdState{ IDLE }; 95 }; 96