Class CscMeasurement
java.lang.Object
com.codename1.health.sensors.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.
-
Method Summary
Modifier and TypeMethodDescriptionintCumulative crank revolutions, or-1when absent.intThe crank-event timestamp in 1/1024-second units, or-1when absent.intThe wheel-event timestamp in 1/1024-second units, or-1when absent.longCumulative wheel revolutions, or-1when absent.booleantruewhen this notification carried crank data.booleantruewhen this notification carried wheel data.static CscMeasurementparse(byte[] value) Decodes a0x2A5Bvalue.toString()Returns a string representation of the object.
-
Method Details
-
parse
Decodes a0x2A5Bvalue. Returnsnullfor a malformed or truncated payload; never throws. -
getWheelRevolutions
public long getWheelRevolutions()Cumulative wheel revolutions, or-1when absent. Wraps at 2^32. -
getLastWheelEventTime
public int getLastWheelEventTime()The wheel-event timestamp in 1/1024-second units, or-1when absent. Wraps roughly every 64 seconds. -
getCrankRevolutions
public int getCrankRevolutions()Cumulative crank revolutions, or-1when absent. Wraps at 2^16. -
getLastCrankEventTime
public int getLastCrankEventTime()The crank-event timestamp in 1/1024-second units, or-1when absent. Wraps roughly every 64 seconds. -
hasWheelData
public boolean hasWheelData()truewhen this notification carried wheel data. -
hasCrankData
public boolean hasCrankData()truewhen this notification carried crank data. -
toString
Description copied from class:ObjectReturns 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())
-