Network: better refresh vs wifi scan
This commit is contained in:
parent
2398961473
commit
b3e4486699
1 changed files with 11 additions and 6 deletions
|
|
@ -41,9 +41,7 @@ Singleton {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Logger.log("Network", "Service initialized")
|
Logger.log("Network", "Service initialized")
|
||||||
syncWifiState()
|
syncWifiState()
|
||||||
if (Settings.data.network.wifiEnabled) {
|
refresh()
|
||||||
scan()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save cache with debounce
|
// Save cache with debounce
|
||||||
|
|
@ -61,9 +59,9 @@ Singleton {
|
||||||
Timer {
|
Timer {
|
||||||
id: refreshTimer
|
id: refreshTimer
|
||||||
interval: 30000
|
interval: 30000
|
||||||
running: Settings.data.network.wifiEnabled && !scanning
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: scan()
|
onTriggered: refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delayed scan timer for WiFi enable
|
// Delayed scan timer for WiFi enable
|
||||||
|
|
@ -85,6 +83,14 @@ Singleton {
|
||||||
wifiToggleProcess.running = true
|
wifiToggleProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
ethernetStateProcess.running = true
|
||||||
|
|
||||||
|
if (Settings.data.network.wifiEnabled) {
|
||||||
|
scan()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function scan() {
|
function scan() {
|
||||||
if (scanning)
|
if (scanning)
|
||||||
return
|
return
|
||||||
|
|
@ -92,7 +98,6 @@ Singleton {
|
||||||
scanning = true
|
scanning = true
|
||||||
lastError = ""
|
lastError = ""
|
||||||
scanProcess.running = true
|
scanProcess.running = true
|
||||||
ethernetStateProcess.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function connect(ssid, password = "") {
|
function connect(ssid, password = "") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue