X2 Standard  Version 1.24
x2rotator.h
1 #if !defined(_X2Rotator_H_)
2 #define _X2Rotator_H_
3 
4 #include "../../licensedinterfaces/rotatordriverinterface.h"
5 #include "../../licensedinterfaces/serialportparams2interface.h"
6 #include "../../licensedinterfaces/modalsettingsdialoginterface.h"
7 
8 #define PLUGIN_DISPLAY_NAME "X2 Rotator"
9 
10 class SerXInterface;
12 class SleeperInterface;
14 class LoggerInterface;
15 class MutexInterface;
16 class SyncMountInterface;
17 class TickCountInterface;
18 
27 {
28 // Construction
29 public:
30 
32  X2Rotator(const char* pszDriverSelection,
33  const int& nInstanceIndex,
34  SerXInterface * pSerX,
36  SleeperInterface * pSleeper,
37  BasicIniUtilInterface * pIniUtil,
38  LoggerInterface * pLogger,
39  MutexInterface * pIOMutex,
40  TickCountInterface * pTickCount);
41 
42  virtual ~X2Rotator();
43 
44 public:
45 
46 // Operations
47 public:
48 
53  virtual int queryAbstraction(const char* pszName, void** ppVal);
55 
59  virtual void driverInfoDetailedInfo(BasicStringInterface& str) const;
60  virtual double driverInfoVersion(void) const ;
62 
66  virtual void deviceInfoNameShort(BasicStringInterface& str) const ;
67  virtual void deviceInfoNameLong(BasicStringInterface& str) const ;
68  virtual void deviceInfoDetailedDescription(BasicStringInterface& str) const ;
70  virtual void deviceInfoModel(BasicStringInterface& str) ;
72 
76  virtual int establishLink(void) ;
77  virtual int terminateLink(void) ;
78  virtual bool isLinked(void) const ;
79  virtual bool isEstablishLinkAbortable(void) const {return false;}
81 
85  virtual int position(double& dPosition) ;
86  virtual int abort(void) ;
87 
88  virtual int startRotatorGoto(const double& dTargetPosition) ;
89  virtual int isCompleteRotatorGoto(bool& bComplete) const ;
90  virtual int endRotatorGoto(void) ;
92 
93 
94 /*****************************************************************************************/
95 // Implementation
96 
97  //SerialPortParams2Interface
98  virtual void portName(BasicStringInterface& str) const ;
99  virtual void setPortName(const char* szPort) ;
100 
101  virtual unsigned int baudRate() const {return 9600;};
102  virtual void setBaudRate(unsigned int) {};
103  virtual bool isBaudRateFixed() const {return true;}
104 
107  virtual bool isParityFixed() const {return true;}
108 
109  //Use default impl of SerialPortParams2Interface for rest
110 
111  //
115  virtual int initModalSettingsDialog(void){return 0;}
116  virtual int execModalSettingsDialog(void);
118 private:
119 
120  SerXInterface* m_pSerX;
121  TheSkyXFacadeForDriversInterface* m_pTheSkyXForMounts;
122  SleeperInterface* m_pSleeper;
123  BasicIniUtilInterface* m_pIniUtil;
124  LoggerInterface* m_pLogger;
125  MutexInterface* m_pIOMutex;
126  TickCountInterface* m_pTickCount;
127 
128  SerXInterface *GetSerX() {return m_pSerX; }
129  TheSkyXFacadeForDriversInterface *GetTheSkyXFacadeForDrivers() {return m_pTheSkyXForMounts;}
130  SleeperInterface *GetSleeper() {return m_pSleeper; }
131  BasicIniUtilInterface *GetSimpleIniUtil() {return m_pIniUtil; }
132  LoggerInterface *GetLogger() {return m_pLogger; }
133  MutexInterface *GetMutex() {return m_pIOMutex;}
134  TickCountInterface *GetTickCountInterface() {return m_pTickCount;}
135 
136  bool m_bLinked;
137  int m_nInstanceIndex;
138  double m_dPosition;
139  bool m_bDoingGoto;
140  double m_dTargetPosition;
141  int m_nGotoStartStamp;
142 
143  void portNameOnToCharPtr(char* pszPort, const int& nMaxSize) const;
144 
145 
146  //Samples for Tom doing IO with SerXInteface and Optec TCFS
147  int tcfsGetSerialConnection();
148  int tcfsTest();
149  int tcfsSendFMMODE();
150  int tcfsPositionCore(int* plPos);
151 };
152 
153 
154 
155 
156 #endif
SerialPortParams2Interface
The SerialPortParams2Interface is a cross-platform interface to common serial port parameters.
Definition: serialportparams2interface.h:37
X2Rotator::deviceInfoDetailedDescription
virtual void deviceInfoDetailedDescription(BasicStringInterface &str) const
Definition: x2rotator.cpp:315
X2Rotator::X2Rotator
X2Rotator(const char *pszDriverSelection, const int &nInstanceIndex, SerXInterface *pSerX, TheSkyXFacadeForDriversInterface *pTheSkyX, SleeperInterface *pSleeper, BasicIniUtilInterface *pIniUtil, LoggerInterface *pLogger, MutexInterface *pIOMutex, TickCountInterface *pTickCount)
Definition: x2rotator.cpp:32
SyncMountInterface
The SyncMountInterface for mounts.
Definition: syncmountinterface.h:15
RotatorDriverInterface
The RotatorDriverInterface allows an X2 implementor to a write X2 rotator driver.
Definition: rotatordriverinterface.h:26
ModalSettingsDialogInterface
The ModalSettingsDialogInterface allows X2 implementors to display a customized settings user interfa...
Definition: modalsettingsdialoginterface.h:23
X2Rotator::isBaudRateFixed
virtual bool isBaudRateFixed() const
Definition: x2rotator.h:103
X2Rotator::endRotatorGoto
virtual int endRotatorGoto(void)
Definition: x2rotator.cpp:385
X2Rotator::deviceInfoFirmwareVersion
virtual void deviceInfoFirmwareVersion(BasicStringInterface &str)
Definition: x2rotator.cpp:319
TickCountInterface
The TickCountInterface is a cross-platform way to measure relative timing.
Definition: tickcountinterface.h:17
X2Rotator::setParity
virtual void setParity(const SerXInterface::Parity &parity)
Definition: x2rotator.h:106
MutexInterface
The MutexInterface provides a cross-platform mutex.
Definition: mutexinterface.h:16
X2Rotator::abort
virtual int abort(void)
Definition: x2rotator.cpp:342
X2Rotator::deviceInfoModel
virtual void deviceInfoModel(BasicStringInterface &str)
Definition: x2rotator.cpp:323
X2Rotator::parity
virtual SerXInterface::Parity parity() const
Definition: x2rotator.h:105
X2Rotator::isParityFixed
virtual bool isParityFixed() const
Definition: x2rotator.h:107
X2Rotator::establishLink
virtual int establishLink(void)
Definition: x2rotator.cpp:292
TheSkyXFacadeForDriversInterface
The TheSkyXFacadeForDriversInterface is a simplified interface to TheSkyX passed to X2 implementors.
Definition: theskyxfacadefordriversinterface.h:19
X2Rotator::deviceInfoNameShort
virtual void deviceInfoNameShort(BasicStringInterface &str) const
Definition: x2rotator.cpp:307
X2Rotator
The X2Rotator example.
Definition: x2rotator.h:27
X2Rotator::isCompleteRotatorGoto
virtual int isCompleteRotatorGoto(bool &bComplete) const
Definition: x2rotator.cpp:366
DriverRootInterface::DeviceType
DeviceType
Definition: driverrootinterface.h:26
X2Rotator::driverInfoVersion
virtual double driverInfoVersion(void) const
Definition: x2rotator.cpp:332
X2Rotator::deviceInfoNameLong
virtual void deviceInfoNameLong(BasicStringInterface &str) const
Definition: x2rotator.cpp:311
X2Rotator::queryAbstraction
virtual int queryAbstraction(const char *pszName, void **ppVal)
Definition: x2rotator.cpp:82
X2Rotator::driverInfoDetailedInfo
virtual void driverInfoDetailedInfo(BasicStringInterface &str) const
Definition: x2rotator.cpp:328
DriverRootInterface::DT_ROTATOR
@ DT_ROTATOR
Definition: driverrootinterface.h:33
X2Rotator::position
virtual int position(double &dPosition)
Definition: x2rotator.cpp:337
X2Rotator::baudRate
virtual unsigned int baudRate() const
Definition: x2rotator.h:101
X2Rotator::terminateLink
virtual int terminateLink(void)
Definition: x2rotator.cpp:297
X2Rotator::startRotatorGoto
virtual int startRotatorGoto(const double &dTargetPosition)
Definition: x2rotator.cpp:352
BasicIniUtilInterface
The BasicIniUtilInterface is used to make properties persistent.
Definition: basiciniutilinterface.h:21
X2Rotator::setPortName
virtual void setPortName(const char *szPort)
Definition: x2rotator.cpp:417
LoggerInterface
The LoggerInterface is a cross-platform logging utility passed to X2 implementors to show real-time,...
Definition: loggerinterface.h:58
X2Rotator::initModalSettingsDialog
virtual int initModalSettingsDialog(void)
Definition: x2rotator.h:115
SleeperInterface
The SleeperInterface is a cross-platform "sleeper".
Definition: sleeperinterface.h:15
SerXInterface::Parity
Parity
Definition: serxinterface.h:25
X2Rotator::deviceType
virtual DeviceType deviceType(void)
Definition: x2rotator.h:52
SerXInterface
The SerXInterface is a cross-plaform serial port.
Definition: serxinterface.h:18
SerXInterface::B_NOPARITY
@ B_NOPARITY
Definition: serxinterface.h:26
X2Rotator::isLinked
virtual bool isLinked(void) const
Definition: x2rotator.cpp:302
X2Rotator::portName
virtual void portName(BasicStringInterface &str) const
Definition: x2rotator.cpp:407
BasicStringInterface
The BasicStringInterface allows a string as an output.
Definition: basicstringinterface.h:17
X2Rotator::execModalSettingsDialog
virtual int execModalSettingsDialog(void)
Definition: x2rotator.cpp:424
X2Rotator::setBaudRate
virtual void setBaudRate(unsigned int)
Definition: x2rotator.h:102
X2 Examples
(C) Software Bisque, Inc. All rights reserved.