Package 

Class RunningSpeedAndCadenceMeasurementResponse

  • 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());
    }
    
    • Constructor Detail

      • RunningSpeedAndCadenceMeasurementResponse

        RunningSpeedAndCadenceMeasurementResponse()
    • Method Detail

      • getInstantaneousCadence

         int getInstantaneousCadence()

        Returns instantaneous cadence in revolution per minute (RPM).

      • 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).