Index: sources/device/DeviceController.cpp =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -1022,15 +1022,15 @@ ////////////////////////////////////////////////////////////////////////////////////////////////// DeviceWifiInfo void DeviceController::onAttributeRequest(const DeviceWifiInfoRequestData &) { - doGetWifiInfo(); + wifiInfoRequest(); } /*! - * \brief DeviceController::doGetWifiInfo + * \brief DeviceController::wifiInfoRequest * \details Calls the Wifi Info script * \note This function is created to be able to call independently if needed in this class. */ -void DeviceController::doGetWifiInfo() +void DeviceController::wifiInfoRequest() { // ----- check that script exists. QString script; @@ -1079,11 +1079,17 @@ ////////////////////////////////////////////////////////////////////////////////////////////////// DeviceConnectWifi +void DeviceController::onAttributeRequest(const DeviceConnectWifiRequestData &vData) +{ + connectWifiRequest(vData); +} + /*! - * \brief DeviceController::onAttributeRequest + * \brief DeviceController::connectWifiRequest * \details Calls the Wifi connect/ disconnect script + * \note This function is created to be able to call independently if needed in this class. */ -void DeviceController::onAttributeRequest(const DeviceConnectWifiRequestData &vData) +void DeviceController::connectWifiRequest(const DeviceConnectWifiRequestData &vData) { DeviceError::Scripts_Error_Enum error = DeviceError::eDevice_OK; Index: sources/device/DeviceController.h =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceController.h (.../DeviceController.h) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -232,7 +232,6 @@ void quit(); void doScreenshot(const QImage &vImage, const QString &vFileName); - void doGetWifiInfo(); private slots: void onScreenshot(const QImage &vImage, const QString &vFileName); @@ -447,6 +446,8 @@ // ----- WiFi void wifiListRequest(); + void wifiInfoRequest(); + void connectWifiRequest(const DeviceConnectWifiRequestData &vData); SAFE_CALL_EX2(doAddWatch, const QString &, bool) }; Index: sources/device/DeviceError.cpp =================================================================== diff -u -raa9ba5a44d2015929643dee0b505f19f471594de -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision aa9ba5a44d2015929643dee0b505f19f471594de) +++ sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -57,6 +57,7 @@ QT_TR_NOOP("The WiFi scan failed." ), // eDevice_WifiList_Error QT_TR_NOOP("The WiFi info failed." ), // eDevice_WifiInfo_Error QT_TR_NOOP("The Connect WiFi failed." ), // eDevice_ConnectWifi_Error + QT_TR_NOOP("The Disconnect WiFi failed." ), // eDevice_DisconnectWifi_Error QT_TR_NOOP("The USB Mount failed." ), // eDevice_USBMount_Error }; Index: sources/device/DeviceError.h =================================================================== diff -u -raa9ba5a44d2015929643dee0b505f19f471594de -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceError.h (.../DeviceError.h) (revision aa9ba5a44d2015929643dee0b505f19f471594de) +++ sources/device/DeviceError.h (.../DeviceError.h) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -75,6 +75,7 @@ eDevice_WifiList_Error , eDevice_WifiInfo_Error , eDevice_ConnectWifi_Error , + eDevice_DisconnectWifi_Error , eDevice_USBMount_Error , eDevice_Error_End Index: sources/device/DeviceModels.cpp =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -290,7 +290,7 @@ // apply returned value in case the passed value is valid (type, range) // regardless of the exit code (success, fail) lApply: - _data.mWifiInfo= val; + _data.mWifiInfo = val; goto lOut; // immediate exit on fail exitcode and invalid returned value. @@ -320,12 +320,14 @@ ok = true; // check if the vExitCode passed and it has a value other than zero - if ( ! ok ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Type ; goto lError; } // there is not a valid value - if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_ConnectWifi_Error ; goto lApply; } // there still a valid value + if ( ! ok ){ _data.mReason = Device::DeviceError::eDevice_Scripts_Error_Incorrect_Rsp_Type ; goto lError; } // there is not a valid value + if ( vExitCode && *vExitCode ){ _data.mReason = _data.mConnect ? Device::DeviceError::eDevice_ConnectWifi_Error : + Device::DeviceError::eDevice_DisconnectWifi_Error; goto lApply; } // there still a valid value // Now everything is good to extract the data _data.mAccepted = true; - _data.mMessage = QObject::tr("The WiFi (Dis)Connection is complete.") ; goto lOut ; // normal return + _data.mMessage = _data.mConnect ? QObject::tr("The WiFi Connection is complete.") : + QObject::tr("The WiFi Disconnection is complete.") ; goto lOut ; // normal return // apply returned value in case the passed value is valid (type, range) // regardless of the exit code (success, fail) Index: sources/device/DeviceView.cpp =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -31,8 +31,6 @@ DEVICE_VIEW_INIT_CONNECTIONS_LIST connect(&_DeviceController , SIGNAL(didPOSTOSVersionData(QString)), this , SLOT( onPOSTOSVersionData(QString))); - connect(this , SIGNAL(didGetWifiInfo()), - &_DeviceController , SLOT( doGetWifiInfo())); } // ================================================================================================== @@ -271,10 +269,6 @@ void VDevice::wifiListRequest(const QStringList &) { status( "" ); - ipAddress(""); - gateway(""); - subnetMask(""); - dns(""); wifiList({}); dataClear(); wifiListEnabled(false); @@ -440,11 +434,6 @@ data.mWifiSupported = ssid.mSupported; data.mWifiConnected = ssid.mInUse ; - if (ssid.mInUse ) { - // called to get wifi info once we are connected - emit didGetWifiInfo(); - } - dataAppend( data, ssid.mInUse, ssid.mSupported); } } @@ -493,20 +482,15 @@ // ================================================= WifiInfo void VDevice::doInitWifiInfo() { + wifiInfoRequest({}); +} + +void VDevice::wifiInfoRequest(const QStringList &) { DeviceWifiInfoRequestData data; wifiInfo({}); - ipAddress(""); - gateway(""); - subnetMask(""); - dns(""); - emit didAttributeRequest(data); } -void VDevice::wifiInfoRequest(const QStringList &) { - // Nothing to be done here. This property will not be assigned. -} - void VDevice::onAttributeResponse(const DeviceWifiInfoResponseData &vData) { if ( vData.mCompleted ) { @@ -538,19 +522,23 @@ eIPADDRESS , eSUBNETMASK , eGATEWAY , - eDNS1 , - eDNS2 , + eDNS , }; QString mResult = vResult; QStringList fields = mResult.split(','); + ssid(fields[eSSID].trimmed()); ipAddress(fields[eIPADDRESS].trimmed()); subnetMask(fields[eSUBNETMASK].trimmed()); gateway(fields[eGATEWAY].trimmed()); - dns(fields[eDNS2].isEmpty() ? fields[eDNS1].trimmed() : - QStringLiteral("%1,\n%2").arg(fields[eDNS1].trimmed()) - .arg(fields[eDNS2].trimmed())); + QString dnsString = fields[eDNS]; + // Iterate from index 5 to the end to get any extra DNS + for (int i = 5; i < fields.size(); ++i) { + qDebug() << fields.at(i); + dnsString.append(QStringLiteral(",\n%1").arg(fields.at(i))); + } + dns(dnsString.trimmed()); } // ================================================= ConnectWifi @@ -586,6 +574,14 @@ doInitWifiList(); connectWifi(true); status(vData.mConnect ? "WiFi Connected" : "WiFi Disconnected"); + + if ( !vData.mConnect ) { + ssid(""); + ipAddress(""); + gateway(""); + subnetMask(""); + dns(""); + } } } Index: sources/device/DeviceView.h =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/device/DeviceView.h (.../DeviceView.h) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -127,6 +127,7 @@ ATTRIBUTE ( QStringList , wifiList , {}, WifiList ) READONLY ( bool , wifiListEnabled , true ) ATTRIBUTE ( QStringList , wifiInfo , {}, WifiInfo ) + READONLY ( QString , ssid , "" ) READONLY ( QString , ipAddress , "" ) READONLY ( QString , gateway , "" ) READONLY ( QString , subnetMask , "" ) @@ -141,9 +142,6 @@ private slots: void onPOSTOSVersionData (const QString &vOSVersion); -signals: - void didGetWifiInfo (); - private: void parseWifiListResult(const QString &vResult); void parseWifiInfoResult(const QString &vResult); Index: sources/gui/qml/components/ScreenItem.qml =================================================================== diff -u -r25c40729f182b567f22e01a4c6f3eda7ccaac04d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/gui/qml/components/ScreenItem.qml (.../ScreenItem.qml) (revision 25c40729f182b567f22e01a4c6f3eda7ccaac04d) +++ sources/gui/qml/components/ScreenItem.qml (.../ScreenItem.qml) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -28,7 +28,7 @@ visible: false width : Variables.applicationWidth - height : Variables.applicationHeight - 100 // FIXME: Temporary fix for the headerbar offsetting other UI components + height : Variables.applicationHeight Rectangle { id: _backgroundRect anchors.fill: parent Index: sources/gui/qml/components/StackItem.qml =================================================================== diff -u -rc67cfed33e2ecc3592f6e2137c12af275cecd769 -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision c67cfed33e2ecc3592f6e2137c12af275cecd769) +++ sources/gui/qml/components/StackItem.qml (.../StackItem.qml) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -29,6 +29,9 @@ visible: false + width : Variables.applicationWidth + height: Variables.applicationHeight + /*! * \brief prints out the list of the items in the stack by their index position in the stack. */ Index: sources/gui/qml/main.qml =================================================================== diff -u -rbf5b9b7cb86aaf3c4ec85e4ef0b92cba0e836634 -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/gui/qml/main.qml (.../main.qml) (revision bf5b9b7cb86aaf3c4ec85e4ef0b92cba0e836634) +++ sources/gui/qml/main.qml (.../main.qml) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -263,9 +263,7 @@ // ----- Follow the below Z order ----- // 1 - Screens // 1 - 1 - SettingsStack { id: _settingsStack - anchors.top : _headerBar.bottom - } + SettingsStack { id: _settingsStack } // FIXME: BEHROUZ - anchors.top : _headerbar.bottom or add topMargin to all stacks // 1 - 2 ManagerStack { id: _managerStack } // 1 - 3 @@ -301,7 +299,6 @@ // 9 - Others Rectangle { //TODO:@LEAHI: make this the statusbar/headerbar component. - id: _headerBar anchors.top: parent.top width : Variables.applicationWidth height : Variables.notificationHeight Index: sources/gui/qml/pages/settings/SettingsBase.qml =================================================================== diff -u -rc67cfed33e2ecc3592f6e2137c12af275cecd769 -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/gui/qml/pages/settings/SettingsBase.qml (.../SettingsBase.qml) (revision c67cfed33e2ecc3592f6e2137c12af275cecd769) +++ sources/gui/qml/pages/settings/SettingsBase.qml (.../SettingsBase.qml) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -87,6 +87,7 @@ Text { id: _titleText anchors { top : _root.top + topMargin : topMarginTitle horizontalCenter: parent.horizontalCenter } horizontalAlignment : Text.AlignHCenter Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -rce0f73ee6ec5596888ce00ca6bcd94ee5c4f322d -rf0c8b8720a2e314268445a4a20fe701292026f6f --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision ce0f73ee6ec5596888ce00ca6bcd94ee5c4f322d) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision f0c8b8720a2e314268445a4a20fe701292026f6f) @@ -61,6 +61,15 @@ anchors.left : parent.left anchors.leftMargin : _root.leftMargin + TextEntry { id : _ssid + nextInput : _ipAddress // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. + textInput.text : vDevice.ssid + label.text : qsTr("SSID") + textInput.width : entryWidth + label.width : labelWidth + hasCursor : false // set false for now to disable the static IP entry for phase 1 + } + TextEntry { id : _ipAddress nextInput : _gateway // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. textInput.text : vDevice.ipAddress @@ -98,32 +107,9 @@ label.width : labelWidth label.text : qsTr("DNS") hasCursor : false // set false for now to disable the static IP entry for phase 1 - validator : ipValidator } } - Row { id : _ssidRow - anchors.top : _ipColumn.bottom - anchors.topMargin : 50 - anchors.left : parent.left - anchors.leftMargin : _root.leftMargin - Text { id : _ssidLabel - font.pixelSize : Fonts.fontPixelTextRectExtra - color : Colors.textMain - horizontalAlignment : TextInput.Alignleft - width : labelWidth - text : qsTr("SSID") - } - - Text { id : _ssidText - font.pixelSize : Fonts.fontPixelTextRectExtra - color : Colors.textMain - horizontalAlignment : TextInput.Alignleft - text : "" - width : entryWidth - } - } - TouchRect { id : _scanButton anchors.bottom : parent.bottom anchors.bottomMargin: Variables.mainMenuHeight * 2 + Variables.minVGap @@ -156,8 +142,7 @@ readonly property bool isConnected : wifiConnected onIsConnectedChanged: { if ( isConnected ) { - _ssidText.text = wifiSsid - vDevice.status = "WiFi Connected to " + wifiSsid + vDevice.doInitWifiInfo() } } @@ -229,13 +214,4 @@ } } } - - Connections { target: vDevice - // slot to clear SSID when wifi list scan starts - function onWifiListEnabledChanged ( vValue ) { - if (!vValue) { - _ssidText.text = "" - } - } - } }