📄 lvwdog.h
字号:
#ifndef ___LVWDOG_H
#define ___LVWDOG_H
#include <dsylib.h>
#include <lvpackon.h>
/** @defgroup WD_resolutions WatchDog resolutions */
//@{
/** WatchDog resolution - seconds */
#define LvWD_Res_Second 0
/** WatchDog resolution - minutes */
#define LvWD_Res_Minute 0x80000000
//@}
#define LvWD_Flag_UserReset 0x00000001
/** Represents a system watchdog.
* The watchdog timer is a system device that is used to monitor a PC in
* order to ensure maximum system availability. If the hardware or software
* locks up then the watchdog can automatically reset the PC. A watchdog
* can be used in critical applications in order to minimize the time the PC is,
* for whatever reason, not available and running, especially for systems that
* are not continuously monitored by an operator.\n
* \n
* By combining watchdog handling and hardware monitoring through the
* system health status functionality improves the system reliability in hard
* environment conditions.\n
* \n
* Objects belonging to the LvWatchDogTimer class represent a watchdog
* timer present in the system.\n
* \n
* Currently, LVSDS supports LvWatchDogTimer objects for LVmPC systems.
*/
class LvWatchDogTimer {
private:
INTHANDLE Th;
DWORD ThId;
protected:
HDEVICE hDevice;
U8BIT Module;
INTHANDLE hEvent;
U32BIT Timeout;
U32BIT Flags;
U32BIT Command;
CRITICAL_SECTION CmdCs;
LvWatchDogTimer(HDEVICE, U8BIT);
~LvWatchDogTimer(void);
public:
friend LVDSYAPI(void) DsyClose(void);
#ifdef _LVDSY_
friend void LvDsyBuildWatchDogList(void);
#ifndef __WIN3264__
friend int FAR PASCAL LibMain(HINSTANCE, WORD, WORD, LPSTR);
#else
#ifdef _MSC_VER
friend BOOL WINAPI DllMain(HINSTANCE,DWORD,LPVOID);
#else
friend BOOL WINAPI DllEntryPoint (HINSTANCE, DWORD, LPVOID);
#endif
#endif
#endif
/** Enable the WatchDog timer.
* Enables or resets a watchdog timer. The function sets up the initial count
* for the watchdog timer and enables it.
* @param Seconds The amount of seconds or minutes to set in the watchdog timer
* @param Flags Reserved for future use
* @sa Disable(), Reset()
*/
LVSTATUS Enable(U32BIT Seconds, U32BIT Flags);
/** Disable the WatchDog timer.
* Disables a running watchdog timer.
* @return @ref ErrorDefinitions
* @sa Enable(), Reset()
*/
LVSTATUS Disable(void);
/** Resets the watchdog.
* Disables a running watchdog timer.
* @return @ref ErrorDefinitions
* @sa Enable(), Disable()
*/
LVSTATUS Reset(void);
/** Retrieves the watchdog resolution.
* Returns the watchdog timer resolution, one of the @ref LvWD_Res_Second or @ref LvWD_Res_Minute
* @return @ref LvWD_Res_Second if seconds are used for resolution, other @ref LvWD_Res_Minute
* @sa Enable(), Disable()
*/
U32BIT GetResolution(void);
/** Retrieves the watchdog count left.
* Gets the remaining count for the watchdog timer.
* @return the remaining count for the watchdog timer
* @sa Enable(), Disable(), Reset()
*/
U32BIT GetRemainingCount(void);
/** Retrieves the actual watchdog timeout.
* Returns the initial timeout for the watchdog timer.
* @return the initial timeout for the watchdog timer
* @sa Enable(), Disable()
*/
U32BIT GetActualTimeout(void);
DWORD WDThread(void);
};
#include <lvpackof.h>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -