Class BleMdsClient
-
- All Implemented Interfaces:
public final class BleMdsClient extends BleGattBase
The
BleMdsClientclass implements BLE MDS (Memfault Diagnostic Service) client for receiving telemetry diagnostics data from a BLE MDS service.Service flow:
After connection MDS_SUPPORTED_FEATURES, MDS_DEVICE_IDENTIFIER, MDS_DATA_URI and MDS_AUTHORIZATION are auto-read, and MDS_DATA_EXPORT notifications are auto-enabled. If MDS_SUPPORTED_FEATURES fails to read, the failure is not cached forever: the next clientReady call triggers one fresh retry read instead of replaying the stale failure, so recovery works once consent is resolved without an app restart or BLE reconnect.
Call startMdsNotifications to register an observer and enable streaming via MDS_DATA_EXPORT.
Observe TelemetryConfiguration for continuous streaming; each emission carries the latest device context together with the export data chunk.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBleMdsClient.TelemetryConfigurationContainer that carries the latest MDS device context together with a single chunk of streaming export data received from the MDS_DATA_EXPORT notification.
All context fields are populated from auto-reads performed after service discovery and are
nulluntil their respective reads complete.deviceIdentifier — unique identifier of the device (from MDS_DEVICE_IDENTIFIER).
dataUri — Memfault data ingestion URI (from MDS_DATA_URI).
authorization — HTTP authorization header value to include when forwarding data to Memfault, e.g.
"Memfault-Project-Key:YOUR_PROJECT_KEY"(from MDS_AUTHORIZATION).exportData — raw bytes of one MDS_DATA_EXPORT notification frame.
public classBleMdsClient.Companion
-
Field Summary
Fields Modifier and Type Field Description private final LinkedBlockingQueue<Pair<ByteArray, Integer>>mdsResponseQueuepublic final BleGattTxInterfacetxInterfacepublic BooleanisPrimaryServiceprivate final BooleanisEncryptionRequiredprivate final BooleanisServiceDiscoveredpublic final static BleMdsClient.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description BleMdsClient(BleGattTxInterface txInterface)
-
Method Summary
Modifier and Type Method Description final LinkedBlockingQueue<Pair<ByteArray, Integer>>getMdsResponseQueue()Unitreset()UnitclientReady(Boolean checkConnection)UnitprocessServiceData(UUID characteristic, ByteArray data, Integer status, Boolean notifying)Callback for GATT service characteristic data processing UnitprocessServiceDataWritten(UUID characteristic, Integer status)final Flow<BleMdsClient.TelemetryConfiguration>startMdsNotifications(Boolean checkConnection)final Flow<BleMdsClient.TelemetryConfiguration>monitorMdsNotifications(Boolean checkConnection)final IntegersendControlPointCommand(Integer command)-
Methods inherited from class com.polar.androidcommunications.api.ble.model.gatt.BleGattBase
addCharacteristicNotification, authenticationCompleted, authenticationFailed, containsCharacteristic, containsCharacteristicRead, containsNotifyCharacteristic, descriptorWritten, getAvailableCharacteristics, getNotificationAtomicInteger, isAutomatic, isAutomaticRead, isEncryptionRequired, isServiceDiscovered, processCharacteristicDiscovered, processServiceDataWrittenWithResponse, removeCharacteristicNotification, serviceBelongsToClient, setMtuSize, setServiceDiscovered, waitNotificationEnabled, waitNotificationEnabled, waitServiceDiscovered -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BleMdsClient
BleMdsClient(BleGattTxInterface txInterface)
-
-
Method Detail
-
getMdsResponseQueue
final LinkedBlockingQueue<Pair<ByteArray, Integer>> getMdsResponseQueue()
-
clientReady
Unit clientReady(Boolean checkConnection)
-
processServiceData
Unit processServiceData(UUID characteristic, ByteArray data, Integer status, Boolean notifying)
Callback for GATT service characteristic data processing
- Parameters:
characteristic- characteristic UUIDdata- data in byte arraystatus- status code of processed datanotifying- if true data is notification data from GATT service
-
processServiceDataWritten
Unit processServiceDataWritten(UUID characteristic, Integer status)
-
startMdsNotifications
final Flow<BleMdsClient.TelemetryConfiguration> startMdsNotifications(Boolean checkConnection)
-
monitorMdsNotifications
final Flow<BleMdsClient.TelemetryConfiguration> monitorMdsNotifications(Boolean checkConnection)
-
sendControlPointCommand
final Integer sendControlPointCommand(Integer command)
-
-
-
-