CmSdk

interface CmSdk

Interface defining the core functionalities for the communication with Comodule modules. Provides methods to discover modules, manage connections, and interact with module properties and firmware.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun clearCache()

Clears the local cache of the SDK.

Link copied to clipboard
abstract suspend fun connect(serial: String, privateKey: String): CmConnectResult

Attempts to establish a connection with a module using its serial number and a private key.

Link copied to clipboard
abstract suspend fun disconnect()

Disconnects from the currently connected module, if any. Forgets the module and will not attempt to reestablish connection.

Link copied to clipboard
abstract suspend fun discoverModules(timeOut: CmScanDuration = CmScanDuration.MEDIUM): Flow<List<CmModule>>

Discovers available Comodule modules within a specified timeout period.

Link copied to clipboard

Observes connection errors that occur while attempting to connect to modules.

Link copied to clipboard

Observes changes to the connection state with modules.

Link copied to clipboard
abstract fun observeFirmwareInfo(): Flow<CmFirmwareInfo>

Observes the firmware information of the connected module.

Link copied to clipboard

Observes the status of firmware updates on the connected module.

Link copied to clipboard

Observes the values of all properties on the connected module.

Link copied to clipboard

Observes available properties that can be interacted with on the connected module.

Link copied to clipboard
abstract fun observeProperty(identifier: String): Flow<CmPropertyResult>

Observes the value of a specific property on the connected module.

Link copied to clipboard
abstract fun setApiKey(apiKey: String)

Sets the API key required for authenticating within the SDK.

Link copied to clipboard
abstract suspend fun setPropertyValue(identifier: String, value: CmPropertyValue): CmWriteResult

Sets the value of a property on the connected module.

Link copied to clipboard
abstract suspend fun updateFirmware(firmwareUpdateActivity: Class<out Activity>): CmFirmwareUpdateResult

Initiates a firmware update on the connected module, if available. After downloading the update, will start a foreground service.