import QtQuick Item { // Diagnostics reads these two as typed availability; `ssid` is a redaction // sentinel the lifecycle fixture asserts never reaches diagnostics output. property bool wifiEnabled: true property bool scanning: false property string ssid: "diagnostic-private-sentinel" property int generation: 0 property int connectCount: 0 property int retryCount: 0 property bool receivedKnownPassphrase: false // The suite's scenario: "online" joins fixture-home without a wired port; // "offline" leaves the wireless on with nothing joined and the wired port // unplugged; "no-device" has no wireless device and no wired port; "wired" // has no wireless device and a wired link; "failed" is online after a // failed secured join. property string scenario: "online" readonly property bool deviceAvailable: scenario !== "no-device" && scenario !== "wired" readonly property bool joined: scenario === "online" || scenario === "failed" readonly property string wiredState: scenario === "wired" ? "connected" : (scenario === "offline" ? "unplugged" : "") // The bar's attention, as in the production service. readonly property bool wifiJoined: deviceAvailable && wifiEnabled && joined readonly property bool offline: !wifiJoined && wiredState !== "connected" // The typed state the production service exposes to the panel. readonly property bool loaded: true readonly property bool actionPending: false readonly property var networks: rows() readonly property string error: !deviceAvailable ? "no-wifi-device" : (scenario === "failed" ? "action-failed" : "") readonly property var lastAction: scenario === "failed" ? { "kind": "connect", "ssid": "fixture-secure" } : ({}) readonly property var connectionDetail: ({}) function rows() { if (!deviceAvailable || !wifiEnabled) return []; const secure = { "id": "fixture-secure", "ssid": "fixture-secure", "security": "psk", "securityLabel": "secured", "signal": generation > 0 ? 4 : 2, "signalLabel": generation > 0 ? "strong signal" : "fair signal", "signalDbm": generation > 0 ? -48 : -68, "signalGlyph": "󰤨", "signalRole": "ui.accent", "known": false, "connected": false, "needsPassphrase": true, "state": "available" }; if (!joined) return [secure]; return [ { "id": "fixture-home", "ssid": "fixture-home", "security": "psk", "securityLabel": "secured", "signal": 4, "signalLabel": "strong signal", "signalDbm": -45, "signalGlyph": "󰤨", "signalRole": "content.accent", "known": true, "connected": true, "needsPassphrase": false, "state": "connected" }, secure]; } function setScenario(name) { scenario = name; } function toggleWifi(enabled) { wifiEnabled = enabled; } function scan() { } function select(id) { } function forget(id) { } // The passphrase is compared, never kept or reported. function connect(ssid, passphrase) { connectCount++; receivedKnownPassphrase = passphrase === "fixture-only"; } function disconnect() { } function diagnostics() { } // The unavailable state's retry re-reads the device. function checkConnectivity() { retryCount++; } // A live service refresh, e.g. a finished scan, while the popup is open. function externalUpdate() { generation++; } function fixtureState() { return { "generation": generation, "connects": connectCount, "retries": retryCount, "knownPassphrase": receivedKnownPassphrase, "scenario": scenario, "wifiEnabled": wifiEnabled, "offline": offline, "wired": wiredState }; } }