44 lines
1.0 KiB
C++

#ifndef CANWATCHDOG_H
#define CANWATCHDOG_H
#include <QObject>
#include "PCANInterface.h"
#include <QTimer>
#include "CANMessage.h"
//This class is not a watchdog per say. It manages the update of the CAN register that is sent to the
//Parker controller. This controller uses this update as a watchdog signal, but the register contains
//some useful data for the Parker controller as well.
class CCANWatchdog: public QObject
{
Q_OBJECT
public:
CCANWatchdog();
int Init(CPCANInterface *CANDriverIF, TPCANHandle CANDeviceHandle, unsigned int WDTPeriod,unsigned int CANMsgID);
int StartWDT();
int StopWDT();
bool IsInitialized(){return mWDTInitialized;}
quint64 GetCANDateTimeBuffer();
CPCANInterface *mCANDriverIF;
unsigned int mWDTPeriod;
QTimer *mWatchdogTimer;
bool mWDTInitialized;
CCANMessage mWDTCANMsg;
private:
bool mIsCANInitialized;
TPCANHandle mCANDeviceHandle;
public slots:
void WatchdogTimeoutTimerExpired();
};
#endif // CANWATCHDOG_H