Instrument Neutral Distributed Interface INDI  2.0.2
wanderer_rotator_lite.h
Go to the documentation of this file.
1 /*
2  WandererAstro WandererRotatorLite
3  Copyright (C) 2022 Frank Wang (1010965596@qq.com)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
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  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #pragma once
22 
23 #include "defaultdevice.h"
24 #include "indirotator.h"
25 #include "indirotatorinterface.h"
26 #include "indipropertyswitch.h"
28 {
29  public:
31 
32  virtual bool initProperties() override;
33  virtual bool updateProperties() override;
34  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
35 
36 
37 
38 
39  protected:
40  const char * getDefaultName() override;
41  virtual IPState MoveRotator(double angle) override;
42  virtual IPState HomeRotator() override;
43  virtual bool ReverseRotator(bool enabled) override;
44 
45  virtual bool AbortRotator() override;
46  virtual void TimerHit() override;
47  virtual bool SetRotatorBacklash(int32_t steps) override;
48  virtual bool SetRotatorBacklashEnabled(bool enabled) override;
49 
50 
51  private:
52  bool Handshake() override;
53  bool sendCommand(const char *cmd);
54  bool Move(const char *cmd);
55  ISwitchVectorProperty HomeSP;
56  ISwitch HomeS[1];
57  bool SetHomePosition();
58  bool haltcommand = false;
59  bool ReverseState;
60  double positiontemp;
61  int reversecoefficient;
62  double backlash;
63  double positionhistory;
64  double backlashcompensation;
65  int positioncount;
66 };
67 
68 
69 
70 
71 
72 
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
const char * getDefaultName() override
virtual void TimerHit() override
WandererRotatorLite::TimerHit.
virtual bool ReverseRotator(bool enabled) override
WandererRotatorLite::ReverseRotator.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual IPState MoveRotator(double angle) override
WandererRotatorLite::MoveRotator.
virtual bool SetRotatorBacklashEnabled(bool enabled) override
WandererRotatorLite::SetRotatorBacklashEnabled.
virtual bool AbortRotator() override
WandererRotatorLite::AbortRotator.
virtual IPState HomeRotator() override
WandererRotatorLite::HomeRotator.
virtual bool SetRotatorBacklash(int32_t steps) override
WandererRotatorLite::SetRotatorBacklash.
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
__u8 cmd[4]
Definition: pwc-ioctl.h:2
One switch descriptor.
Switch vector property descriptor.
Definition: indiapi.h:367