57 lines
1.4 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 CMQTTClientWrapper;
class CLANDevicesPresenceMonitor;
class CInternetMonitor;
class CDeviceDetectionConfig;
class CCANWatchdog: public QObject
{
Q_OBJECT
public:
CCANWatchdog();
int Init(CPCANInterface *CANDriverIF, TPCANHandle CANDeviceHandle, unsigned int WDTPeriod, CDeviceDetectionConfig *DevicesMonitorConfig);
int StartWDT();
int StopWDT();
bool IsInitialized(){return mWDTInitialized;}
quint64 GetCANDateTimeBuffer();
int SetDevicesDetectionConfig(CDeviceDetectionConfig *DeviceMonitoringConfig);
CPCANInterface *mCANDriverIF;
unsigned int mWDTPeriod;
QTimer *mWatchdogTimer;
bool mWDTInitialized;
CCANMessage mWDTCANMsg;
private:
bool mIsCANInitialized;
TPCANHandle mCANDeviceHandle;
// CMQTTClientWrapper *mMQTTPresenceMonitor;
// CLANDevicesPresenceMonitor *mLANDevicesMonitor;
// CInternetMonitor *mInternetMonitor;
CDeviceDetectionConfig *mDevicesMonitorConfig;
public slots:
void WatchdogTimeoutTimerExpired();
};
#endif // CANWATCHDOG_H