X2 Standard  Version 1.28
Loading...
Searching...
No Matches
x2powercontrol.h
1#include "../../licensedinterfaces/powercontroldriverinterface.h"
2#include "../../licensedinterfaces/circuitrefreshinterface.h"
3
4// Forward declare the interfaces that this device is dependent upon
5class SerXInterface;
8class SimpleIniUtilInterface;
10class MutexInterface;
13
21class X2PowerControl : public PowerControlDriverInterface, public CircuitRefreshInterface
22{
23public:
24 X2PowerControl(const char* pszDisplayName,
25 const int& nInstanceIndex,
26 SerXInterface * pSerXIn,
28 SleeperInterface * pSleeperIn,
29 BasicIniUtilInterface * pIniUtilIn,
30 LoggerInterface * pLoggerIn,
31 MutexInterface * pIOMutexIn,
32 TickCountInterface * pTickCountIn);
33 virtual ~X2PowerControl();
34
35 enum
36 {
37 X2_POWER_CONTROL_CIRCUITS = 8
38 };
39
40public:
41
45 virtual int queryAbstraction(const char* pszName, void** ppVal);
47
51 virtual void driverInfoDetailedInfo(BasicStringInterface& str) const;
52 virtual double driverInfoVersion(void) const;
54
58 virtual void deviceInfoNameShort(BasicStringInterface& str) const;
59 virtual void deviceInfoNameLong(BasicStringInterface& str) const;
62 virtual void deviceInfoModel(BasicStringInterface& str);
64
68 virtual int establishLink(void);
69 virtual int terminateLink(void);
70 virtual bool isLinked(void) const;
72
73 //PowerControlDriverInterface
74 virtual int numberOfCircuits(int& nNumber);
75 virtual int circuitState(const int& nIndex, bool& bZeroForOffOneForOn);
76 virtual int setCircuitState(const int& nIndex, const bool& bZeroForOffOneForOn);
77
78 //CircuitRefreshInterface
79 virtual int circuitRefreshInterval(int& nOutInterval_ms)
80 {
81 nOutInterval_ms = 5000;
82 return 0;// SB_OK;
83 }
84
85private:
86
87 //Standard device driver tools
88 SerXInterface* m_pSerX;
89 TheSkyXFacadeForDriversInterface* m_pTheSkyXForMounts;
90 SleeperInterface* m_pSleeper;
91 BasicIniUtilInterface* m_pIniUtil;
92 LoggerInterface* m_pLogger;
93 mutable MutexInterface* m_pIOMutex;
94 TickCountInterface* m_pTickCount;
95
96 SerXInterface *GetSerX() { return m_pSerX; }
97 TheSkyXFacadeForDriversInterface *GetTheSkyXFacadeForDrivers() { return m_pTheSkyXForMounts; }
98 SleeperInterface *GetSleeper() { return m_pSleeper; }
99 BasicIniUtilInterface *GetSimpleIniUtil() { return m_pIniUtil; }
100 LoggerInterface *GetLogger() { return m_pLogger; }
101 MutexInterface *GetMutex() { return m_pIOMutex; }
102 TickCountInterface *GetTickCountInterface() { return m_pTickCount; }
103
104 int m_nISIndex;
105 bool m_bLinked;
106 bool m_bCache[X2_POWER_CONTROL_CIRCUITS];
107
108};
The BasicIniUtilInterface is used to make properties persistent.
Definition basiciniutilinterface.h:21
The BasicStringInterface allows a string as an output.
Definition basicstringinterface.h:17
The CircuitRefreshInterface allows a power control driver to specify how often TheSkyX should re-quer...
Definition circuitrefreshinterface.h:31
The LoggerInterface is a cross-platform logging utility passed to X2 implementors to show real-time,...
Definition loggerinterface.h:58
The MutexInterface provides a cross-platform mutex.
Definition mutexinterface.h:16
The PowerControlDriverInterface allows an X2 implementor to a write X2 power control driver.
Definition powercontroldriverinterface.h:29
The SerXInterface is a cross-plaform serial port.
Definition serxinterface.h:18
The SleeperInterface is a cross-platform "sleeper".
Definition sleeperinterface.h:15
The TheSkyXFacadeForDriversInterface is a simplified interface to TheSkyX passed to X2 implementors.
Definition theskyxfacadefordriversinterface.h:19
The TickCountInterface is a cross-platform way to measure relative timing.
Definition tickcountinterface.h:17
virtual void deviceInfoNameShort(BasicStringInterface &str) const
Definition x2powercontrol.cpp:76
virtual int establishLink(void)
Definition x2powercontrol.cpp:55
virtual int circuitRefreshInterval(int &nOutInterval_ms)
Returns the recommended refresh interval (in milliseconds) for circuit state.
Definition x2powercontrol.h:79
virtual bool isLinked(void) const
Definition x2powercontrol.cpp:70
virtual double driverInfoVersion(void) const
Definition x2powercontrol.cpp:101
virtual int circuitState(const int &nIndex, bool &bZeroForOffOneForOn)
Definition x2powercontrol.cpp:125
virtual void driverInfoDetailedInfo(BasicStringInterface &str) const
Definition x2powercontrol.cpp:97
virtual int queryAbstraction(const char *pszName, void **ppVal)
Definition x2powercontrol.cpp:106
virtual int setCircuitState(const int &nIndex, const bool &bZeroForOffOneForOn)
Definition x2powercontrol.cpp:137
virtual void deviceInfoFirmwareVersion(BasicStringInterface &str)
Definition x2powercontrol.cpp:88
virtual void deviceInfoModel(BasicStringInterface &str)
Definition x2powercontrol.cpp:92
virtual int terminateLink(void)
Definition x2powercontrol.cpp:64
virtual int numberOfCircuits(int &nNumber)
Definition x2powercontrol.cpp:119
virtual void deviceInfoNameLong(BasicStringInterface &str) const
Definition x2powercontrol.cpp:80
virtual void deviceInfoDetailedDescription(BasicStringInterface &str) const
Definition x2powercontrol.cpp:84
X2 Examples
(C) 2026 Software Bisque, Inc. All rights reserved.