diff options
author | srimaldia <hariasti.srimaldia-1@jp.alps.com> | 2016-12-22 16:30:13 +0900 |
---|---|---|
committer | srimaldia <hariasti.srimaldia-1@jp.alps.com> | 2016-12-22 16:30:13 +0900 |
commit | fd1a08745b6f31225d31ec717a1cc772d9fb99c3 (patch) | |
tree | de119799fd3f1aa92d2d7e3d1c187b352e53f125 /app/wifi | |
parent | ffe543bf6a55d91ecc2fce50aa3747b6efd9e428 (diff) |
Revert GUI Wifi and Blouetooth to latest mergered
Change-Id: I9c8d36e9c4d9068e7c7bcb8834d84dd2cf810874
Signed-off-by: srimaldia <hariasti.srimaldia-1@jp.alps.com>
Diffstat (limited to 'app/wifi')
-rw-r--r-- | app/wifi/Wifi.qml | 154 |
1 files changed, 114 insertions, 40 deletions
diff --git a/app/wifi/Wifi.qml b/app/wifi/Wifi.qml index f5fdae1..e0ae950 100644 --- a/app/wifi/Wifi.qml +++ b/app/wifi/Wifi.qml @@ -66,6 +66,96 @@ SettingPage { id: networkList } + Rectangle { + id: buttonNetworkList + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.margins: 10 + width: buttonNetworkListText.width + 10 + height: buttonScanText.height + 10 + border.width: buttonNetworkListMouseArea.pressed ? 2 : 1 + radius: 5 + antialiasing: true + color: "#222" + border.color: "white" + Text { + color: "white" + id: buttonNetworkListText + anchors.centerIn: parent + text: "GET NETWORK LIST" + font.pixelSize: 40 + } + ListModel { + id: listModel + } + MouseArea { + id: buttonNetworkListMouseArea + anchors.fill: parent + onClicked: { + log.text = "" + console.log("\n") + networkList.clear() + request(wifiAPIpath + 'scan_result', function (o) { + // log the json response + console.log(o.responseText) + // translate response into object + var jsonObject = eval('(' + o.responseText + ')') + var jsonObjectNetworks = eval( + '(' + JSON.stringify(jsonObject.response) + ')') + //console.log(jsonObject.response) + for (var i = 0; i < jsonObjectNetworks.length; i++) { + networkList.append({ + number: jsonObjectNetworks[i].Number, + name: jsonObjectNetworks[i].ESSID, + strength: jsonObjectNetworks[i].Strength, + serviceState: jsonObjectNetworks[i].State, + security: jsonObjectNetworks[i].Security, + address: jsonObjectNetworks[i].IPAddress + }) + console.log(jsonObjectNetworks[i].Number, + jsonObjectNetworks[i].ESSID, + jsonObjectNetworks[i].Strength, + jsonObjectNetworks[i].State, + jsonObjectNetworks[i].Security, + jsonObjectNetworks[i].IPAddress) + } + }) + } + } + } + Rectangle { + id: buttonScan + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.margins: 80 + width: buttonScanText.width + 10 + height: buttonScanText.height + 10 + border.width: mouseArea.pressed ? 2 : 1 + //radius: 5 + //antialiasing: true + //color: "black" + color: "#222" + border.color: "white" + Text { + id: buttonScanText + anchors.centerIn: parent + text: "SCAN" + color: "white" + font.pixelSize: 40 + } + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + log.text = "" + console.log("\n") + request(wifiAPIpath + 'scan', function (o) { + // log the json response + console.log(o.responseText) + }) + } + } + } function request(url, callback) { var xhr = new XMLHttpRequest() xhr.onreadystatechange = (function (myxhr) { @@ -89,15 +179,15 @@ SettingPage { Component { id: wifiDevice Rectangle { - height: 120 + height: 150 width: parent.width - color: "transparent" + color: "#222" Image { - + anchors.top: parent.top + anchors.topMargin: 7 anchors.left: parent.left - anchors.leftMargin: 80 - //width: 70 - //height: 50 + width: 70 + height: 50 id: icon source: { if (securityType(security) === "unsecured") { @@ -123,12 +213,10 @@ SettingPage { } Column { anchors.left: icon.right - anchors.leftMargin: 5 + anchors.leftMargin: 10 Text { - id: networkNameText text: name - color: '#66FF99' - font.pixelSize: 48 + font.pointSize: 30 font.bold: { if ((serviceState === "ready") || serviceState === "online") @@ -136,23 +224,28 @@ SettingPage { else font.bold = false } + color: { + if ((serviceState === "ready") + || serviceState === "online") + color = "#00ff00" + else + color = "#ffffff" + } } Text { visible: ((serviceState === "ready") || serviceState === "online") ? true : false text: "connected, " + address font.pointSize: 18 - color: "white" - //font.italic: true + color: "#ffffff" + font.italic: true } } Button { id: connectButton anchors.top: parent.top - anchors.topMargin: 5 - //anchors.horizontalCenter: networkNameText.horizontalCenter - anchors.rightMargin: 50 anchors.right: parent.right + anchors.rightMargin: 5 width: 250 MouseArea { @@ -208,13 +301,14 @@ SettingPage { Button { id: passwordButton anchors.top: parent.top - anchors.topMargin: 5 - anchors.right: connectButton.right + anchors.right: parent.right width: 40 visible: (securityType(security) === "unsecured") ? false : true + //anchors.rightMargin: connectButton.width + 5 + //buttonText: "Connect" text: { - "Key" + "Key" //or some icon? } MouseArea { @@ -241,7 +335,6 @@ SettingPage { Button { id: passwordValidateButton anchors.top: parent.top - anchors.topMargin: 5 anchors.right: parent.right anchors.rightMargin: connectButton.width + 5 width: 40 @@ -280,35 +373,17 @@ SettingPage { TextInput { id: passwordInputText anchors.top: parent.top - anchors.topMargin: 10 anchors.right: parent.right - anchors.rightMargin: 0 - readOnly: false - //horizontalAlignment: TextInput.AlignHCenter - //verticalAlignment: TextInput.AlignVCenter - + anchors.rightMargin: 5 font.pointSize: 15 color: "#ffffff" width: connectButton.width visible: false - text: "password" - /*hardcore until virtual keyboard works*/ - } - - Image { - source: '../images/HMI_Settings_DividingLine.svg' - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: -15 - - visible: model.index > 0 + text: "nttdatamse" } - } - - } ListView { width: parent.width @@ -321,7 +396,6 @@ SettingPage { clip: true } - //Timer for periodic refresh; this is BAD solution, need to figure out how to subscribe for events Timer { id: periodicRefresh |