Instrument Neutral Distributed Interface INDI  1.9.5
deepskydad_fr1.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2020 Jasem Mutlaq. All rights reserved.
3 
4  Pegasus Falcon Rotator
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "indirotator.h"
28 #include <stdint.h>
29 
31 {
32  public:
33  DeepSkyDadFR1();
34 
35  typedef enum { Slow, Fast } SpeedMode;
36  typedef enum { One, Two, Four, Eight } StepSize;
37 
38  virtual bool initProperties() override;
39  virtual bool updateProperties() override;
40 
41  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
42 
43  protected:
44  const char *getDefaultName() override;
45 
46  // Event loop
47  virtual void TimerHit() override;
48 
49  // Rotator Overrides
50  virtual IPState MoveRotator(double angle) override;
51  virtual bool ReverseRotator(bool enabled) override;
52  virtual bool SyncRotator(double angle) override;
53  virtual bool AbortRotator() override;
54 
55  private:
56  bool Handshake() override;
57 
61  bool getInitialStatusData();
62  bool getStatusData();
63 
67 
68  bool sendCommand(const char *cmd, char *res);
69 
73 
74  // Firmware version
75  ITextVectorProperty FirmwareTP;
76  IText FirmwareT[1] {};
77 
78  // Speed mode
79  ISwitch SpeedModeS[2];
80  ISwitchVectorProperty SpeedModeSP;
81  // Step size
82  ISwitch StepSizeS[4];
83  ISwitchVectorProperty StepSizeSP;
84 };
DeepSkyDadFR1::Fast
@ Fast
Definition: deepskydad_fr1.h:57
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
DeepSkyDadFR1::TimerHit
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: deepskydad_fr1.cpp:250
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::Rotator
Definition: indirotator.h:45
ISwitch
One switch descriptor.
DeepSkyDadFR1::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: deepskydad_fr1.cpp:49
DeepSkyDadFR1::MoveRotator
virtual IPState MoveRotator(double angle) override
MoveRotator Go to specific angle.
Definition: deepskydad_fr1.cpp:186
DeepSkyDadFR1::AbortRotator
virtual bool AbortRotator() override
AbortRotator Abort all motion.
Definition: deepskydad_fr1.cpp:203
DeepSkyDadFR1
Definition: deepskydad_fr1.h:30
DeepSkyDadFR1::ReverseRotator
virtual bool ReverseRotator(bool enabled) override
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
Definition: deepskydad_fr1.cpp:217
_ITextVectorProperty
Text vector property descriptor.
Definition: indiapi.h:244
DeepSkyDadFR1::SpeedMode
SpeedMode
Definition: deepskydad_fr1.h:57
indirotator.h
IText
One text descriptor.
DeepSkyDadFR1::Slow
@ Slow
Definition: deepskydad_fr1.h:57
DeepSkyDadFR1::Four
@ Four
Definition: deepskydad_fr1.h:58
DeepSkyDadFR1::Two
@ Two
Definition: deepskydad_fr1.h:58
DeepSkyDadFR1::One
@ One
Definition: deepskydad_fr1.h:58
DeepSkyDadFR1::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: deepskydad_fr1.cpp:112
DeepSkyDadFR1::DeepSkyDadFR1
DeepSkyDadFR1()
Definition: deepskydad_fr1.cpp:44
name
const char * name
Definition: indiserver.c:116
DeepSkyDadFR1::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: deepskydad_fr1.cpp:81
ISState
ISState
Switch state.
Definition: indiapi.h:148
DeepSkyDadFR1::getDefaultName
const char * getDefaultName() override
Definition: deepskydad_fr1.cpp:101
DeepSkyDadFR1::StepSize
StepSize
Definition: deepskydad_fr1.h:58
DeepSkyDadFR1::SyncRotator
virtual bool SyncRotator(double angle) override
SyncRotator Set current angle as the supplied angle without moving the rotator.
Definition: deepskydad_fr1.cpp:233
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365
DeepSkyDadFR1::Eight
@ Eight
Definition: deepskydad_fr1.h:58