src.bluetooth_sig.gatt.characteristics.cross_trainer_data

Cross Trainer Data characteristic implementation.

Implements the Cross Trainer Data characteristic (0x2ACE) from the Fitness Machine Service. A 24-bit flags field (3 bytes) controls the presence of optional data fields – the widest flags field in the fitness machine set.

Bit 0 (“More Data”) uses inverted logic: when bit 0 is 0 the Instantaneous Speed field IS present; when bit 0 is 1 it is absent. All other presence bits use normal logic (1 = present).

Bit 15 is a semantic bit (Movement Direction): 0 = Forward, 1 = Backward. It does NOT gate any data fields.

References

Bluetooth SIG Fitness Machine Service 1.0 org.bluetooth.characteristic.cross_trainer_data (GSS YAML)

Classes

Name

Description

CrossTrainerData

Parsed data from Cross Trainer Data characteristic.

CrossTrainerDataCharacteristic

Cross Trainer Data characteristic (0x2ACE).

CrossTrainerDataFlags

Cross Trainer Data flags as per Bluetooth SIG specification.

Module Contents

class src.bluetooth_sig.gatt.characteristics.cross_trainer_data.CrossTrainerData

Bases: msgspec.Struct

Parsed data from Cross Trainer Data characteristic.

flags

Raw 24-bit flags field.

instantaneous_speed

Instantaneous speed in km/h (0.01 resolution).

average_speed

Average speed in km/h (0.01 resolution).

total_distance

Total distance in metres (uint24).

steps_per_minute

Steps per minute.

average_step_rate

Average step rate in steps/min.

stride_count

Stride count (0.1 resolution, a stride is a pair of steps).

positive_elevation_gain

Positive elevation gain in metres.

negative_elevation_gain

Negative elevation gain in metres.

inclination

Current inclination in % (0.1 resolution, signed).

ramp_setting

Current ramp angle in degrees (0.1 resolution, signed).

resistance_level

Resistance level (unitless, resolution 10).

instantaneous_power

Instantaneous power in watts (signed).

average_power

Average power in watts (signed).

total_energy

Total expended energy in kcal.

energy_per_hour

Expended energy per hour in kcal.

energy_per_minute

Expended energy per minute in kcal.

heart_rate

Heart rate in bpm.

metabolic_equivalent

MET value (0.1 resolution).

elapsed_time

Elapsed time in seconds.

remaining_time

Remaining time in seconds.

movement_direction_backward

True if movement is backward, False if forward.

average_power: int | None = None
average_speed: float | None = None
average_step_rate: int | None = None
elapsed_time: int | None = None
energy_per_hour: int | None = None
energy_per_minute: int | None = None
flags: CrossTrainerDataFlags
heart_rate: int | None = None
inclination: float | None = None
instantaneous_power: int | None = None
instantaneous_speed: float | None = None
metabolic_equivalent: float | None = None
movement_direction_backward: bool = False
negative_elevation_gain: int | None = None
positive_elevation_gain: int | None = None
ramp_setting: float | None = None
remaining_time: int | None = None
resistance_level: float | None = None
steps_per_minute: int | None = None
stride_count: float | None = None
total_distance: int | None = None
total_energy: int | None = None
class src.bluetooth_sig.gatt.characteristics.cross_trainer_data.CrossTrainerDataCharacteristic(info: src.bluetooth_sig.types.CharacteristicInfo | None = None, validation: src.bluetooth_sig.gatt.characteristics.characteristic_meta.ValidationConfig | None = None)

Bases: src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[CrossTrainerData]

Cross Trainer Data characteristic (0x2ACE).

Used in the Fitness Machine Service to transmit cross trainer workout data. A 24-bit flags field (3 bytes) controls which optional fields are present – the widest flags field in the fitness machine set.

Flag-bit assignments (from GSS YAML):

Bit 0: More Data – inverted: 0 -> Inst. Speed present, 1 -> absent Bit 1: Average Speed present Bit 2: Total Distance present Bit 3: Step Count present (gates Steps/Min + Avg Step Rate) Bit 4: Stride Count present Bit 5: Elevation Gain present (gates Pos + Neg) Bit 6: Inclination and Ramp Angle Setting present (gates 2 fields) Bit 7: Resistance Level present Bit 8: Instantaneous Power present Bit 9: Average Power present Bit 10: Expended Energy present (gates triplet: total + /hr + /min) Bit 11: Heart Rate present Bit 12: Metabolic Equivalent present Bit 13: Elapsed Time present Bit 14: Remaining Time present Bit 15: Movement Direction (0=Forward, 1=Backward) – semantic, not presence Bits 16-23: Reserved for Future Use

allow_variable_length: bool = True
expected_type
min_length: int = 3
class src.bluetooth_sig.gatt.characteristics.cross_trainer_data.CrossTrainerDataFlags

Bases: enum.IntFlag

Cross Trainer Data flags as per Bluetooth SIG specification.

24-bit flags field (3 bytes). Bit 0 uses inverted logic: 0 = Instantaneous Speed present, 1 = absent. Bit 15 is a semantic modifier (Movement Direction), not a presence flag.

AVERAGE_POWER_PRESENT = 512
AVERAGE_SPEED_PRESENT = 2
ELAPSED_TIME_PRESENT = 8192
ELEVATION_GAIN_PRESENT = 32
EXPENDED_ENERGY_PRESENT = 1024
HEART_RATE_PRESENT = 2048
INCLINATION_AND_RAMP_PRESENT = 64
INSTANTANEOUS_POWER_PRESENT = 256
METABOLIC_EQUIVALENT_PRESENT = 4096
MORE_DATA = 1
MOVEMENT_DIRECTION_BACKWARD = 32768
REMAINING_TIME_PRESENT = 16384
RESISTANCE_LEVEL_PRESENT = 128
STEP_COUNT_PRESENT = 8
STRIDE_COUNT_PRESENT = 16
TOTAL_DISTANCE_PRESENT = 4