From be915d3cfcc639d6303bf8bc0e5ad825e0ef2f95 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 5 Oct 2011 17:39:35 +0200 Subject: modified the check for carrier signal. on autoUp==true: if no interface is in running state, the app will check the state of the interface several times (can be specified by us with the _ifUpCountdown value) --- LogReceiver/networkdiscovery.h | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'LogReceiver/networkdiscovery.h') diff --git a/LogReceiver/networkdiscovery.h b/LogReceiver/networkdiscovery.h index 4a9bc3c..8b9359c 100644 --- a/LogReceiver/networkdiscovery.h +++ b/LogReceiver/networkdiscovery.h @@ -1,10 +1,8 @@ #ifndef NetworkDiscovery_H #define NetworkDiscovery_H -//#include #include #include -//#include #include #include @@ -14,28 +12,19 @@ #include #include - - #include "interfaceconfiguration.h" #include "networkmanager.h" +#include "sleeper.h" + +#include "../common/fbgui.h" + #include "status.h" #include "dhcp.h" #include "interface.h" -//#include -//#include -//#include -//#include -//#include -#include -//#include -#include -#define DEFAULT_QTSOCKETADDRESS "/var/tmp/qt_c_socket_default" -#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/customdhcpcd/src/customdhcpcd" -#define DEFAULT_GATEWAY_INFO_LOCATION "/var/tmp/gateways_" -#define ACK_SIZE 4 +#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/customdhcpcd/src/build/cdhcpcd" class NetworkDiscovery: public QObject { Q_OBJECT @@ -45,6 +34,8 @@ public: ~NetworkDiscovery(); void initAndRun(QString serverIp, bool userChoice, + bool autoUp, + QString pathToLogFile, QString serverPath = DEFAULT_QTSOCKETADDRESS, QString pathToExe = DEFAULT_PATHTODHCPCDEXE, QStringList* args = NULL); @@ -53,6 +44,7 @@ public: QString getGatewayForInterface(QString ifName); int ip4_setManualConfiguration(QVariantMap result); + QString readLogFile(); private slots: void handleNewConnection(); @@ -62,6 +54,11 @@ private slots: void handleProcessStarted(); void handleClientDisconnect(); + void slotReadyForRun(); + + void checkForIsRunning(); + + signals: void addInterface(const QString &ifName); void changeProgressBarValue(const QString & ifName, const int $newValue); @@ -72,6 +69,8 @@ signals: void continueBoot(QString ifName, int userChoice); void setManualConfInterfaces(QString jsonArr); + void readyForRun(); + private: QLocalServer *_server; QMap _clients; @@ -84,7 +83,14 @@ private: NetworkManager _networkManager; bool _userChoice; bool _blocked; + bool _autoUp; QString _serverIp; + QString _pathToLogFile; + QList _ifUpList; + QList _ifDownList; + QMap _ifMap; + int _ifUpCountdown; + QTimer* _timer; QMap _ifcMap; @@ -94,12 +100,14 @@ private: void runDHCPCD(QString interface); QListcheckCarrierState(QList &interfaces); bool checkCarrierState(QString interface); - bool checkForIsRunning(QNetworkInterface networkInterface); bool checkConnectivity(QString ifName); bool checkConnectivityViaTcp(QString server); QList getListOfNetworkInterfaces(); bool checkBlackList(QString i); + QList getListOfNetworkInterfacesWithAutoUp(); + + }; #endif // NetworkDiscovery_H -- cgit v1.2.3-55-g7522