From 99dd293c48ef9691bece81a6e46937661a113098 Mon Sep 17 00:00:00 2001 From: Tom Goetz Date: Sat, 27 Feb 2021 13:45:00 -0500 Subject: [PATCH] add parsing of heart rate zones msssage 216 --- definition_message_data.py | 10 ++++++++++ enum_fields.py | 15 +++++++++++++++ field_enums.py | 15 +++++++++++++++ message_type.py | 4 +++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/definition_message_data.py b/definition_message_data.py index b8dc784..5f1d7c9 100644 --- a/definition_message_data.py +++ b/definition_message_data.py @@ -765,6 +765,16 @@ class DefinitionMessageData(): MessageType.magnetometer_data : {}, MessageType.barometer_data : {}, MessageType.one_d_sensor_calibration : {}, + MessageType.hr_zones_timer : { + 0 : enum_fields.HeartRateZonesTimerTypeField(), + 1 : type_fields.IntegerField('record_num'), + 2 : type_fields.IntegerField('total_beats_per_zone'), + 6 : type_fields.IntegerField('hr_zones'), + 10: enum_fields.HeartRateZonesMethodField(), + 11 : type_fields.HeartRateField('max_heart_rate'), + 12 : type_fields.HeartRateField('min_heart_rate'), + 13 : type_fields.HeartRateField('lactate_threshhold_heart_rate') + }, MessageType.set : {}, MessageType.stress_level : { 0 : fields.NamedField('stress_level'), diff --git a/enum_fields.py b/enum_fields.py index 34e9b20..298d303 100644 --- a/enum_fields.py +++ b/enum_fields.py @@ -113,3 +113,18 @@ class ClimbProEventField(EnumField): _name = 'climb_pro_event' _enum = fe.ClimbProEvent + + +class HeartRateZonesTimerTypeField(EnumField): + """A field that contains the type of the Heart Rate Zone Timer.""" + + + _name = 'hr_zones_timer_type' + _enum = fe.HeartRateZonesTimerType + + +class HeartRateZonesMethodField(EnumField): + """A field that contains the method used to calculate the heart rate zones.""" + + _name = 'hr_zones_method' + _enum = fe.HeartRateZonesMethod diff --git a/field_enums.py b/field_enums.py index 6e38bb5..43b0850 100644 --- a/field_enums.py +++ b/field_enums.py @@ -494,3 +494,18 @@ class ClimbProEvent(FieldEnum): approach = 0 start = 1 complete = 2 + + +class HeartRateZonesTimerType(FieldEnum): + """Gives the type of the Heart Rate Zone Timer.""" + + session = 18 + lap = 19 + + +class HeartRateZonesMethod(FieldEnum): + """Gives the method used to calculate the heart rate zones.""" + + max_heart_rate = 1 + heart_rate_reserve = 2 + lactate_threshhold = 3 diff --git a/message_type.py b/message_type.py index 745bc51..6358a65 100644 --- a/message_type.py +++ b/message_type.py @@ -152,7 +152,9 @@ class MessageType(enum.Enum): magnetometer_data = 208 barometer_data = 209 one_d_sensor_calibration = 210 - # 211-224 not known + # 211-215 not known + hr_zones_timer = 216 + # 217-224 not known set = 225 # 226 not known stress_level = 227