RadioController

Central interface for controlling the radio and mesh network.

This is a composite interface that extends the focused sub-interfaces below. Feature modules that need the full surface inject RadioController; modules that need only a subset can inject the narrower interface for better testability and clearer dependency intent.

Sub-interfaces (mirrors SDK's layered API design):

  • AdminController — config, channels, owner, device lifecycle (→ SDK AdminApi)

  • MessagingController — send packets, reactions, contacts (→ SDK RadioClient.send*)

  • NodeController — favorite, ignore, mute, remove nodes (→ SDK AdminApi node ops)

  • QueryController — telemetry, traceroute, position queries (→ SDK TelemetryApi / RoutingApi)

When migrating to the SDK, each sub-interface becomes a thin adapter over the corresponding SDK API. The composite RadioController can then be deprecated and consumers migrated to the narrower interfaces one at a time.

Properties

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

Flow of notifications from the radio client.

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

Canonical app-level connection state.

Link copied to clipboard
abstract val sessionGeneration: StateFlow<Long>

Monotonic radio-session generation used to reject work captured by a replaced connection.

Functions

Link copied to clipboard
abstract suspend fun addRemoteContact(destNum: Int, contact: SharedContact): Boolean

Adds contact to destNum's node DB via AdminMessage.add_contact. Firmware also favorites it, except on a CLIENT_BASE node. Returns true once destNum acknowledges.

Link copied to clipboard

Clears the current clientNotification.

Link copied to clipboard
abstract suspend fun editLocalSettings(block: suspend AdminEditScope.() -> Unit)

Runs block as an editSettings transaction against the local node.

Link copied to clipboard
abstract suspend fun editSettings(destNum: Int, block: suspend AdminEditScope.() -> Unit)

Runs block inside a begin/commit edit-settings transaction on destNum.

Link copied to clipboard
abstract suspend fun factoryReset(destNum: Int): AdminResult<Unit>

Performs a factory reset on a node, BLE bonds included.

Link copied to clipboard
abstract fun generatePacketId(): Int

A fresh non-zero ID from the active session's SDK client, or a random non-zero one without a session, for an object that needs a mesh-unique id, such as a waypoint.

Link copied to clipboard
abstract suspend fun getCannedMessages(destNum: Int): AdminResult<String>

Reads the current canned messages.

Link copied to clipboard
abstract suspend fun getChannel(destNum: Int, index: Int): AdminResult<Channel>

Reads the channel at zero-based index.

Link copied to clipboard
abstract suspend fun getConfig(destNum: Int, configType: Int): AdminResult<Config>

Reads a configuration section; configType is an AdminMessage.ConfigType value.

Link copied to clipboard
abstract suspend fun getDeviceConnectionStatus(destNum: Int): AdminResult<DeviceConnectionStatus>

Reads the hardware connection status.

Link copied to clipboard
abstract suspend fun getDeviceMetadata(destNum: Int): AdminResult<DeviceMetadata>

Reads the device metadata, the remote-admin preflight.

Link copied to clipboard
abstract suspend fun getModuleConfig(destNum: Int, moduleConfigType: Int): AdminResult<ModuleConfig>

Reads a module configuration section; moduleConfigType is an AdminMessage.ModuleConfigType value.

Link copied to clipboard
abstract suspend fun getOwner(destNum: Int): AdminResult<User>

Reads the current owner (user info).

Link copied to clipboard
abstract suspend fun getRingtone(destNum: Int): AdminResult<String>

Reads the current ringtone.

Link copied to clipboard
abstract suspend fun importContact(contact: SharedContact)

Imports a shared contact into the firmware's NodeDB.

Link copied to clipboard
abstract fun newRemoteShellSessionId(): Int?

A fresh non-zero remote shell session ID, or null without a radio session.

Link copied to clipboard
abstract suspend fun nodedbReset(destNum: Int, preserveFavorites: Boolean): AdminResult<Unit>

Resets the NodeDB on a node.

Link copied to clipboard
abstract suspend fun playRingtone(destNum: Int)

Plays the node's saved ringtone once via AdminMessage.play_ringtone_request. Fire-and-forget: the firmware sends no response, and builds without RTTTL support ignore it.

Link copied to clipboard
abstract suspend fun reboot(destNum: Int): AdminResult<Unit>

Commands a node to reboot.

Link copied to clipboard
abstract suspend fun rebootToDfu(nodeNum: Int): AdminResult<Unit>

Commands a node to reboot into DFU mode; firmware answers nothing, so success means sent.

Link copied to clipboard
abstract suspend fun refreshMetadata(destNum: Int): NodeRequest

Requests device metadata from a node.

Link copied to clipboard
abstract suspend fun removeByNodenum(nodeNum: Int)

Removes a node from the mesh by its node number.

Link copied to clipboard
abstract suspend fun removeRemoteNode(destNum: Int, nodeNum: Int): Boolean

Removes nodeNum from destNum's node DB. Returns true once destNum acknowledges.

Link copied to clipboard
abstract fun requestDisplayFrame()

Requests a single framebuffer frame from the locally connected node, delivered like mirrored frames.

Requests that the next BLE connection invalidates Android's GATT service cache. Call before setDeviceAddress when reconnecting after a firmware update.

Link copied to clipboard
abstract suspend fun requestNeighborInfo(destNum: Int): NodeRequest

Requests neighbor information (detected nodes) from a node.

Link copied to clipboard
abstract suspend fun requestPosition(destNum: Int, currentPosition: Position): NodeRequest

Requests the current position of a remote node, sharing ours when the user allows it.

Link copied to clipboard
abstract suspend fun requestRebootOta(destNum: Int, mode: Int, hash: ByteArray?)

Sends an ESP32 OTA reboot request without waiting for the node's answer.

Link copied to clipboard
abstract suspend fun requestTelemetry(destNum: Int, type: TelemetryType): NodeRequest

Requests one kind of telemetry from a node.

Link copied to clipboard
abstract suspend fun requestTraceroute(destNum: Int): NodeRequest

Initiates a traceroute request to a remote node.

Link copied to clipboard
abstract suspend fun requestUserInfo(destNum: Int): NodeRequest

Requests user info from a remote node, carrying ours.

Link copied to clipboard
abstract suspend fun restoreLocalConfiguration(expectedDeviceAddress: String?, config: Config, primaryChannel: Channel? = null): Boolean

Restores local radio settings only while expectedDeviceAddress is still selected.

Link copied to clipboard
abstract fun sendInputEvent(eventCode: Int, kbChar: Int = 0, touchX: Int = 0, touchY: Int = 0)

Injects a physical input event (button/key/touch) into the locally connected node's UI via the firmware InputBroker. Event codes are the firmware's input_broker_event values. Non-suspend immediate send: input must not queue behind bulk admin traffic.

Link copied to clipboard
abstract suspend fun sendMessage(packet: DataPacket)

Sends a data packet to the mesh.

Link copied to clipboard
abstract suspend fun sendReaction(emoji: String, replyId: Int, contactKey: String)

Sends an emoji reaction to a message. Awaits local DB persistence.

Link copied to clipboard
abstract suspend fun sendRemoteShell(destNum: Int, frame: RemoteShell)

Sends one remote shell frame to destNum, PKI-encrypted with no want_ack.

Link copied to clipboard
abstract suspend fun sendSharedContact(nodeNum: Int): Boolean

Sends our shared contact information (identity and public key) to the firmware's NodeDB.

Link copied to clipboard
abstract suspend fun setCannedMessages(destNum: Int, messages: String)

Updates the canned messages configuration on a remote node.

Link copied to clipboard
abstract suspend fun setConfig(destNum: Int, config: Config): AdminResult<Unit>

Updates the general configuration on a node.

Link copied to clipboard
abstract suspend fun setDeviceAddress(address: String)

Changes the device address (e.g., BLE MAC, IP address) we are communicating with.

Link copied to clipboard
abstract fun setDisplayMirror(enabled: Boolean)

Enables or disables live display mirroring on the locally connected node. While enabled, the device streams its framebuffer as FromRadio.display_frame chunks — collect them via DisplayMirrorManager. Non-suspend (immediate send, bypassing the outbound FIFO) so lifecycle teardown can reliably disable the stream.

Link copied to clipboard
abstract suspend fun setFavorite(nodeNum: Int, favorite: Boolean)

Sets the favorite status of a node on the radio.

Link copied to clipboard
abstract suspend fun setFixedPosition(destNum: Int, position: Position)

Sets a fixed position on a remote node.

Link copied to clipboard
abstract suspend fun setHamMode(destNum: Int, hamParameters: HamParameters): AdminResult<Unit>

Enables amateur-radio (ham) mode on a node via AdminMessage.set_ham_mode.

Link copied to clipboard
abstract suspend fun setIgnored(nodeNum: Int, ignored: Boolean)

Sets the ignore status of a node on the radio.

Link copied to clipboard
abstract suspend fun setLocalChannel(channel: Channel)

Updates a local radio channel. Same fire-and-forget contract as setLocalConfig.

Link copied to clipboard
abstract suspend fun setLocalConfig(config: Config)

Updates the local radio configuration.

Link copied to clipboard
abstract suspend fun setLocalConfigOn(session: RadioSessionContext, config: Config): AdminResult<Unit>

Writes config to the connected node of session and returns its answer, for a write whose input was read on that session. Nothing is sent once session no longer owns the radio; the answer is then AdminResult.NodeUnreachable.

Link copied to clipboard
abstract suspend fun setModuleConfig(destNum: Int, config: ModuleConfig): AdminResult<Unit>

Updates a module configuration on a node.

Link copied to clipboard
abstract suspend fun setOwner(destNum: Int, user: User): AdminResult<Unit>

Updates the owner (user info) on a node.

Link copied to clipboard
abstract suspend fun setRemoteChannel(destNum: Int, channel: Channel): AdminResult<Unit>

Updates a channel configuration on a node.

Link copied to clipboard
abstract suspend fun setRemoteFavorite(destNum: Int, nodeNum: Int, favorite: Boolean): Boolean

Favorites or unfavorites nodeNum in destNum's node DB. Returns true once destNum acknowledges.

Link copied to clipboard
abstract suspend fun setRemoteIgnored(destNum: Int, nodeNum: Int, ignored: Boolean): Boolean

Ignores or unignores nodeNum in destNum's node DB. Returns true once destNum acknowledges.

Link copied to clipboard
abstract suspend fun setRingtone(destNum: Int, ringtone: String)

Updates the notification ringtone on a remote node.

Link copied to clipboard
abstract suspend fun setTime(destNum: Int): AdminResult<Unit>

Syncs a node's real-time clock to the phone's current time via AdminMessage.set_time_only.

Link copied to clipboard
abstract suspend fun shutdown(destNum: Int): AdminResult<Unit>

Commands a node to shut down.

Link copied to clipboard
abstract fun startProvideLocation()

Starts providing the phone's location to the mesh.

Link copied to clipboard
abstract fun stopProvideLocation()

Stops providing the phone's location to the mesh.

Link copied to clipboard
abstract suspend fun toggleMuted(nodeNum: Int)

Toggles the mute status of a node on the radio. Mirrors the SDK's toggleMuted(NodeId).