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 canonical, app-level connection state that all UI, feature modules, and ViewModels should observe. It incorporates handshake progress, light-sleep policy, and transport reconciliation — unlike RadioInterfaceService.connectionState, which only reflects the raw hardware link status. The MeshConnectionManager is the sole writer of this state; it bridges RadioInterfaceService.connectionState changes into app-level transitions via setConnectionState.

See also

Types

Link copied to clipboard
object Companion

Properties

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

Reactive flow of high-level client notifications.

Link copied to clipboard
abstract val connectionEpochs: StateFlow<ConnectionEpochs>

Convenience view of monotonic departures and completed handshakes. Use connectionLifecycle when the counters must be correlated with a specific state, because independent StateFlow collections can observe different versions.

Link copied to clipboard
abstract val connectionLifecycle: StateFlow<ConnectionLifecycle>

Atomically correlated canonical state and lifecycle evidence.

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

Reactive flow of connection progress messages.

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

Canonical app-level connection state.

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 val sessionAuthorized: StateFlow<Boolean>

True once the passphrase was accepted for the current BLE connection.

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 setConnectionProgress(text: String)

Sets the connection progress message.

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

Updates the canonical app-level connection state.

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 fun setSessionAuthorized(authorized: Boolean)

Updates the session authorization flag.

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

Sets the traceroute response.