Class CyclingPowerMeasurement
A decoded Cycling Power Measurement, characteristic 0x2A63.
Wire format
Unlike most SIG characteristics the flags field here is a uint16,
not a single byte, because the profile defines sixteen optional fields.
It is followed immediately by the instantaneous power.
Instantaneous power is signed
The power field is sint16, and negative values are real: a power
meter reports negative watts when the rider is back-pedalling or the
drivetrain is driving the cranks on a descent. Reading it as unsigned
turns a brief -5 W into 65531 W, which then poisons every average and
maximum for the whole ride.
This parser exposes the common fields -- instantaneous power, accumulated energy, pedal balance, crank revolutions. The remaining optional fields are skipped in order so that the fields after them still decode correctly.
-
Method Summary
Modifier and TypeMethodDescriptionintTotal energy in kilojoules since the meter powered on, or-1when absent.intCumulative crank revolutions, or-1when absent.intInstantaneous power in watts.intThe crank-event timestamp in 1/1024-second units, or-1when absent.intThe wheel-event timestamp in 1/2048-second units, or-1when absent.doubleThe share of power contributed by one pedal, as a percentage, orDouble.NaNwhen absent.longCumulative wheel revolutions since the meter powered on, or-1when absent.booleantruewhen this notification carried crank data, from which cadence can be derived.static CyclingPowerMeasurementparse(byte[] value) Decodes a0x2A63value.toString()Returns a string representation of the object.
-
Method Details
-
parse
Decodes a0x2A63value. Returnsnullfor a malformed or truncated payload; never throws. -
getInstantaneousPowerWatts
public int getInstantaneousPowerWatts()Instantaneous power in watts. May be negative -- see the class documentation. -
getPedalPowerBalancePercent
public double getPedalPowerBalancePercent()The share of power contributed by one pedal, as a percentage, orDouble.NaNwhen absent. Which pedal it refers to depends on the reference bit; most meters report the left. -
getWheelRevolutions
public long getWheelRevolutions()Cumulative wheel revolutions since the meter powered on, or-1when absent. Wraps at 2^32. -
getLastWheelEventTime
public int getLastWheelEventTime()The wheel-event timestamp in 1/2048-second units, or-1when absent. Wraps roughly every 32 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. -
getAccumulatedEnergyKilojoules
public int getAccumulatedEnergyKilojoules()Total energy in kilojoules since the meter powered on, or-1when absent. -
hasCrankData
public boolean hasCrankData()truewhen this notification carried crank data, from which cadence can be derived. -
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())
-