src.bluetooth_sig.gatt.characteristics.glucose_measurement_context

Glucose Measurement Context characteristic implementation.

Attributes

Name

Description

logger

Classes

Name

Description

CarbohydrateResult

Carbohydrate information parsing result.

CarbohydrateType

Carbohydrate type enumeration as per Bluetooth SIG specification.

ExerciseResult

Exercise information parsing result.

ExtendedFlagsResult

Extended flags parsing result.

GlucoseMeasurementContextBits

Glucose Measurement Context bit field constants.

GlucoseMeasurementContextCharacteristic

Glucose Measurement Context characteristic (0x2A34).

GlucoseMeasurementContextData

Parsed data from Glucose Measurement Context characteristic.

GlucoseMeasurementContextExtendedFlags

Glucose Measurement Context Extended Flags constants as per Bluetooth SIG specification.

GlucoseMeasurementContextFlags

Glucose Measurement Context flags as per Bluetooth SIG specification.

GlucoseTester

Glucose tester type enumeration as per Bluetooth SIG specification.

HealthType

Health type enumeration as per Bluetooth SIG specification.

MealResult

Meal information parsing result.

MealType

Meal type enumeration as per Bluetooth SIG specification.

MedicationResult

Medication information parsing result.

MedicationType

Medication type enumeration as per Bluetooth SIG specification.

TesterHealthResult

Tester and health information parsing result.

Module Contents

class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.CarbohydrateResult

Bases: msgspec.Struct

Carbohydrate information parsing result.

carbohydrate_id: CarbohydrateType | None
carbohydrate_kg: float | None
offset: int
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.CarbohydrateType

Bases: enum.IntEnum

Carbohydrate type enumeration as per Bluetooth SIG specification.

BREAKFAST = 1
BRUNCH = 7
DINNER = 3
DRINK = 5
LUNCH = 2
SNACK = 4
SUPPER = 6
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.ExerciseResult

Bases: msgspec.Struct

Exercise information parsing result.

exercise_duration_seconds: int | None
exercise_intensity_percent: int | None
offset: int
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.ExtendedFlagsResult

Bases: msgspec.Struct

Extended flags parsing result.

extended_flags: int | None
offset: int
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseMeasurementContextBits

Glucose Measurement Context bit field constants.

HEALTH_BIT_WIDTH = 4
HEALTH_START_BIT = 0
TESTER_BIT_WIDTH = 4
TESTER_START_BIT = 4
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseMeasurementContextCharacteristic

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

Glucose Measurement Context characteristic (0x2A34).

Used to transmit additional context for glucose measurements including carbohydrate intake, exercise, medication, and HbA1c information.

SIG Specification Pattern: This characteristic depends on Glucose Measurement (0x2A18) for sequence number matching. The sequence_number field in this context must match the sequence_number from a corresponding Glucose Measurement characteristic.

allow_variable_length: bool = True
max_length: int | None = 19
min_length: int | None = 3
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseMeasurementContextData

Bases: msgspec.Struct

Parsed data from Glucose Measurement Context characteristic.

Used for both parsing and encoding - None values represent optional fields.

carbohydrate_id: CarbohydrateType | None = None
carbohydrate_kg: float | None = None
exercise_duration_seconds: int | None = None
exercise_intensity_percent: int | None = None
extended_flags: int | None = None
flags: GlucoseMeasurementContextFlags
hba1c_percent: float | None = None
health: HealthType | None = None
meal: MealType | None = None
medication_id: MedicationType | None = None
medication_kg: float | None = None
sequence_number: int
tester: GlucoseTester | None = None
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseMeasurementContextExtendedFlags

Bases: enum.IntEnum

Glucose Measurement Context Extended Flags constants as per Bluetooth SIG specification.

Currently all bits are reserved for future use.

static get_description(flags: int) str

Get description of extended flags.

Parameters:

flags – Extended flags value (0-255)

Returns:

Description string indicating all bits are reserved

RESERVED_BIT_0 = 1
RESERVED_BIT_1 = 2
RESERVED_BIT_2 = 4
RESERVED_BIT_3 = 8
RESERVED_BIT_4 = 16
RESERVED_BIT_5 = 32
RESERVED_BIT_6 = 64
RESERVED_BIT_7 = 128
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseMeasurementContextFlags

Bases: enum.IntFlag

Glucose Measurement Context flags as per Bluetooth SIG specification.

CARBOHYDRATE_PRESENT = 2
EXERCISE_PRESENT = 16
EXTENDED_FLAGS_PRESENT = 1
HBA1C_PRESENT = 64
MEAL_PRESENT = 4
MEDICATION_PRESENT = 32
RESERVED = 128
TESTER_HEALTH_PRESENT = 8
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.GlucoseTester

Bases: enum.IntEnum

Glucose tester type enumeration as per Bluetooth SIG specification.

HEALTH_CARE_PROFESSIONAL = 2
LAB_TEST = 3
NOT_AVAILABLE = 15
SELF = 1
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.HealthType

Bases: enum.IntEnum

Health type enumeration as per Bluetooth SIG specification.

DURING_MENSES = 3
MAJOR_HEALTH_ISSUES = 2
MINOR_HEALTH_ISSUES = 1
NOT_AVAILABLE = 15
NO_HEALTH_ISSUES = 5
UNDER_STRESS = 4
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.MealResult

Bases: msgspec.Struct

Meal information parsing result.

meal: MealType | None
offset: int
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.MealType

Bases: enum.IntEnum

Meal type enumeration as per Bluetooth SIG specification.

BEDTIME = 5
CASUAL = 4
FASTING = 3
POSTPRANDIAL = 2
PREPRANDIAL = 1
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.MedicationResult

Bases: msgspec.Struct

Medication information parsing result.

medication_id: MedicationType | None
medication_kg: float | None
offset: int
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.MedicationType

Bases: enum.IntEnum

Medication type enumeration as per Bluetooth SIG specification.

INTERMEDIATE_ACTING_INSULIN = 3
LONG_ACTING_INSULIN = 4
PRE_MIXED_INSULIN = 5
RAPID_ACTING_INSULIN = 1
SHORT_ACTING_INSULIN = 2
class src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.TesterHealthResult

Bases: msgspec.Struct

Tester and health information parsing result.

health: HealthType | None
offset: int
tester: GlucoseTester | None
src.bluetooth_sig.gatt.characteristics.glucose_measurement_context.logger