Index: denali.pro.user =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- denali.pro.user (.../denali.pro.user) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ denali.pro.user (.../denali.pro.user) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -1,14 +1,14 @@ - + EnvironmentId {67370740-e20f-4fc6-be45-6652e866a8bf} ProjectExplorer.Project.ActiveTarget - 0 + 1 ProjectExplorer.Project.EditorSettings Index: scripts/wifi_generate_wpa_supplicant.sh =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- scripts/wifi_generate_wpa_supplicant.sh (.../wifi_generate_wpa_supplicant.sh) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ scripts/wifi_generate_wpa_supplicant.sh (.../wifi_generate_wpa_supplicant.sh) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -6,7 +6,7 @@ ctrl_interface_group=0 update_config=1 -network = { +network={ ssid=\"$ssid\" psk=\"$password\" }" > $dest Fisheye: Tag 2085962f7bd0a2239ee5c857928a11d5e38fe0a2 refers to a dead (removed) revision in file `scripts/wifi_get_auto_assigned_ip.sh'. Fisheye: No comparison available. Pass `N' to diff? Index: scripts/wifi_read_dns.sh =================================================================== diff -u --- scripts/wifi_read_dns.sh (revision 0) +++ scripts/wifi_read_dns.sh (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -0,0 +1,2 @@ +#!/bin/sh +cat /etc/resolv.conf | grep "nameserver" Index: scripts/wifi_read_gateway.sh =================================================================== diff -u --- scripts/wifi_read_gateway.sh (revision 0) +++ scripts/wifi_read_gateway.sh (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -0,0 +1,2 @@ +#!/bin/sh +ip route show | grep "default via" Index: scripts/wifi_read_ip_settings.sh =================================================================== diff -u --- scripts/wifi_read_ip_settings.sh (revision 0) +++ scripts/wifi_read_ip_settings.sh (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -0,0 +1,4 @@ +#!/bin/sh + +iface=$1 +ifconfig $iface | grep "inet " Index: scripts/wifi_request_auto_assigned_ip.sh =================================================================== diff -u --- scripts/wifi_request_auto_assigned_ip.sh (revision 0) +++ scripts/wifi_request_auto_assigned_ip.sh (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -0,0 +1,6 @@ +#!/bin/sh +iface=wlan0 +if [ $# -eq 1 ]; then + iface=$1 +fi +killall udhcpc; udhcpc -i $iface Index: scripts/wifi_reset_interface.sh =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- scripts/wifi_reset_interface.sh (.../wifi_reset_interface.sh) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ scripts/wifi_reset_interface.sh (.../wifi_reset_interface.sh) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -1,4 +1,4 @@ #!/bin/sh iface=$1 -ifdown $iface -ifup $iface +ifconfig $iface down +ifconfig $iface up Index: scripts/wifi_start_wpa_supplicant.sh =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- scripts/wifi_start_wpa_supplicant.sh (.../wifi_start_wpa_supplicant.sh) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ scripts/wifi_start_wpa_supplicant.sh (.../wifi_start_wpa_supplicant.sh) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -1,4 +1,4 @@ #!/bin/sh iface=$1 wpa_supplicant_path=$2 -killall wpa_supplicant; wpa_supplicant -i $iface -c $wpa_supplicant_path wext & disown +killall wpa_supplicant; wpa_supplicant -B -i $iface -c $wpa_supplicant_path wext Index: sources/gui/qml/pages/SettingsWifi.qml =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/gui/qml/pages/SettingsWifi.qml (.../SettingsWifi.qml) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/gui/qml/pages/SettingsWifi.qml (.../SettingsWifi.qml) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -76,6 +76,7 @@ } validator: ipValidator labelText: qsTr("IP Address: ") + textInput.text: vNetworkModel.ipAddress onEnterPressed: { console.log("IP Address: Enter pressed") _keyboard.setVisible(false) @@ -93,6 +94,7 @@ } validator: ipValidator labelText: qsTr("Gateway: ") + textInput.text: vNetworkModel.gateway onEnterPressed: { _keyboard.setVisible(false) } @@ -109,6 +111,7 @@ } validator: ipValidator labelText: qsTr("Subnet mask: ") + textInput.text: vNetworkModel.subnetMask onEnterPressed: { _keyboard.setVisible(false) } @@ -125,6 +128,7 @@ } validator: ipValidator labelText: qsTr("DNS: ") + textInput.text: vNetworkModel.dns onEnterPressed: { _keyboard.setVisible(false) } @@ -156,7 +160,7 @@ textColor: Colors.textMain textfontSize: Fonts.fontPixelTextRectExtra anchors { - top: parent.bottom + bottom: parent.bottom } } @@ -212,10 +216,8 @@ _joinNetwork.macAddress = macAddress _joinNetwork.visible = true } - } } } - } } Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -56,13 +56,15 @@ const char *Wifi_Scripts_Dir = "/home/root/"; #endif const char *Wifi_Generate_WPA_Supplicant = "wifi_generate_wpa_supplicant.sh"; - const char *Wifi_Get_Auto_Assigned_IP = "wifi_get_auto_assigned_ip.sh"; + const char *Wifi_Read_DNS = "wifi_read_dns.sh"; + const char *Wifi_Read_Gateway = "wifi_read_gateway.sh"; + const char *Wifi_Read_IP_Settings = "wifi_read_ip_settings.sh"; + const char *Wifi_Get_Auto_Assigned_IP = "wifi_request_auto_assigned_ip.sh"; const char *Wifi_Reset_Adapter = "wifi_reset_adapter.sh"; const char *Wifi_Reset_Interface = "wifi_reset_interface.sh"; const char *Wifi_Scan_For_Networks = "wifi_scan_for_networks.sh"; const char *Wifi_Set_Auto_Assigned_IP = "wifi_set_auto_assigned_ip.sh"; const char *Wifi_Set_DNS = "wifi_set_dns.sh"; const char *Wifi_Set_Static_IP = "wifi_set_static_ip.sh"; const char *Wifi_Start_WPA_Supplicant = "wifi_start_wpa_supplicant.sh"; - } Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -42,6 +42,9 @@ // Wifi extern const char *Wifi_Scripts_Dir; extern const char *Wifi_Generate_WPA_Supplicant; + extern const char *Wifi_Read_DNS; + extern const char *Wifi_Read_Gateway; + extern const char *Wifi_Read_IP_Settings; extern const char *Wifi_Get_Auto_Assigned_IP; extern const char *Wifi_Reset_Adapter; extern const char *Wifi_Reset_Interface; Index: sources/view/VNetworkModel.cpp =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -21,6 +21,9 @@ connect(&_WifiInterface, SIGNAL(didScanStatusChanged(const bool)), this, SLOT(onScanStatusChanged(const bool))); + connect(&_WifiInterface, SIGNAL(didConnectToNetwork(const Network)), + this, SLOT(onConnectedToNetwork(const Network))); + // outgoing connect(this, SIGNAL(didScan()), &_WifiInterface, SLOT(doScan())); @@ -42,6 +45,8 @@ beginInsertRows(QModelIndex(), rowCount(), rowCount()); _networks << vNetwork; endInsertRows(); + // For testing w/out a display: in main.qml call doScan() using Component.onCompleted, + // then call doJoinNetwork here when the desired network's mac address has been detected } /*! @@ -119,7 +124,6 @@ { if (!_networks.contains(vNetwork)) { - qDebug() << QString("Adding network with SSID: %1.").arg(vNetwork.ssid()); LOG_DEBUG(QString("Adding network with SSID: %1.").arg(vNetwork.ssid())); addNetwork(vNetwork); } @@ -175,3 +179,18 @@ } } } + +/*! + * \brief VNetworkModel::onConnectedToNetwork + * Called when we have connected to a network. + * \param vNetwork - (Network) the network we have connected to + */ +void VNetworkModel::onConnectedToNetwork(const Network &vNetwork) +{ + LOG_DEBUG(QString("Connected to %1.").arg(vNetwork.ssid())); + ipAddress(vNetwork.ipSettings().mIPAddress); + gateway(vNetwork.ipSettings().mGateway); + subnetMask(vNetwork.ipSettings().mSubnetMask); + dns(vNetwork.ipSettings().mDns); + status(tr("Connected to %1.").arg(vNetwork.ssid())); +} Index: sources/view/VNetworkModel.h =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/view/VNetworkModel.h (.../VNetworkModel.h) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/view/VNetworkModel.h (.../VNetworkModel.h) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -28,6 +28,10 @@ PROPERTY(bool , scanInProgress, false) PROPERTY(QString, status , "") + PROPERTY(QString, ipAddress , "") + PROPERTY(QString, gateway , "") + PROPERTY(QString, subnetMask , "") + PROPERTY(QString, dns , "") public: // Note: VIEW_DEC_CLASS(VNetworkModel) requires QObject as the parent, so it's necessary to define it here @@ -64,6 +68,7 @@ private slots: void onScanStatusChanged(const bool &vScanning); + void onConnectedToNetwork(const Network &vNetwork); }; } Index: sources/wifi/Network.h =================================================================== diff -u -rea52cee2614f319804690a9b1d5091bed9676753 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/wifi/Network.h (.../Network.h) (revision ea52cee2614f319804690a9b1d5091bed9676753) +++ sources/wifi/Network.h (.../Network.h) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -43,6 +43,14 @@ DISCONNECTING }; + struct IPSettings { + QString mIPAddress; + QString mGateway; + QString mSubnetMask; + QString mBroadcast; + QString mDns; + }; + bool operator==(const Network &d1) { if (ssid() == d1.ssid()) return true; @@ -109,6 +117,15 @@ return NO_SIGNAL; } + IPSettings ipSettings() const { + return _ipSettings; + } + + void ipSettings(const IPSettings &vIPSettings) { + _ipSettings = vIPSettings; + } + + explicit Network() {} explicit Network(const QString &vMacAddress) {_macAddress = vMacAddress; } explicit Network(const QString &vMacAddress, const QString &vSSID, const SECURITY_LEVEL &vSecurityLevel, const STATUS &vStatus, const int &vSignalLevel) { _macAddress = vMacAddress; @@ -124,5 +141,6 @@ SECURITY_LEVEL _security = UNSUPPORTED; SIGNAL_LEVEL _signalLevel = NO_SIGNAL; STATUS _status = NOT_CONNECTED; + IPSettings _ipSettings; }; Index: sources/wifi/WifiInterface.cpp =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -17,8 +17,11 @@ void WifiInterface::onInitConnections() { - connect(&_scanProcess, SIGNAL(finished(int, QProcess::ExitStatus)), + connect(&_processScan, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onScanFinished(int, QProcess::ExitStatus))); + + connect(this, SIGNAL(didFailToConnect(const QString)), + this, SLOT(onLogFailure(const QString))); } /*! @@ -88,10 +91,10 @@ } LOG_DEBUG("Scanning for Wifi Access Points..."); - _scanProcess.setWorkingDirectory(Wifi_Scripts_Dir); + _processScan.setWorkingDirectory(Wifi_Scripts_Dir); _scanRunning = true; emit didScanStatusChanged(_scanRunning); - _scanProcess.start(Wifi_Scan_For_Networks); + _processScan.start(Wifi_Scan_For_Networks); } @@ -104,8 +107,8 @@ void WifiInterface::onScanFinished(int vPid, QProcess::ExitStatus vExitStatus) { LOG_DEBUG(QString("%1: %2,%3").arg(__FUNCTION__).arg(vPid).arg(vExitStatus)); - QString out = _scanProcess.readAllStandardOutput(); - QString err = _scanProcess.readAllStandardError(); + QString out = _processScan.readAllStandardOutput(); + QString err = _processScan.readAllStandardError(); LOG_DEBUG(out); LOG_DEBUG(err); _scanRunning = false; @@ -117,12 +120,12 @@ * \brief Network::onParseWifiScan * Extract desired information from the wifi scan output. Sorts by signal stength * - * \param output - (QString) output collected from QProcess execution + * \param vOutput - (QString) output collected from QProcess execution */ -void WifiInterface::onParseWifiScan(const QString &output) +void WifiInterface::onParseWifiScan(const QString &vOutput) { QList networks; - QStringList temp = output.split("Cell"); + QStringList temp = vOutput.split("Cell"); const QString signalLevelSearchTerm = "Signal level="; const QString macAddressSearchTerm = "Address:"; const QString ssidSearchTerm = "ESSID:"; @@ -158,21 +161,202 @@ } /*! + * \brief WifiInterface::onLogFailure + * Ensures any failures reported are logged + * \param vMessage (QString) the message detail of the failure + */ +void WifiInterface::onLogFailure(const QString &vMessage) +{ + LOG_DEBUG(vMessage); +} + +/*! * \brief WifiInterface::doJoinNetwork * Handles request to join a network * \param vMacAddress - (QString) the mac address of the network to join * \param vPassword - (QString) the password for the network provided by the user */ void WifiInterface::doJoinNetwork(const Network &vNetwork, const QString &vPassword) { + LOG_DEBUG(QString("Joining Network %1").arg(vNetwork.ssid())); + _network = vNetwork; + if (!generateWPASupplicant(_network, vPassword)) + { + emit didFailToConnect("Could not configure network."); + return; + } - _wifiInterfaceProcess.start(Wifi_Generate_WPA_Supplicant, + if (!startWPASupplicant()) + { + emit didFailToConnect("Could not configure network."); + return; + } + + // TODO: Add option to setup with static IP settings instead + if (!requestAutoAssignedIP()) + { + emit didFailToConnect("Could not obtain IP Address."); + return; + } + + Network::IPSettings ipSettings; + QString output = readIPSettings(); + ipSettings.mIPAddress = parseIP(output); + ipSettings.mBroadcast = parseBroadcast(output); + ipSettings.mSubnetMask = parseSubnetMask(output); + ipSettings.mGateway = readGateway(); + ipSettings.mDns = readDNS(); + _network.ipSettings(ipSettings); + emit didConnectToNetwork(_network); +} + +/*! + * \brief WifiInterface::generateWPASupplicant + * Generates the WPA Supplicant configuration file + * \param vNetwork (Network) the network w/ ssid we want to connect to + * \param vPassword (QString) the password the user entered for this network + * \return (bool) true if writing the file completed, false otherwise + */ +bool WifiInterface::generateWPASupplicant(const Network &vNetwork, const QString &vPassword) +{ + LOG_DEBUG("Generating WPA Supplicant..."); + _processJoinNetwork.start(Wifi_Generate_WPA_Supplicant, QStringList() << vNetwork.ssid() << vPassword << _wpaSupplicantConfPath); + return _processJoinNetwork.waitForFinished(_defaultTimeout); +} - _wifiInterfaceProcess.start(Wifi_Start_WPA_Supplicant, +/*! + * \brief WifiInterface::startWPASupplicant + * Starts WPA supplicant in the background. Assumes the conf file has already been written + * \return true if successful, false on timeout + */ +bool WifiInterface::startWPASupplicant() +{ + LOG_DEBUG("Starting wpa supplicant..."); + _processJoinNetwork.start(Wifi_Start_WPA_Supplicant, QStringList() << _iface << _wpaSupplicantConfPath); + return _processJoinNetwork.waitForFinished(_defaultTimeout); +} +/*! + * \brief WifiInterface::requestAutoAssignedIP + * Requests an auto-assigned IP addressed + * \return true if successful, false on timeout + */ +bool WifiInterface::requestAutoAssignedIP() +{ + LOG_DEBUG("Requesting auto-assigned IP address..."); + _processJoinNetwork.start(Wifi_Get_Auto_Assigned_IP, + QStringList() << _iface); + return _processJoinNetwork.waitForFinished(_dhcpTimeout); } + +/*! + * \brief WifiInterface::readIPSettings + * Reads the IP settings of the device + * \return (QString) the unparsed standard output + */ +QString WifiInterface::readIPSettings() +{ + QString result = ""; + _processGetIPAddress.start(Wifi_Read_IP_Settings, + QStringList() << _iface); + if (_processGetIPAddress.waitForFinished(_defaultTimeout)) + result = _processGetIPAddress.readAllStandardOutput(); + LOG_DEBUG(QString("Output with IP address information: %1").arg(result)); + return result; +} + +/*! + * \brief WifiInterface::parseIP + * Parses the IP from the IP address output + * \param vOutput - (QString) the console output + * \return (QString) the IP Address only + */ +QString WifiInterface::parseIP(const QString &vOutput) +{ + if (vOutput.contains("inet addr:") && vOutput.contains("Bcast:")) + return vOutput.split("inet addr:")[1].split("Bcast:")[0].trimmed(); + return ""; +} + +/*! + * \brief WifiInterface::parseBroadcast + * Parses the Broadcast from the IP address output + * \param vOutput - (QString) the console output + * \return (QString) the Broadcast IP if found, "" otherwise + */ +QString WifiInterface::parseBroadcast(const QString &vOutput) +{ + if (vOutput.contains("Bcast:") && vOutput.contains("Mask:")) + return vOutput.split("Bcast:")[1].split("Mask:")[0].trimmed(); + return ""; +} + +/*! + * \brief WifiInterface::parseSubnetMask + * Parses the subnet mask from the provided output + * \param vOutput - (QString) the console output + * \return (QString) the subnet mask if found, "" otherwise + */ +QString WifiInterface::parseSubnetMask(const QString &vOutput) +{ + if (vOutput.contains("Mask:")) + return vOutput.split("Mask:")[1].trimmed(); + return ""; +} + +/*! + * \brief WifiInterface::parseGateway + * Parses the gateway from the provided output + * \param vOutput - (QString) the console output + * \return (QString) the gateway if found, "" otherwise + */ +QString WifiInterface::parseGateway(const QString &vOutput) +{ + if (vOutput.contains("default via")) + return vOutput.split("default via")[1].split("dev")[0].trimmed(); + return ""; +} + +/*! + * \brief WifiInterface::parseDNS + * Parses the DNS from the provided output + * \param vOutput - (QString) the console output + * \return (QString) the first DNS found, "" otherwise + */ +QString WifiInterface::parseDNS(const QString &vOutput) +{ + if (vOutput.contains("nameserver")) + return vOutput.split("nameserver")[1].split("\n")[0].trimmed(); + return ""; +} + +/*! + * \brief WifiInterface::readGateway + * Reads the current gateway + * \return (QString) the gateway if found, "" otherwise + */ +QString WifiInterface::readGateway() +{ + _processGetIPAddress.start(Wifi_Read_Gateway); + if (_processGetIPAddress.waitForFinished(_defaultTimeout)) + return parseGateway(_processGetIPAddress.readAllStandardOutput()); + return ""; +} + +/*! + * \brief WifiInterface::readDNS + * Reads the DNS setting + * \return (QString) the first dns found, "" otherwise + */ +QString WifiInterface::readDNS() +{ + _processGetIPAddress.start(Wifi_Read_DNS); + if (_processGetIPAddress.waitForFinished(_defaultTimeout)) + return parseDNS(_processGetIPAddress.readAllStandardOutput()); + return ""; +} Index: sources/wifi/WifiInterface.h =================================================================== diff -u -r5600d2133dd0ea6dc1f733aa78bd26e2a4892a38 -r2085962f7bd0a2239ee5c857928a11d5e38fe0a2 --- sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision 5600d2133dd0ea6dc1f733aa78bd26e2a4892a38) +++ sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision 2085962f7bd0a2239ee5c857928a11d5e38fe0a2) @@ -26,8 +26,12 @@ QThread *_thread = nullptr; bool _init = false; bool _scanRunning = false; - QProcess _scanProcess; - QProcess _wifiInterfaceProcess; + int _defaultTimeout = 5000; + int _dhcpTimeout = 10000; + QProcess _processScan; + QProcess _processJoinNetwork; + QProcess _processGetIPAddress; + Network _network; const QString _iface = "wlan0"; const QString _wpaSupplicantConfPath = "/etc/wpa_supplicant.conf"; @@ -37,6 +41,17 @@ SINGLETON(WifiInterface) private: + bool generateWPASupplicant(const Network &vNetwork, const QString &vPassword); + bool startWPASupplicant(); + bool requestAutoAssignedIP(); + QString readIPSettings(); + QString readGateway(); + QString readDNS(); + QString parseIP(const QString &vOutput); + QString parseBroadcast(const QString &vOutput); + QString parseSubnetMask(const QString &vOutput); + QString parseGateway(const QString &vOutput); + QString parseDNS(const QString &vOutput); void onInitConnections(); void onQuitThread(); void timerEvent(QTimerEvent* event); @@ -49,9 +64,12 @@ signals: void didAddNetwork(const Network); void didScanStatusChanged(const bool); + void didConnectToNetwork(const Network); + void didFailToConnect(const QString); private slots: void onQuit(); void onScanFinished(int, QProcess::ExitStatus); - void onParseWifiScan(const QString &output); + void onParseWifiScan(const QString &vOutput); + void onLogFailure(const QString &vMessage); };