X2 Standard  Version 1.24
x2powercontrol.h
1 #include "../../licensedinterfaces/powercontroldriverinterface.h"
2 
3 // Forward declare the interfaces that this device is dependent upon
4 class SerXInterface;
6 class SleeperInterface;
7 class SimpleIniUtilInterface;
8 class LoggerInterface;
9 class MutexInterface;
11 class TickCountInterface;
12 
21 {
22 public:
23  X2PowerControl(const char* pszDisplayName,
24  const int& nInstanceIndex,
25  SerXInterface * pSerXIn,
27  SleeperInterface * pSleeperIn,
28  BasicIniUtilInterface * pIniUtilIn,
29  LoggerInterface * pLoggerIn,
30  MutexInterface * pIOMutexIn,
31  TickCountInterface * pTickCountIn);
32  virtual ~X2PowerControl();
33 
34  enum
35  {
36  X2_POWER_CONTROL_CIRCUITS = 8
37  };
38 
39 public:
40 
44  virtual int queryAbstraction(const char* pszName, void** ppVal);
46 
50  virtual void driverInfoDetailedInfo(BasicStringInterface& str) const;
51  virtual double driverInfoVersion(void) const;
53 
57  virtual void deviceInfoNameShort(BasicStringInterface& str) const;
58  virtual void deviceInfoNameLong(BasicStringInterface& str) const;
59  virtual void deviceInfoDetailedDescription(BasicStringInterface& str) const;
61  virtual void deviceInfoModel(BasicStringInterface& str);
63 
67  virtual int establishLink(void);
68  virtual int terminateLink(void);
69  virtual bool isLinked(void) const;
71 
72  //PowerControlDriverInterface
73  virtual int numberOfCircuits(int& nNumber);
74  virtual int circuitState(const int& nIndex, bool& bZeroForOffOneForOn);
75  virtual int setCircuitState(const int& nIndex, const bool& bZeroForOffOneForOn);
76 
77 private:
78 
79  //Standard device driver tools
80  SerXInterface* m_pSerX;
81  TheSkyXFacadeForDriversInterface* m_pTheSkyXForMounts;
82  SleeperInterface* m_pSleeper;
83  BasicIniUtilInterface* m_pIniUtil;
84  LoggerInterface* m_pLogger;
85  mutable MutexInterface* m_pIOMutex;
86  TickCountInterface* m_pTickCount;
87 
88  SerXInterface *GetSerX() { return m_pSerX; }
89  TheSkyXFacadeForDriversInterface *GetTheSkyXFacadeForDrivers() { return m_pTheSkyXForMounts; }
90  SleeperInterface *GetSleeper() { return m_pSleeper; }
91  BasicIniUtilInterface *GetSimpleIniUtil() { return m_pIniUtil; }
92  LoggerInterface *GetLogger() { return m_pLogger; }
93  MutexInterface *GetMutex() { return m_pIOMutex; }
94  TickCountInterface *GetTickCountInterface() { return m_pTickCount; }
95 
96  int m_nISIndex;
97  bool m_bLinked;
98  bool m_bCache[X2_POWER_CONTROL_CIRCUITS];
99 
100 };
PowerControlDriverInterface
The PowerControlDriverInterface allows an X2 implementor to a write X2 power control driver.
Definition: powercontroldriverinterface.h:29
X2PowerControl::terminateLink
virtual int terminateLink(void)
Definition: x2powercontrol.cpp:64
X2PowerControl::circuitState
virtual int circuitState(const int &nIndex, bool &bZeroForOffOneForOn)
Definition: x2powercontrol.cpp:122
X2PowerControl::deviceInfoFirmwareVersion
virtual void deviceInfoFirmwareVersion(BasicStringInterface &str)
Definition: x2powercontrol.cpp:88
X2PowerControl
The X2PowerControl example.
Definition: x2powercontrol.h:21
TickCountInterface
The TickCountInterface is a cross-platform way to measure relative timing.
Definition: tickcountinterface.h:17
MutexInterface
The MutexInterface provides a cross-platform mutex.
Definition: mutexinterface.h:16
X2PowerControl::driverInfoDetailedInfo
virtual void driverInfoDetailedInfo(BasicStringInterface &str) const
Definition: x2powercontrol.cpp:97
TheSkyXFacadeForDriversInterface
The TheSkyXFacadeForDriversInterface is a simplified interface to TheSkyX passed to X2 implementors.
Definition: theskyxfacadefordriversinterface.h:19
X2PowerControl::deviceInfoDetailedDescription
virtual void deviceInfoDetailedDescription(BasicStringInterface &str) const
Definition: x2powercontrol.cpp:84
X2PowerControl::establishLink
virtual int establishLink(void)
Definition: x2powercontrol.cpp:55
X2PowerControl::isLinked
virtual bool isLinked(void) const
Definition: x2powercontrol.cpp:70
X2PowerControl::queryAbstraction
virtual int queryAbstraction(const char *pszName, void **ppVal)
Definition: x2powercontrol.cpp:106
X2PowerControl::setCircuitState
virtual int setCircuitState(const int &nIndex, const bool &bZeroForOffOneForOn)
Definition: x2powercontrol.cpp:134
X2PowerControl::driverInfoVersion
virtual double driverInfoVersion(void) const
Definition: x2powercontrol.cpp:101
BasicIniUtilInterface
The BasicIniUtilInterface is used to make properties persistent.
Definition: basiciniutilinterface.h:21
LoggerInterface
The LoggerInterface is a cross-platform logging utility passed to X2 implementors to show real-time,...
Definition: loggerinterface.h:58
X2PowerControl::deviceInfoModel
virtual void deviceInfoModel(BasicStringInterface &str)
Definition: x2powercontrol.cpp:92
SleeperInterface
The SleeperInterface is a cross-platform "sleeper".
Definition: sleeperinterface.h:15
X2PowerControl::deviceInfoNameLong
virtual void deviceInfoNameLong(BasicStringInterface &str) const
Definition: x2powercontrol.cpp:80
SerXInterface
The SerXInterface is a cross-plaform serial port.
Definition: serxinterface.h:18
X2PowerControl::numberOfCircuits
virtual int numberOfCircuits(int &nNumber)
Definition: x2powercontrol.cpp:116
BasicStringInterface
The BasicStringInterface allows a string as an output.
Definition: basicstringinterface.h:17
X2PowerControl::deviceInfoNameShort
virtual void deviceInfoNameShort(BasicStringInterface &str) const
Definition: x2powercontrol.cpp:76
X2 Examples
(C) Software Bisque, Inc. All rights reserved.