40 lines
877 B
C++
40 lines
877 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(quint64 CANReportingBit);
|
|
bool IsInternetActive();
|
|
quint64 GetCANInternetStatusMask();
|
|
|
|
private:
|
|
QNetworkAccessManager *mNetMgr;
|
|
bool mInternetActive;
|
|
QTimer *mCheckInternetStateTimer, *mConnectionTimer;
|
|
quint64 mCANReportingMask;
|
|
|
|
int CheckInternet();
|
|
|
|
signals:
|
|
|
|
void InternetStateChanged(bool);
|
|
|
|
public slots:
|
|
void NetworkReqfinished(QNetworkReply *reply);
|
|
void CheckInternetTimerExpired();
|
|
void ConnectionTimerExpired();
|
|
};
|
|
|
|
#endif // INTERNETMONITOR_H
|