YULTek/Otarcik_CAN/Sources/LANDeviceMonitor.h
2024-03-05 16:29:13 -05:00

44 lines
957 B
C++

#ifndef LANDEVICEMONITOR_H
#define LANDEVICEMONITOR_H
#include <QObject>
#include "defines.h"
#include "LANDevicePresenceConfig.h"
#include <QProcess>
#include <QTimer>
#define LAN_DEVICE_MONITOR_PING_TIMEOUT 3000
#define LAN_DEVICE_MONITOR_PRESENCE_CHECK_TIMEOUT 5000
class CLANDeviceMonitor : public QObject
{
Q_OBJECT
public:
CLANDeviceMonitor(QString IPAddress, unsigned int CANBit, bool Active, QString Description = "");
~CLANDeviceMonitor();
quint64 GetDeviceCANStatusMask();
bool IsDeviceOnline();
private:
QTimer *mDevMonitorTimer;
QString mDeviceIPAddress;
unsigned int mCANStatusBit;
bool mIsDetectionActive;
QString mDeviceDescription;
bool mIsDeviceOnline;
QProcess *mPingProcess;
bool mIsPingInProgress;
int PingDevice();
public slots:
void MonitorTimeExpired();
void PingProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
};
#endif // LANDEVICEMONITOR_H