Instrument Neutral Distributed Interface INDI 2.2.5
mount_driver.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2019 Jasem Mutlaq. All rights reserved.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7 .
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12 .
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*******************************************************************************/
18
19#pragma once
20
21#include "indiguiderinterface.h"
22#include "inditelescope.h"
23
41{
42 public:
44
45 virtual const char *getDefaultName() override;
46 virtual bool initProperties() override;
47 virtual bool updateProperties() override;
48
49 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
50
51 protected:
55
59 virtual bool Handshake() override;
60
65 virtual bool ReadScopeStatus() override;
66
70
77 virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
78
85 virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
86
91 virtual bool Abort() override;
92
96 virtual IPState GuideNorth(uint32_t ms) override;
97 virtual IPState GuideSouth(uint32_t ms) override;
98 virtual IPState GuideEast(uint32_t ms) override;
99 virtual IPState GuideWest(uint32_t ms) override;
100
104 virtual bool SetTrackMode(uint8_t mode) override;
105 virtual bool SetTrackEnabled(bool enabled) override;
106 virtual bool SetTrackRate(double raRate, double deRate) override;
107
111 virtual bool Goto(double RA, double DE) override;
112 virtual bool Sync(double RA, double DE) override;
113
117 virtual bool updateLocation(double latitude, double longitude, double elevation) override;
118
122 virtual bool Park() override;
123 virtual bool UnPark() override;
124 virtual bool SetCurrentPark() override;
125 virtual bool SetDefaultPark() override;
126
130
141 bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
142
150 void hexDump(char * buf, const char * data, int size);
151
152 private:
156 INumber GuideRateN[2];
157 INumberVectorProperty GuideRateNP;
158
162 IGeographicCoordinates m_GeographicLocation { 0, 0 };
163
167 // '#' is the stop char
168 static const char DRIVER_STOP_CHAR { 0x23 };
169 // Wait up to a maximum of 3 seconds for serial input
170 static constexpr const uint8_t DRIVER_TIMEOUT {3};
171 // Maximum buffer for sending/receiving.
172 static constexpr const uint8_t DRIVER_LEN {64};
173
174};
The MountDriver class provides a simple example for development of a new mount driver....
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual const char * getDefaultName() override
virtual bool Park() override
Parking commands.
bool sendCommand(const char *cmd, char *res=nullptr, int cmd_len=-1, int res_len=-1)
Utility Functions.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool Abort() override
Abort Abort all motion. If tracking, stop it.
virtual bool SetTrackMode(uint8_t mode) override
Tracking Commands.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool Handshake() override
Communication Commands.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
void hexDump(char *buf, const char *data, int size)
hexDump Helper function to print non-string commands to the logger so it is easier to debug
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
MoveWE Start or Stop motion in the East/West RA Axis.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool Sync(double RA, double DE) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Motions commands.
virtual IPState GuideNorth(uint32_t ms) override
Pulse Guiding Commands.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Time, Date & Location commands.
virtual bool Goto(double RA, double DE) override
GOTO & Sync commands.
virtual bool ReadScopeStatus() override
ReadScopeStatus Query the mount status, coordinate, any status indicators, pier side....
IPState
Property state.
Definition indiapi.h:158
INDI_DIR_WE
INDI_DIR_NS
uint8_t cmd[4]
Definition pwc-ioctl.h:2
One number descriptor.
Number vector property descriptor.
Definition indiapi.h:317