public final class CyclingPowerMeasurement
- Object
- 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.
Methods
public static CyclingPowerMeasurement parse(byte[] value) | Decodes a 0x2A63 value. |
public int getInstantaneousPowerWatts() | Instantaneous power in watts. |
public boolean isPedalPowerBalanceLeft() | Whether getPedalPowerBalancePercent() is measured against the left pedal. |
public double getPedalPowerBalancePercent() | The share of power contributed by one pedal, as a percentage, or Double.NaN when absent. |
public long getWheelRevolutions() | Cumulative wheel revolutions since the meter powered on, or -1 when absent. |
public int getLastWheelEventTime() | The wheel-event timestamp in 1/2048-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 int getAccumulatedEnergyKilojoules() | Total energy in kilojoules since the meter powered on, or -1 when absent. |
public boolean hasCrankData() | true when this notification carried crank data, from which cadence can be derived. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Method details
parse
public static CyclingPowerMeasurement parse(byte[] value)0x2A63 value. Returns null for a malformed or
truncated payload; never throws.getInstantaneousPowerWatts
public int getInstantaneousPowerWatts()isPedalPowerBalanceLeft
public boolean isPedalPowerBalanceLeft()Whether getPedalPowerBalancePercent() is measured against the
left pedal.
false also means “the meter did not say”, which is not the same
as “the right pedal” – check
getPedalPowerBalancePercent() for NaN first to tell an absent
reading from an unqualified one.
getPedalPowerBalancePercent
public double getPedalPowerBalancePercent()Double.NaN when absent. Which pedal it refers to is reported by
isPedalPowerBalanceLeft(); most meters report the left.getWheelRevolutions
public long getWheelRevolutions()-1
when absent. Wraps at 2^32.getLastWheelEventTime
public int getLastWheelEventTime()-1 when
absent. Wraps roughly every 32 seconds.getCrankRevolutions
public int getCrankRevolutions()-1 when absent. Wraps at 2^16.getLastCrankEventTime
public int getLastCrankEventTime()-1 when
absent. Wraps roughly every 64 seconds.getAccumulatedEnergyKilojoules
public int getAccumulatedEnergyKilojoules()-1 when
absent.hasCrankData
public boolean hasCrankData()true when this notification carried crank data, from which
cadence can be derived.toString
public String toString()