-
- 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.rsc.RunningSpeedAndCadenceMeasurementCallback
public final class RunningSpeedAndCadenceMeasurementResponse extends RunningSpeedAndCadenceMeasurementDataCallback 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 { RunningSpeedAndCadenceMeasurementResponse response = waitForIndication(characteristic) .awaitValid(RunningSpeedAndCadenceMeasurementResponse.class); float speedMetersPerSecond = response.getInstantaneousSpeed(); ... } 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 floatinstantaneousSpeedprivate intinstantaneousCadenceprivate IntegerstrideLengthprivate LongtotalDistancepublic final static Parcelable.Creator<RunningSpeedAndCadenceMeasurementResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description RunningSpeedAndCadenceMeasurementResponse()
-
Method Summary
Modifier and Type Method Description floatgetInstantaneousSpeed()Returns instantaneous speed. intgetInstantaneousCadence()Returns instantaneous cadence in revolution per minute (RPM). IntegergetStrideLength()Returns the stride length in centimeters if such data was present in the packet. LonggetTotalDistance()Returns total distance traveled with the device, in meters. voidonRSCMeasurementReceived(@NonNull() BluetoothDevice device, boolean running, float instantaneousSpeed, int instantaneousCadence, @Nullable() Integer strideLength, @Nullable() Long totalDistance)Method called when the Running Speed And Cadence Measurement data was received. booleanisRunning()True if running has been detected. voidwriteToParcel(@NonNull() Parcel dest, int flags)intdescribeContents()-
Methods inherited from class no.nordicsemi.android.ble.common.callback.rsc.RunningSpeedAndCadenceMeasurementDataCallback
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.rsc.RunningSpeedAndCadenceMeasurementCallback
onRSCMeasurementReceived -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getInstantaneousSpeed
float getInstantaneousSpeed()
Returns instantaneous speed.
-
getInstantaneousCadence
int getInstantaneousCadence()
Returns instantaneous cadence in revolution per minute (RPM).
-
getStrideLength
@Nullable() Integer getStrideLength()
Returns the stride length in centimeters if such data was present in the packet.
-
getTotalDistance
@Nullable() Long getTotalDistance()
Returns total distance traveled with the device, in meters. This value is returned asLong as the type returned is UINT32, and may be greater than Integer range.
-
onRSCMeasurementReceived
void onRSCMeasurementReceived(@NonNull() BluetoothDevice device, boolean running, float instantaneousSpeed, int instantaneousCadence, @Nullable() Integer strideLength, @Nullable() Long totalDistance)
Method called when the Running Speed And Cadence Measurement data was received.
- Parameters:
device- the target device.running- true if running was detected, false if walking.instantaneousSpeed- instantaneous speed in m/s unit.instantaneousCadence- instantaneous cadence in steps per minute.strideLength- instantaneous stride length in centimeters.totalDistance- the total distance in meters (UINT32).
-
isRunning
boolean isRunning()
True if running has been detected. False otherwise (walking, or activity status not supported).
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
describeContents
int describeContents()
-
-
-
-