X2 Standard  Version 1.25
x2mount.h
1 #pragma once
2 #include "../../licensedinterfaces/mountdriverinterface.h"
3 
4 //Optional interfaces, uncomment and implement as required.
5 //#include "../../licensedinterfaces/mount/slewtointerface.h"
6 //#include "../../licensedinterfaces/mount/syncmountinterface.h"
7 //#include "../../licensedinterfaces/mount/asymmetricalequatorialinterface.h"
8 #include "../../licensedinterfaces/mount/openloopmoveinterface.h"
9 //#include "../../licensedinterfaces/mount/needsrefractioninterface.h"
10 //#include "../../licensedinterfaces/mount/linkfromuithreadinterface.h"
11 //#include "../../licensedinterfaces/mount/trackingratesinterface.h"
12 #include "../../licensedinterfaces/mount/pulseguideinterface2.h"
13 
14 // Forward declare the interfaces that the this driver is "given" by TheSkyX
15 class SerXInterface;
17 class SleeperInterface;
19 class LoggerInterface;
20 class MutexInterface;
21 class AbstractSyncMount;
22 class TickCountInterface;
23 
32  //Optional interfaces, uncomment and implement as required.
33  //,public SyncMountInterface,
34  //,public SlewToInterface,
35  //,public AsymmetricalEquatorialInterface,
36  ,public OpenLoopMoveInterface,
37  //,public NeedsRefractionInterface,
38  //,public LinkFromUIThreadInterface,
39  //,public TrackingRatesInterface
41 {
42 public:
44  X2Mount(const char* pszDriverSelection,
45  const int& nInstanceIndex,
46  SerXInterface * pSerX,
48  SleeperInterface * pSleeper,
49  BasicIniUtilInterface * pIniUtil,
50  LoggerInterface * pLogger,
51  MutexInterface * pIOMutex,
52  TickCountInterface * pTickCount);
53 
54  ~X2Mount();
55 
56 // Operations
57 public:
58 
63  virtual int queryAbstraction(const char* pszName, void** ppVal) ;
65 
69  virtual int establishLink(void) ;
70  virtual int terminateLink(void) ;
71  virtual bool isLinked(void) const ;
72  virtual bool isEstablishLinkAbortable(void) const ;
74 
78  virtual void driverInfoDetailedInfo(BasicStringInterface& str) const;
79  virtual double driverInfoVersion(void) const ;
81 
85  virtual void deviceInfoNameShort(BasicStringInterface& str) const ;
86  virtual void deviceInfoNameLong(BasicStringInterface& str) const ;
87  virtual void deviceInfoDetailedDescription(BasicStringInterface& str) const ;
89  virtual void deviceInfoModel(BasicStringInterface& str) ;
91 
92  virtual int raDec(double& ra, double& dec, const bool& bCached = false) ;
93  virtual int abort(void) ;
94 
95  //Optional interfaces, uncomment and implement as required.
96 
97  //SyncMountInterface
98  //virtual int syncMount(const double& ra, const double& dec) ;
99  //virtual bool isSynced() ;
100 
101  //SlewToInterface
102  //virtual int startSlewTo(const double& dRa, const double& dDec) ;
103  //virtual int isCompleteSlewTo(bool& bComplete) const ;
104  //virtual int endSlewTo(void) ;
105 
106  //AsymmetricalEquatorialInterface
107  //virtual bool knowsBeyondThePole();
108  //virtual int beyondThePole(bool& bYes);
109  //virtual double flipHourAngle();
110  //virtual int gemLimits(double& dHoursEast, double& dHoursWest);
111 
112  //OpenLoopMoveInterface
113  virtual int startOpenLoopMove(const MountDriverInterface::MoveDir& Dir, const int& nRateIndex);
114  virtual int endOpenLoopMove(void) ;
115  virtual bool allowDiagonalMoves() ;
116  virtual int rateCountOpenLoopMove(void) const ;
117  virtual int rateNameFromIndexOpenLoopMove(const int& nZeroBasedIndex, char* pszOut, const int& nOutMaxSize);
118  virtual int rateIndexOpenLoopMove(void);
119 
120  //NeedsRefractionInterface
121  //virtual bool needsRefactionAdjustments(void);
122 
123  //LinkFromUIThreadInterface
124 
125  //TrackingRatesInterface
126  //virtual int setTrackingRates( const bool& bTrackingOn, const bool& bIgnoreRates, const double& dRaRateArcSecPerSec, const double& dDecRateArcSecPerSec);
127  //virtual int trackingRates( bool& bTrackingOn, double& dRaRateArcSecPerSec, double& dDecRateArcSecPerSec);
128 
129  //PulseGuideInterface
130  virtual int useOpenLoopMoveInterface(int& nGuideRateIndex, OpenLoopMoveInterface** pOLSI)
131  {
132  nGuideRateIndex = 2; // 2 is rate "1.0x"
133  return queryAbstraction(OpenLoopMoveInterface_Name, (void**)pOLSI);
134  }
135 
136 // Implementation
137 private:
138 
139  SerXInterface *GetSerX() {return m_pSerX; }
140  TheSkyXFacadeForDriversInterface *GetTheSkyXFacadeForMounts() {return m_pTheSkyXForMounts;}
141  SleeperInterface *GetSleeper() {return m_pSleeper; }
142  BasicIniUtilInterface *GetSimpleIniUtil() {return m_pIniUtil; }
143  LoggerInterface *GetLogger() {return m_pLogger; }
144  MutexInterface *GetMutex() {return m_pIOMutex;}
145  TickCountInterface *GetTickCountInterface() {return m_pTickCount;}
146 
147 
148  int m_nPrivateMulitInstanceIndex;
149  SerXInterface* m_pSerX;
150  TheSkyXFacadeForDriversInterface* m_pTheSkyXForMounts;
151  SleeperInterface* m_pSleeper;
152  BasicIniUtilInterface* m_pIniUtil;
153  LoggerInterface* m_pLogger;
154  MutexInterface* m_pIOMutex;
155  TickCountInterface* m_pTickCount;
156 
157 
158 
159 };
X2Mount::endOpenLoopMove
virtual int endOpenLoopMove(void)
Definition: x2mount.cpp:146
X2Mount::deviceInfoNameShort
virtual void deviceInfoNameShort(BasicStringInterface &str) const
Definition: x2mount.cpp:108
X2Mount::driverInfoVersion
virtual double driverInfoVersion(void) const
Definition: x2mount.cpp:102
X2Mount::rateNameFromIndexOpenLoopMove
virtual int rateNameFromIndexOpenLoopMove(const int &nZeroBasedIndex, char *pszOut, const int &nOutMaxSize)
Definition: x2mount.cpp:158
X2Mount::deviceInfoNameLong
virtual void deviceInfoNameLong(BasicStringInterface &str) const
Definition: x2mount.cpp:112
X2Mount::driverInfoDetailedInfo
virtual void driverInfoDetailedInfo(BasicStringInterface &str) const
Definition: x2mount.cpp:98
TickCountInterface
The TickCountInterface is a cross-platform way to measure relative timing.
Definition: tickcountinterface.h:17
DriverRootInterface::DT_MOUNT
@ DT_MOUNT
Definition: driverrootinterface.h:28
MutexInterface
The MutexInterface provides a cross-platform mutex.
Definition: mutexinterface.h:16
X2Mount::queryAbstraction
virtual int queryAbstraction(const char *pszName, void **ppVal)
Definition: x2mount.cpp:55
PulseGuideInterface2
The PulseGuideInterface2 allows X2 mount drivers to be an integral part of TheSky's autoguiding by mo...
Definition: pulseguideinterface2.h:30
X2Mount::deviceInfoFirmwareVersion
virtual void deviceInfoFirmwareVersion(BasicStringInterface &str)
Definition: x2mount.cpp:122
X2Mount::rateIndexOpenLoopMove
virtual int rateIndexOpenLoopMove(void)
Definition: x2mount.cpp:162
TheSkyXFacadeForDriversInterface
The TheSkyXFacadeForDriversInterface is a simplified interface to TheSkyX passed to X2 implementors.
Definition: theskyxfacadefordriversinterface.h:19
X2Mount::isLinked
virtual bool isLinked(void) const
Definition: x2mount.cpp:89
X2Mount::allowDiagonalMoves
virtual bool allowDiagonalMoves()
Definition: x2mount.cpp:150
X2Mount::terminateLink
virtual int terminateLink(void)
Definition: x2mount.cpp:85
X2Mount::useOpenLoopMoveInterface
virtual int useOpenLoopMoveInterface(int &nGuideRateIndex, OpenLoopMoveInterface **pOLSI)
Definition: x2mount.h:130
X2Mount::startOpenLoopMove
virtual int startOpenLoopMove(const MountDriverInterface::MoveDir &Dir, const int &nRateIndex)
Definition: x2mount.cpp:142
X2Mount::abort
virtual int abort(void)
Definition: x2mount.cpp:136
DriverRootInterface::DeviceType
DeviceType
Definition: driverrootinterface.h:26
OpenLoopMoveInterface
The OpenLoopMoveInterface allows a mount to move at a given rate for a open-ended amount of time.
Definition: openloopmoveinterface.h:23
X2Mount::X2Mount
X2Mount(const char *pszDriverSelection, const int &nInstanceIndex, SerXInterface *pSerX, TheSkyXFacadeForDriversInterface *pTheSkyX, SleeperInterface *pSleeper, BasicIniUtilInterface *pIniUtil, LoggerInterface *pLogger, MutexInterface *pIOMutex, TickCountInterface *pTickCount)
Definition: x2mount.cpp:15
X2Mount::deviceInfoDetailedDescription
virtual void deviceInfoDetailedDescription(BasicStringInterface &str) const
Definition: x2mount.cpp:117
MountDriverInterface
The MountDriverInterface allows an X2 implementor to a write X2 mount driver.
Definition: mountdriverinterface.h:26
BasicIniUtilInterface
The BasicIniUtilInterface is used to make properties persistent.
Definition: basiciniutilinterface.h:21
MountDriverInterface::MoveDir
MoveDir
Definition: mountdriverinterface.h:51
LoggerInterface
The LoggerInterface is a cross-platform logging utility passed to X2 implementors to show real-time,...
Definition: loggerinterface.h:58
X2Mount::deviceType
virtual DeviceType deviceType(void)
Definition: x2mount.h:62
X2Mount::deviceInfoModel
virtual void deviceInfoModel(BasicStringInterface &str)
Definition: x2mount.cpp:126
X2Mount::raDec
virtual int raDec(double &ra, double &dec, const bool &bCached=false)
Definition: x2mount.cpp:132
SleeperInterface
The SleeperInterface is a cross-platform "sleeper".
Definition: sleeperinterface.h:15
SerXInterface
The SerXInterface is a cross-plaform serial port.
Definition: serxinterface.h:18
X2Mount
The X2Mount example.
Definition: x2mount.h:41
BasicStringInterface
The BasicStringInterface allows a string as an output.
Definition: basicstringinterface.h:17
X2Mount::establishLink
virtual int establishLink(void)
Definition: x2mount.cpp:81
X2Mount::rateCountOpenLoopMove
virtual int rateCountOpenLoopMove(void) const
Definition: x2mount.cpp:154
X2 Examples
(C) 2023 Software Bisque, Inc. All rights reserved.