ServiceRepository

Interface for managing background service state, connection status, and mesh events.

This repository acts as the primary data bridge between the long-running mesh service and the UI/Feature layers. It maintains reactive flows for connection status, error messages, and incoming mesh traffic.

Connection state contract: connectionState is the selected radio's SDK ConnectionState, which all UI, feature modules, and ViewModels observe. RadioInterfaceService derives it from the SDK client's state, showing ConnectionState.Connected only once the app holds the session's config and nodes.

Properties

Link copied to clipboard
abstract val clientNotification: StateFlow<ClientNotification?>

Reactive flow of high-level client notifications.

Link copied to clipboard
abstract override val connectionState: StateFlow<ConnectionState>

The selected radio's connection state, as its SDK client reports it: ConnectionState.Connecting and ConnectionState.Configuring while a session comes up, ConnectionState.Connected once the app has installed the session's snapshot, ConnectionState.Reconnecting and ConnectionState.DeviceSleeping while the client retries, ConnectionState.Failed once it stops, and ConnectionState.Disconnecting then ConnectionState.Disconnected when the user disconnects.

Link copied to clipboard
abstract val errorMessage: StateFlow<String?>

Reactive flow of human-readable error messages.

Link copied to clipboard
abstract val lockdownState: StateFlow<LockdownState>

Reactive flow of the current lockdown authentication state.

Link copied to clipboard
abstract val lockdownTokenInfo: StateFlow<LockdownTokenInfo?>

Reactive flow of the most recent lockdown session token info.

Link copied to clipboard
abstract val meshPacketFlow: Flow<MeshPacket>

Flow of all raw MeshPacket objects received from the mesh.

Link copied to clipboard
abstract override val neighborInfoResponse: StateFlow<String?>

Reactive flow of the most recent neighbor info response (formatted string).

Link copied to clipboard
abstract override val tracerouteResponse: StateFlow<TracerouteResponse?>

Reactive flow of the most recent traceroute result.

Functions

Link copied to clipboard
abstract override fun clearClientNotification()

Clears the current client notification.

Link copied to clipboard
abstract override fun clearErrorMessage()

Clears the current error message.

Link copied to clipboard
abstract fun clearLockdownState()

Resets lockdown state to LockdownState.None.

Link copied to clipboard
abstract override fun clearNeighborInfoResponse()

Clears the current neighbor info response.

Link copied to clipboard
abstract override fun clearTracerouteResponse()

Clears the current traceroute response.

Link copied to clipboard
abstract suspend override fun emitMeshPacket(packet: MeshPacket)

Emits a mesh packet into the flow.

Link copied to clipboard
abstract override fun setClientNotification(notification: ClientNotification?)

Sets the current client notification.

Link copied to clipboard
abstract override fun setConnectionState(connectionState: ConnectionState)

Publishes the connection state. Only the radio service writes it.

Link copied to clipboard
abstract override fun setErrorMessage(text: String, severity: Severity = Severity.Error)

Sets an error message to be displayed.

Link copied to clipboard
abstract fun setLockdownState(state: LockdownState)

Updates the lockdown state.

Link copied to clipboard

Sets the lockdown token info from a successful UNLOCKED status.

Link copied to clipboard
abstract override fun setNeighborInfoResponse(value: String?)

Sets the neighbor info response.

Link copied to clipboard
abstract override fun setTracerouteResponse(value: TracerouteResponse?)

Sets the traceroute response.