public final class CscMeasurement

  1. Object
  2. CscMeasurement

A decoded Cycling Speed and Cadence Measurement, characteristic 0x2A5B.

Wire format

A single flags byte – bit 0 wheel data present, bit 1 crank data present – followed by whichever blocks it selected: a uint32 revolution count plus a uint16 event time for the wheel, and a uint16 count plus uint16 event time for the crank.

These are cumulative counters, not rates

Neither speed nor cadence is transmitted. What arrives is a running total and a timestamp, and both wrap – the event times roughly every 64 seconds. Differencing them correctly is what CumulativeCounterTracker exists for, and SensorSession applies it automatically, emitting derived speed and cadence samples. Use this parser directly only if you are doing that arithmetic yourself.

Methods

public static CscMeasurement parse(byte[] value)Decodes a 0x2A5B value.
public long getWheelRevolutions()Cumulative wheel revolutions, or -1 when absent.
public int getLastWheelEventTime()The wheel-event timestamp in 1/1024-second units, or -1 when absent.
public int getCrankRevolutions()Cumulative crank revolutions, or -1 when absent.
public int getLastCrankEventTime()The crank-event timestamp in 1/1024-second units, or -1 when absent.
public boolean hasWheelData()true when this notification carried wheel data.
public boolean hasCrankData()true when this notification carried crank data.
public String toString()Returns a string representation of the object.

Inherited methods

Method details

parse

public static CscMeasurement parse(byte[] value)
Decodes a 0x2A5B value. Returns null for a malformed or truncated payload; never throws.

getWheelRevolutions

public long getWheelRevolutions()
Cumulative wheel revolutions, or -1 when absent. Wraps at 2^32.

getLastWheelEventTime

public int getLastWheelEventTime()
The wheel-event timestamp in 1/1024-second units, or -1 when absent. Wraps roughly every 64 seconds.

getCrankRevolutions

public int getCrankRevolutions()
Cumulative crank revolutions, or -1 when absent. Wraps at 2^16.

getLastCrankEventTime

public int getLastCrankEventTime()
The crank-event timestamp in 1/1024-second units, or -1 when absent. Wraps roughly every 64 seconds.

hasWheelData

public boolean hasWheelData()
true when this notification carried wheel data.

hasCrankData

public boolean hasCrankData()
true when this notification carried crank data.

toString

public String toString()
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())