Class RscMeasurement

java.lang.Object
com.codename1.health.sensors.RscMeasurement

public final class RscMeasurement extends Object

A decoded Running Speed and Cadence Measurement, characteristic 0x2A53.

Wire format

A flags byte -- bit 0 stride length present, bit 1 total distance present, bit 2 running rather than walking -- then a uint16 speed and a uint8 cadence, then the optional fields.

Cadence is in steps per minute, not strides

The profile transmits steps, so a runner at a typical 90 strides per minute reports 180. Foot pods differ in which they display, and halving the value to get strides is a decision for your UI, not something this parser does silently. getStrideRatePerMinute() is provided for when you want the other convention explicitly.

Speed arrives in 1/256 m/s and total distance in tenths of a metre.

  • Method Details

    • parse

      public static RscMeasurement parse(byte[] value)
      Decodes a 0x2A53 value. Returns null for a malformed or truncated payload; never throws.
    • getSpeedMetersPerSecond

      public double getSpeedMetersPerSecond()
      Instantaneous speed in metres per second.
    • getCadenceStepsPerMinute

      public int getCadenceStepsPerMinute()
      Cadence in steps per minute, as transmitted.
    • getStrideRatePerMinute

      public double getStrideRatePerMinute()
      Cadence expressed in strides per minute -- half the step rate. Provided so the conversion is explicit at the call site rather than guessed.
    • getStrideLengthMeters

      public double getStrideLengthMeters()
      Stride length in metres, or Double.NaN when absent.
    • getTotalDistanceMeters

      public double getTotalDistanceMeters()
      Cumulative distance in metres since the pod powered on, or Double.NaN when absent.
    • isRunning

      public boolean isRunning()
      true when the pod classified the motion as running rather than walking.
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object