observability
Integration with nRF Cloud Monitoring & Diagnostics Service (MDS).
This module allows devices to upload binary "chunks" of data (e.g., logs, core dumps) to the nRF Cloud via the mobile app using Bluetooth LE as transport protocol.
Key Components
ObservabilityManager: The main interface for managing the connection to a device supporting MDS. It handles chunk retrieval from the device and subsequent upload to nRF Cloud.Chunk: Represents a piece of data retrieved from the device.
Example
val observabilityManager = ObservabilityManager.create(context)
// Connect to a device
observabilityManager.connect(environment, bluetoothDevice)
// Observe the state (connection status, chunks pending/uploaded, etc.)
lifecycleScope.launch {
observabilityManager.state.collect { state ->
val connected = state.state is State.Connected
val pending = state.chunksPending
// Update UI...
}
}
// Disconnect when done
observabilityManager.disconnect()Content copied to clipboard