-
- All Implemented Interfaces:
-
android.os.Parcelable,no.nordicsemi.android.ble.callback.DataReceivedCallback,no.nordicsemi.android.ble.callback.profile.ProfileDataCallback,no.nordicsemi.android.ble.common.profile.hr.HeartRateMeasurementCallback
public final class HeartRateMeasurementResponse extends HeartRateMeasurementDataCallback implements Parcelable
Response class that could be used as a result of a synchronous request. The data received are available through getters, instead of a callback.
Usage example:
try { HeartRateMeasurementResponse response = waitForNotification(characteristic) .awaitValid(HeartRateMeasurementResponse.class); int heartRate = response.getHeartRate(); ... } catch (RequestFailedException e) { Log.w(TAG, "Request failed with status " + e.getStatus(), e); } catch (InvalidDataException e) { Log.w(TAG, "Invalid data received: " + e.getResponse().getRawData()); }
-
-
Field Summary
Fields Modifier and Type Field Description private intheartRateprivate IntegerenergyExpandedprivate List<Integer>rrIntervalspublic final static Parcelable.Creator<HeartRateMeasurementResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description HeartRateMeasurementResponse()
-
Method Summary
Modifier and Type Method Description intgetHeartRate()IntegergetEnergyExpanded()List<Integer>getRrIntervals()voidonHeartRateMeasurementReceived(@NonNull() BluetoothDevice device, int heartRate, @Nullable() Boolean contactDetected, @Nullable() Integer energyExpanded, @Nullable() List<Integer> rrIntervals)Callback called when Hear Rate notification has been received. BooleanisSensorContactSupported()BooleanisSensorContactDetected()voidwriteToParcel(@NonNull() Parcel dest, int flags)-
Methods inherited from class no.nordicsemi.android.ble.common.callback.hr.HeartRateMeasurementDataCallback
onDataReceived -
Methods inherited from class no.nordicsemi.android.ble.callback.profile.ProfileReadResponse
isValid, onInvalidDataReceived, writeToParcel -
Methods inherited from class no.nordicsemi.android.ble.response.ReadResponse
describeContents, getBluetoothDevice, getRawData, onDataReceived -
Methods inherited from class no.nordicsemi.android.ble.common.profile.hr.HeartRateMeasurementCallback
onHeartRateMeasurementReceived -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getHeartRate
int getHeartRate()
-
getEnergyExpanded
@Nullable() Integer getEnergyExpanded()
-
getRrIntervals
@Nullable() List<Integer> getRrIntervals()
-
onHeartRateMeasurementReceived
void onHeartRateMeasurementReceived(@NonNull() BluetoothDevice device, int heartRate, @Nullable() Boolean contactDetected, @Nullable() Integer energyExpanded, @Nullable() List<Integer> rrIntervals)
Callback called when Hear Rate notification has been received.
- Parameters:
device- the target device.heartRate- the current heart rate in beats per minute.contactDetected- information whether sensor contact has been detected, or not.Null if this feature is not supported.energyExpanded- the energy expanded in kilo Joules, or null if feature is not supported.rrIntervals- an optional list of RR intervals, each in 1/1024 of a second unit.Null if this feature is not supported.
-
isSensorContactSupported
@Nullable() Boolean isSensorContactSupported()
-
isSensorContactDetected
@Nullable() Boolean isSensorContactDetected()
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
-
-
-