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

Properties

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

Reactive flow of high-level client notifications.

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

Reactive flow of connection progress messages.

Link copied to clipboard
abstract 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 meshPacketFlow: SharedFlow<MeshPacket>

Flow of all raw MeshPacket objects received from the mesh.

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

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

Link copied to clipboard
abstract val serviceAction: Flow<ServiceAction>

Flow of service actions requested by the UI (e.g., "Favorite Node", "Mute Node").

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

Reactive flow of the most recent traceroute result.

Functions

Link copied to clipboard

Clears the current client notification.

Link copied to clipboard
abstract fun clearErrorMessage()

Clears the current error message.

Link copied to clipboard

Clears the current neighbor info response.

Link copied to clipboard

Clears the current traceroute response.

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

Emits a mesh packet into the flow.

Link copied to clipboard
abstract suspend fun onServiceAction(action: ServiceAction)

Dispatches a service action to be handled by the background service.

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

Sets the current client notification.

Link copied to clipboard
abstract fun setConnectionProgress(text: String)

Sets the connection progress message.

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

Updates the canonical app-level connection state.

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

Sets an error message to be displayed.

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

Sets the neighbor info response.

Link copied to clipboard

Sets the traceroute response.