connect
Function used to start collecting data from an ChunksEmitter and uploading them to nRF Cloud, powered by Memfault.
Chunks upload will start as soon as the profile reports Connected, and will resume automatically every time the profile reconnects.
Calling this method when already connected will throw an exception.
Parameters
The ChunksEmitter to collect ChunksEmitter.state and ChunksEmitter.chunks from.
Throws
if the manager is already connected.
Function used to start collecting observability data from the given Peripheral.
Use this method for applications that already have their own connected Peripheral, e.g. obtained and connected using the Kotlin BLE Library elsewhere in the application. This manager will not manage the peripheral's connection in any way; it is entirely the caller's responsibility.
Parameters
The already connected Peripheral to attach the profile to.
Whether the Monitoring & Diagnostic Service is required. If true and the peripheral does not support it, the peripheral will be disconnected. As peripheral may be shared with other features, this defaults to false.
Throws
if the manager is already connected.
Function used to connect to the given Peripheral using the given CentralManager, and start collecting observability data from it.
Unlike connect(peripheral, required), this manager will fully own the connection: it connects the peripheral itself (auto-reconnecting as needed) using the given centralManager, instead of assuming it is already connected elsewhere.
Use this, for example, when peripheral and centralManager exist solely to back this feature (nothing else in the application connects them), or with a mock CentralManager for testing.
If the Monitoring & Diagnostic Service will not be found on the Perihoeral, the connection will terminate with reason NOT_SUPPORTED.
Parameters
Peripheral to which the manager should connect.
CentralManager to use to connect to the peripheral.
Throws
if the manager is already connected to a peripheral.
Function used to connect to the selected Bluetooth LE peripheral.
The peripheral must support Monitoring & Diagnostic Service.
This method is for legacy applications that don't use Peripheral from the Kotlin BLE Library, and only have a BluetoothDevice. This manager will create and fully own the connection to the device, connecting automatically and reconnecting as needed.
Chunks upload will start immediately after establishing the connection.
Parameters
The native Android Environment object.
BluetoothDevice to which the manager should connect.
Throws
if the manager is already connected to a peripheral.