Class BleHrClient
-
- All Implemented Interfaces:
public final class BleHrClient extends BleGattBase
The
BleHrClientclass implements BLE Heart Rate client for receiving heart rate data from BLE Heart Rate service.This class implements the BLE Heart Rate client, which conforms to version 1.0 of the Heart Rate Service specification defined by the Bluetooth Special Interest Group (SIG) at https://www.bluetooth.com/specifications/specs/heart-rate-service-1-0/
The client receives RR-Interval data in 1/1024 milliseconds units. The RR-Interval data unit is defined in chapter 3.113.2 of the GATT Specification Supplement v8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBleHrClient.HrNotificationDataHeart rate data received from BLE Heart Rate Service.
public classBleHrClient.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static StringHR_SERVICE_16BIT_UUIDpublic final BleGattTxInterfacetxInterfacepublic BooleanisPrimaryServiceprivate final BooleanisEncryptionRequiredprivate final BooleanisServiceDiscoveredpublic final static BleHrClient.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description BleHrClient(BleGattTxInterface txInterface)
-
Method Summary
Modifier and Type Method Description Unitreset()UnitprocessServiceData(UUID characteristic, ByteArray data, Integer status, Boolean notifying)Callback for GATT service characteristic data processing UnitprocessServiceDataWritten(UUID characteristic, Integer status)StringtoString()final Flow<BleHrClient.HrNotificationData>observeHrNotifications(Boolean checkConnection)final Result<Unit>stopObserveHrNotifications(Boolean checkConnection)-
Methods inherited from class com.polar.androidcommunications.api.ble.model.gatt.BleGattBase
addCharacteristicNotification, authenticationCompleted, authenticationFailed, clientReady, containsCharacteristic, containsCharacteristicRead, containsNotifyCharacteristic, descriptorWritten, getAvailableCharacteristics, getNotificationAtomicInteger, isAutomatic, isAutomaticRead, isEncryptionRequired, isServiceDiscovered, processCharacteristicDiscovered, processServiceDataWrittenWithResponse, removeCharacteristicNotification, serviceBelongsToClient, setMtuSize, setServiceDiscovered, waitNotificationEnabled, waitServiceDiscovered -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BleHrClient
BleHrClient(BleGattTxInterface txInterface)
-
-
Method Detail
-
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)
-
observeHrNotifications
final Flow<BleHrClient.HrNotificationData> observeHrNotifications(Boolean checkConnection)
- Returns:
Flow stream Produces: onNext, for every hr notification event onError, if client is not initially connected or ble disconnects
-
stopObserveHrNotifications
final Result<Unit> stopObserveHrNotifications(Boolean checkConnection)
- Returns:
Result<Unit> failure if removing HR_MEASUREMENT notification fails
-
-
-
-