Add WiFi scan results page
This commit is contained in:
@@ -20,17 +20,17 @@ find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick WebSockets LinguistTools)
|
||||
qt_standard_project_setup(REQUIRES 6.6 I18N_TRANSLATED_LANGUAGES de)
|
||||
|
||||
qt_add_executable(evcharger-app WIN32 MACOSX_BUNDLE
|
||||
apikeyvaluehelper.cpp
|
||||
apikeyvaluehelper.h
|
||||
appsettings.cpp
|
||||
appsettings.h
|
||||
deviceconnection.cpp
|
||||
deviceconnection.h
|
||||
devicesmodel.cpp
|
||||
devicesmodel.h
|
||||
main.cpp
|
||||
sendmessagehelper.cpp
|
||||
sendmessagehelper.h
|
||||
apikeyvaluehelper.cpp
|
||||
apikeyvaluehelper.h
|
||||
appsettings.cpp
|
||||
appsettings.h
|
||||
deviceconnection.cpp
|
||||
deviceconnection.h
|
||||
devicesmodel.cpp
|
||||
devicesmodel.h
|
||||
main.cpp
|
||||
sendmessagehelper.cpp
|
||||
sendmessagehelper.h
|
||||
)
|
||||
|
||||
qt6_add_translations(evcharger-app
|
||||
@@ -121,6 +121,7 @@ qt_add_qml_module(evcharger-app
|
||||
WiFiErrorsPage.qml
|
||||
WiFiOnOffSwitch.qml
|
||||
WiFiPage.qml
|
||||
WiFiScanPage.qml
|
||||
RESOURCES
|
||||
icons/Charger.svg
|
||||
icons/ChargerV3.svg
|
||||
|
@@ -126,19 +126,19 @@ StackView {
|
||||
}
|
||||
|
||||
source: {
|
||||
if (devicetype.value == 'go-eCharger_V5' ||
|
||||
devicetype.value == 'go-eCharger_V4')
|
||||
if (devicetype.value == "go-eCharger_V5" ||
|
||||
devicetype.value == "go-eCharger_V4")
|
||||
{
|
||||
if (isgo.value)
|
||||
return "images/geminiFlex.png"
|
||||
else
|
||||
return "images/geminiFix.png"
|
||||
} else if (devicetype.value == 'wattpilot_V2') {
|
||||
} else if (devicetype.value == "wattpilot_V2") {
|
||||
return "images/wattpilot.png"
|
||||
} else if (devicetype.value == 'go-eCharger' ||
|
||||
devicetype.value == 'wattpilot') {
|
||||
} else if (devicetype.value == "go-eCharger" ||
|
||||
devicetype.value == "wattpilot") {
|
||||
return "images/homeFix.png"
|
||||
} else if (devicetype.value == 'go-eCharger_Phoenix') {
|
||||
} else if (devicetype.value == "go-eCharger_Phoenix") {
|
||||
return "images/phoenix.png"
|
||||
}
|
||||
|
||||
|
@@ -170,17 +170,17 @@ StackView {
|
||||
height: parent.height
|
||||
//Layout.fillHeight: true
|
||||
source: {
|
||||
if (delegate.deviceType == 'go-eCharger_V5' ||
|
||||
delegate.deviceType == 'go-eCharger_V4' ||
|
||||
delegate.deviceType == 'wattpilot_V2')
|
||||
if (delegate.deviceType == "go-eCharger_V5" ||
|
||||
delegate.deviceType == "go-eCharger_V4" ||
|
||||
delegate.deviceType == "wattpilot_V2")
|
||||
{
|
||||
return "icons/ChargerV4.svg"
|
||||
} else if (delegate.deviceType == 'go-eCharger' ||
|
||||
delegate.deviceType == 'wattpilot') {
|
||||
} else if (delegate.deviceType == "go-eCharger" ||
|
||||
delegate.deviceType == "wattpilot") {
|
||||
return "icons/ChargerV3.svg"
|
||||
} else if (delegate.deviceType == 'go-eCharger_Phoenix') {
|
||||
} else if (delegate.deviceType == "go-eCharger_Phoenix") {
|
||||
return "icons/Charger.svg"
|
||||
} else if (delegate.deviceType.includes('controller')) {
|
||||
} else if (delegate.deviceType.includes("controller")) {
|
||||
return "icons/Controller.svg"
|
||||
}
|
||||
}
|
||||
@@ -293,6 +293,7 @@ StackView {
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Solala")
|
||||
onClicked: deviceSelected("wss://solalaweb.com/" + delegate.serial, delegate.password)
|
||||
visible: theSettings.showSolalaweb
|
||||
}
|
||||
}
|
||||
|
@@ -180,12 +180,12 @@ NavigationPage {
|
||||
text: {
|
||||
switch (updateStatus.value)
|
||||
{
|
||||
case 0: return 'Idle'
|
||||
case 1: return 'Updating'
|
||||
case 2: return 'Failed'
|
||||
case 3: return 'Succeeded'
|
||||
case 4: return 'NotReady'
|
||||
case 5: return 'Verifying'
|
||||
case 0: return "Idle"
|
||||
case 1: return "Updating"
|
||||
case 2: return "Failed"
|
||||
case 3: return "Succeeded"
|
||||
case 4: return "NotReady"
|
||||
case 5: return "Verifying"
|
||||
default: return updateStatus.value
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ NavigationPage {
|
||||
apiKey: "ocl"
|
||||
}
|
||||
|
||||
text: updateProgress.value + ' / ' + updateLength.value
|
||||
text: updateProgress.value + " / " + updateLength.value
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
|
@@ -47,12 +47,12 @@ ColumnLayout {
|
||||
|
||||
const hours = duration%24;
|
||||
|
||||
return (wasNegative ? qsTr('%0 ago') : qsTr('in %0'))
|
||||
return (wasNegative ? qsTr("%0 ago") : qsTr("in %0"))
|
||||
.arg(
|
||||
(hours < 10 ? '0' : '') + hours + ':' +
|
||||
(minutes < 10 ? '0' : '') + minutes + ':' +
|
||||
(seconds < 10 ? '0' : '') + seconds + '.' +
|
||||
(milliseconds < 100 ? '0' : '') + (milliseconds < 10 ? '0' : '') + milliseconds)
|
||||
(hours < 10 ? "0" : "") + hours + ":" +
|
||||
(minutes < 10 ? "0" : "") + minutes + ":" +
|
||||
(seconds < 10 ? "0" : "") + seconds + "." +
|
||||
(milliseconds < 100 ? "0" : "") + (milliseconds < 10 ? "0" : "") + milliseconds)
|
||||
;
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ ItemDelegate {
|
||||
|
||||
Component.onCompleted: {
|
||||
background.radius = 5
|
||||
background.color = 'white'
|
||||
background.color = "white"
|
||||
}
|
||||
|
||||
onClicked: stackView.push(navigationItem.component)
|
||||
|
@@ -16,7 +16,7 @@ Text {
|
||||
if (request.response.type == "response") {
|
||||
if (request.response.success)
|
||||
return "OK"
|
||||
if ('message' in request.response)
|
||||
if ("message" in request.response)
|
||||
return request.response.message
|
||||
}
|
||||
return JSON.stringify(request.response)
|
||||
|
@@ -31,7 +31,7 @@ NavigationPage {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: '>'
|
||||
text: ">"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ ItemDelegate {
|
||||
|
||||
Component.onCompleted: {
|
||||
background.radius = 5
|
||||
background.color = 'white'
|
||||
background.color = "white"
|
||||
contentItem.children[0].color = navigationItem.color
|
||||
}
|
||||
|
||||
|
34
WiFiPage.qml
34
WiFiPage.qml
@@ -29,23 +29,35 @@ NavigationPage {
|
||||
text: {
|
||||
switch (staStatus.value)
|
||||
{
|
||||
case 0: return 'IDLE_STATUS'
|
||||
case 1: return 'NO_SSID_AVAIL'
|
||||
case 2: return 'SCAN_COMPLETED'
|
||||
case 3: return 'CONNECTED'
|
||||
case 4: return 'CONNECT_FAILED'
|
||||
case 5: return 'CONNECTION_LOST'
|
||||
case 6: return 'DISCONNECTED'
|
||||
case 7: return 'CONNECTING'
|
||||
case 8: return 'DISCONNECTING'
|
||||
case 9: return 'NO_SHIELD'
|
||||
case 10: return 'WAITING_FOR_IP'
|
||||
case 0: return "IDLE_STATUS"
|
||||
case 1: return "NO_SSID_AVAIL"
|
||||
case 2: return "SCAN_COMPLETED"
|
||||
case 3: return "CONNECTED"
|
||||
case 4: return "CONNECT_FAILED"
|
||||
case 5: return "CONNECTION_LOST"
|
||||
case 6: return "DISCONNECTED"
|
||||
case 7: return "CONNECTING"
|
||||
case 8: return "DISCONNECTING"
|
||||
case 9: return "NO_SHIELD"
|
||||
case 10: return "WAITING_FOR_IP"
|
||||
default: return staStatus.value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
ApiKeyValueHelper {
|
||||
id: wifiScanResult
|
||||
deviceConnection: mainScreen.deviceConnection
|
||||
apiKey: "scan"
|
||||
}
|
||||
|
||||
text: qsTr("(%0) Wi-Fi Scan").arg(wifiScanResult.value == null ? 0 : wifiScanResult.value.length)
|
||||
onClicked: stackView.push("WiFiScanPage.qml", {wifiScanResult} )
|
||||
enabled: wifiScanResult.value != null
|
||||
}
|
||||
|
||||
Button {
|
||||
ApiKeyValueHelper {
|
||||
id: wifiErrorLog
|
||||
|
122
WiFiScanPage.qml
Normal file
122
WiFiScanPage.qml
Normal file
@@ -0,0 +1,122 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import EVChargerApp
|
||||
|
||||
BaseNavigationPage {
|
||||
property ApiKeyValueHelper wifiScanResult
|
||||
|
||||
title: qsTr("Wi-Fi Scan Result")
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
model: wifiScanResult.value
|
||||
spacing: 5
|
||||
clip: true
|
||||
|
||||
delegate: WhiteBox {
|
||||
required property var modelData
|
||||
property var theModelData: modelData
|
||||
|
||||
width: listView.width
|
||||
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
|
||||
Text {
|
||||
text: qsTr("SSID:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.ssid
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Authmode:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: {
|
||||
switch (modelData.encryptionType)
|
||||
{
|
||||
case 0: return qsTr("OPEN")
|
||||
case 1: return qsTr("WEP")
|
||||
case 2: return qsTr("WPA_PSK")
|
||||
case 3: return qsTr("WPA2_PSK")
|
||||
case 4: return qsTr("WPA_WPA2_PSK")
|
||||
case 5: return qsTr("WPA2_ENTERPRISE")
|
||||
case 6: return qsTr("WPA3_PSK")
|
||||
case 7: return qsTr("WPA2_WPA3_PSK")
|
||||
case 8: return qsTr("WAPI_PSK")
|
||||
case 9: return qsTr("OWE")
|
||||
case 10: return qsTr("WPA3_ENT_192")
|
||||
case 11: return qsTr("WPA3_EXT_PSK")
|
||||
case 12: return qsTr("WPA3_EXT_PSK_MIXED_MODE")
|
||||
}
|
||||
return modelData.encryptionType
|
||||
}
|
||||
}
|
||||
|
||||
function wiFiCipherToString(cipher) {
|
||||
const names = ['NONE', 'WEP40', 'WEP104', 'TKIP', 'CCMP', 'TKIP_CCMP', 'AES_CMAC128', 'SMS4', 'GCMP', 'GCMP256', 'AES_GMAC128', 'AES_GMAC256', 'UNKNOWN'];
|
||||
|
||||
if (cipher >= 0 && cipher < names.length)
|
||||
return names[cipher];
|
||||
|
||||
return cipher;
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Pairwise cipher:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: parent.wiFiCipherToString("f" in modelData ? modelData.f[0] : modelData.pairwiseCipher)
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Group cipher:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: parent.wiFiCipherToString("f" in modelData ? modelData.f[1] : modelData.groupCipher)
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("RSSI:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.rssi
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Channel:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.channel
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("BSSID:")
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.bssid
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user