src.bluetooth_sig.gatt.characteristics.indoor_bike_data

Indoor Bike Data characteristic implementation.

Implements the Indoor Bike Data characteristic (0x2AD2) 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.indoor_bike_data (GSS YAML)

Classes

Name

Description

IndoorBikeData

Parsed data from Indoor Bike Data characteristic.

IndoorBikeDataCharacteristic

Indoor Bike Data characteristic (0x2AD2).

IndoorBikeDataFlags

Indoor Bike Data flags as per Bluetooth SIG specification.

Module Contents

class src.bluetooth_sig.gatt.characteristics.indoor_bike_data.IndoorBikeData

Bases: msgspec.Struct

Parsed data from Indoor Bike Data characteristic.

flags

Raw 16-bit flags field.

instantaneous_speed

Instantaneous speed in km/h (0.01 resolution).

average_speed

Average speed in km/h (0.01 resolution).

instantaneous_cadence

Instantaneous cadence in rpm (0.5 resolution).

average_cadence

Average cadence in rpm (0.5 resolution).

total_distance

Total distance in metres (uint24).

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.

average_cadence: float | None = None
average_power: 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: IndoorBikeDataFlags
heart_rate: int | None = None
instantaneous_cadence: float | None = None
instantaneous_power: int | None = None
instantaneous_speed: float | None = None
metabolic_equivalent: float | None = None
remaining_time: int | None = None
resistance_level: float | None = None
total_distance: int | None = None
total_energy: int | None = None
class src.bluetooth_sig.gatt.characteristics.indoor_bike_data.IndoorBikeDataCharacteristic(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[IndoorBikeData]

Indoor Bike Data characteristic (0x2AD2).

Used in the Fitness Machine Service to transmit indoor bike 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: Instantaneous Cadence present Bit 3: Average Cadence present Bit 4: Total Distance present Bit 5: Resistance Level present Bit 6: Instantaneous Power present Bit 7: Average Power present Bit 8: Expended Energy present (gates triplet: total + /hr + /min) Bit 9: Heart Rate present Bit 10: Metabolic Equivalent present Bit 11: Elapsed Time present Bit 12: Remaining Time present Bits 13-15: Reserved for Future Use

allow_variable_length: bool = True
expected_type
min_length: int = 2
class src.bluetooth_sig.gatt.characteristics.indoor_bike_data.IndoorBikeDataFlags

Bases: enum.IntFlag

Indoor Bike Data flags as per Bluetooth SIG specification.

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

AVERAGE_CADENCE_PRESENT = 8
AVERAGE_POWER_PRESENT = 128
AVERAGE_SPEED_PRESENT = 2
ELAPSED_TIME_PRESENT = 2048
EXPENDED_ENERGY_PRESENT = 256
HEART_RATE_PRESENT = 512
INSTANTANEOUS_CADENCE_PRESENT = 4
INSTANTANEOUS_POWER_PRESENT = 64
METABOLIC_EQUIVALENT_PRESENT = 1024
MORE_DATA = 1
REMAINING_TIME_PRESENT = 4096
RESISTANCE_LEVEL_PRESENT = 32
TOTAL_DISTANCE_PRESENT = 16