NetworkService: bugfix the interface could not longer be enabled or disabled.
This commit is contained in:
parent
b2d629e6a1
commit
d089966249
1 changed files with 28 additions and 1 deletions
|
|
@ -96,6 +96,7 @@ Singleton {
|
||||||
|
|
||||||
function setWifiEnabled(enabled) {
|
function setWifiEnabled(enabled) {
|
||||||
Settings.data.network.wifiEnabled = enabled
|
Settings.data.network.wifiEnabled = enabled
|
||||||
|
wifiStateEnableProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function scan() {
|
function scan() {
|
||||||
|
|
@ -234,6 +235,8 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only check the state of the actual interface
|
||||||
|
// and update our setting to be in sync.
|
||||||
Process {
|
Process {
|
||||||
id: wifiStateProcess
|
id: wifiStateProcess
|
||||||
running: false
|
running: false
|
||||||
|
|
@ -242,7 +245,7 @@ Singleton {
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const enabled = text.trim() === "enabled"
|
const enabled = text.trim() === "enabled"
|
||||||
Logger.log("Network", "Wi-Fi enabled:", enabled)
|
Logger.log("Network", "Wi-Fi adapter was detect as enabled:", enabled)
|
||||||
if (Settings.data.network.wifiEnabled !== enabled) {
|
if (Settings.data.network.wifiEnabled !== enabled) {
|
||||||
Settings.data.network.wifiEnabled = enabled
|
Settings.data.network.wifiEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
@ -250,6 +253,30 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Process to enable/disable the Wi-Fi interface
|
||||||
|
Process {
|
||||||
|
id: wifiStateEnableProcess
|
||||||
|
running: false
|
||||||
|
command: ["nmcli", "radio", "wifi", Settings.data.network.wifiEnabled ? "on" : "off"]
|
||||||
|
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
Logger.log("Network", "Wi-Fi state change command executed.")
|
||||||
|
// Re-check the state to ensure it's in sync
|
||||||
|
syncWifiState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stderr: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
if (text.trim()) {
|
||||||
|
Logger.warn("Network", "Error changing Wi-Fi state: " + text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Helper process to get existing profiles
|
// Helper process to get existing profiles
|
||||||
Process {
|
Process {
|
||||||
id: profileCheckProcess
|
id: profileCheckProcess
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue