WifiProvisionViewModel
class WifiProvisionViewModel(bleScanner: BleScanner, bleConnectionFactory: BleConnectionFactory, dispatchers: CoroutineDispatchers) : ViewModel(source)
ViewModel for the WiFi provisioning flow.
Uses KoinViewModel so the instance is scoped to the navigation entry's ViewModelStoreOwner. A fresh NymeaWifiService (and its own BleConnectionFactory-backed org.meshtastic.core.ble.BleConnection) is created lazily for each provisioning session and cleaned up via onCleared.
Constructors
Link copied to clipboard
constructor(bleScanner: BleScanner, bleConnectionFactory: BleConnectionFactory, dispatchers: CoroutineDispatchers)
Functions
Link copied to clipboard
Link copied to clipboard
Scan for the nearest nymea-networkmanager device and connect to it. Pauses at the WifiProvisionUiState.Phase.DeviceFound phase so the user can confirm before proceeding — this is the Android analog of the web flasher's native BLE pairing dialog.
Link copied to clipboard
Disconnect and close any active BLE connection.
Link copied to clipboard
Link copied to clipboard
Send WiFi credentials to the device.
Link copied to clipboard
Called when the user confirms they want to scan networks after device discovery.