YULTek/Otarcik_CAN/Sources/InternetMonitor.h

38 lines
783 B
C++

#ifndef INTERNETMONITOR_H
#define INTERNETMONITOR_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QTimer>
#define INTERNET_MONITOR_CONNECTION_TIMEOUT 2000
#define INTERNET_MONITOR_INET_CHECK_TIMEOUT 5000
class CInternetMonitor : public QObject
{
Q_OBJECT
public:
explicit CInternetMonitor(QObject *parent = 0);
~CInternetMonitor();
int Start();
bool IsInternetActive();
private:
QNetworkAccessManager *mNetMgr;
bool mInternetActive;
QTimer *mCheckInternetStateTimer, *mConnectionTimer;
int CheckInternet();
signals:
void InternetStateChanged(bool);
public slots:
void NetworkReqfinished(QNetworkReply *reply);
void CheckInternetTimerExpired();
void ConnectionTimerExpired();
};
#endif // INTERNETMONITOR_H