AdminApi

interface AdminApi(source)

Device configuration and control RPCs.

Each method maps onto a single AdminMessage round-trip with the local device. Failures that are part of the normal operating envelope (timeout, unauthorized, session-key expiry, node unreachable for remote-admin paths) surface as typed AdminResult variants. Catastrophic failures (transport gone, engine torn down) throw MeshtasticException.

Acquired via RadioClient.admin. Available only while the client is connected.

Since

0.1.0

Functions

Link copied to clipboard
abstract suspend fun <T> editSettings(block: suspend AdminEdit.() -> T): AdminResult<T>

Run block inside a begin_edit_settings / commit_edit_settings envelope so the device applies all writes atomically (avoids reboot-mid-edit corruption).

Link copied to clipboard
abstract suspend fun factoryReset(preserveBleBonds: Boolean = true): AdminResult<Unit>

Erase device state and reset to factory defaults.

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

Read the Channel at index (0..7).

Link copied to clipboard
abstract suspend fun getConfig(type: AdminMessage.ConfigType): AdminResult<Config>

Read a single Config section from the device.

Link copied to clipboard
abstract suspend fun getModuleConfig(type: AdminMessage.ModuleConfigType): AdminResult<ModuleConfig>

Read a single ModuleConfig section from the device.

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

Read the local node's User (long name / short name / hardware model / public key).

Link copied to clipboard
abstract suspend fun listChannels(): AdminResult<List<Channel>>

Read every configured channel (indices 0..7).

Link copied to clipboard
abstract suspend fun nodeDbReset(preserveFavorites: Boolean = true): AdminResult<Unit>

Wipe the device's NodeDB, forcing a fresh discovery cycle on the mesh.

Link copied to clipboard
abstract suspend fun reboot(after: Duration = Duration.ZERO): AdminResult<Unit>

Reboot the device after after (default: immediately).

Link copied to clipboard
abstract suspend fun setChannel(channel: Channel): AdminResult<Unit>

Write a Channel. The slot is determined by Channel.index.

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

Write a Config section to the device.

Link copied to clipboard
abstract suspend fun setFavorite(node: NodeId, favorite: Boolean): AdminResult<Unit>

Mark node as a favorite (persisted in firmware NodeDB).

Link copied to clipboard
abstract suspend fun setIgnored(node: NodeId, ignored: Boolean): AdminResult<Unit>

Mark node as ignored — packets from it are filtered before reaching apps.

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

Write a ModuleConfig section to the device.

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

Update the local node's User. Persists across reboots.

Link copied to clipboard
abstract suspend fun setTime(at: Instant? = null): AdminResult<Unit>

Set the device's wall clock to at (default: Clock.System.now()).

Link copied to clipboard
abstract suspend fun shutdown(after: Duration = Duration.ZERO): AdminResult<Unit>

Power down the device after after (default: immediately).