src.bluetooth_sig.gatt.characteristics.treadmill_data

Treadmill Data characteristic implementation.

Implements the Treadmill Data characteristic (0x2ACD) from the Fitness Machine Service. A 16-bit flags field controls the presence of optional data fields.

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 bits use normal logic (1 = present).

References

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

Classes

Name

Description

TreadmillData

Parsed data from Treadmill Data characteristic.

TreadmillDataCharacteristic

Treadmill Data characteristic (0x2ACD).

TreadmillDataFlags

Treadmill Data flags as per Bluetooth SIG specification.

Module Contents

class src.bluetooth_sig.gatt.characteristics.treadmill_data.TreadmillData

Bases: msgspec.Struct

Parsed data from Treadmill Data characteristic.

flags

Raw 16-bit flags field.

instantaneous_speed

Instantaneous belt speed in km/h (0.01 resolution).

average_speed

Average speed in km/h (0.01 resolution).

total_distance

Total distance in metres (uint24).

inclination

Current inclination in % (0.1 resolution, signed).

ramp_angle_setting

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

positive_elevation_gain

Positive elevation gain in metres (0.1 resolution).

negative_elevation_gain

Negative elevation gain in metres (0.1 resolution).

instantaneous_pace

Instantaneous pace in seconds per 500 m.

average_pace

Average pace in seconds per 500 m.

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.

force_on_belt

Force on belt in newtons (signed).

power_output

Power output in watts (signed).

average_pace: int | None = None
average_speed: float | None = None
elapsed_time: int | None = None
energy_per_hour: int | None = None
energy_per_minute: int | None = None
flags: TreadmillDataFlags
force_on_belt: int | None = None
heart_rate: int | None = None
inclination: float | None = None
instantaneous_pace: int | None = None
instantaneous_speed: float | None = None
metabolic_equivalent: float | None = None
negative_elevation_gain: float | None = None
positive_elevation_gain: float | None = None
power_output: int | None = None
ramp_angle_setting: float | None = None
remaining_time: int | None = None
total_distance: int | None = None
total_energy: int | None = None
class src.bluetooth_sig.gatt.characteristics.treadmill_data.TreadmillDataCharacteristic(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[TreadmillData]

Treadmill Data characteristic (0x2ACD).

Used in the Fitness Machine Service to transmit treadmill workout data. A 16-bit flags field controls which optional fields are present.

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: Inclination and Ramp Angle Setting present (gates 2 fields) Bit 4: Elevation Gain present (gates 2 fields: pos + neg) Bit 5: Instantaneous Pace present Bit 6: Average Pace present Bit 7: Expended Energy present (gates triplet: total + /hr + /min) Bit 8: Heart Rate present Bit 9: Metabolic Equivalent present Bit 10: Elapsed Time present Bit 11: Remaining Time present Bit 12: Force On Belt and Power Output present (gates 2 fields) Bits 13-15: Reserved for Future Use

allow_variable_length: bool = True
expected_type
min_length: int = 2
class src.bluetooth_sig.gatt.characteristics.treadmill_data.TreadmillDataFlags

Bases: enum.IntFlag

Treadmill Data flags as per Bluetooth SIG specification.

Bit 0 uses inverted logic: 0 = Instantaneous Speed present, 1 = absent.

AVERAGE_PACE_PRESENT = 64
AVERAGE_SPEED_PRESENT = 2
ELAPSED_TIME_PRESENT = 1024
ELEVATION_GAIN_PRESENT = 16
EXPENDED_ENERGY_PRESENT = 128
FORCE_AND_POWER_PRESENT = 4096
HEART_RATE_PRESENT = 256
INCLINATION_AND_RAMP_PRESENT = 8
INSTANTANEOUS_PACE_PRESENT = 32
METABOLIC_EQUIVALENT_PRESENT = 512
MORE_DATA = 1
REMAINING_TIME_PRESENT = 2048
TOTAL_DISTANCE_PRESENT = 4