SettingsManagerKtx

A manager of the Settings group of Mcu Manager, with suspending methods. It wraps SettingsManager.

Every method suspends until the response is received, and throws a McuMgrException if the request fails, or a McuMgrErrorException if the device responds with an error, that is with a non-zero return code. Cancelling the calling coroutine stops waiting for the response, but does not cancel the request, which has already been sent.

Use the manager to set a logger, the upload MTU, etc.

Constructors

Link copied to clipboard
constructor(manager: SettingsManager)
constructor(transport: McuMgrTransport)

Creates the manager using the given transport.

Properties

Link copied to clipboard

The manager of the Mcu Manager library, which sends the requests.

Functions

Link copied to clipboard
suspend fun commit(): McuMgrResponse

Commits the settings.

Link copied to clipboard
suspend fun delete(name: String): McuMgrResponse

Deletes a setting.

Link copied to clipboard
suspend fun load(): McuMgrResponse

Loads the settings from the persistent storage.

Link copied to clipboard
suspend fun read(name: String, maxSize: Int? = null): McuMgrSettingsReadResponse

Reads the value of a setting.

Link copied to clipboard
suspend fun save(): McuMgrResponse

Saves the settings to the persistent storage.

Link copied to clipboard
suspend fun write(name: String, value: ByteArray): McuMgrResponse

Writes the value of a setting.