fit-sdk-rust 0.2.1

Pure-Rust implementation of the Garmin FIT (Flexible and Interoperable Data Transfer) protocol.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
// @generated by fit-codegen. DO NOT EDIT.
// Source: guide/garmin_fit_guide/Profile.xlsx

//! `MesgNum` — global message numbers from the Types sheet.
//!
//! Lifted out of `types.rs` because the runtime uses it ubiquitously
//! (every Definition Message carries one, every lookup keys on it).

#![allow(non_camel_case_types, dead_code, clippy::should_implement_trait)]

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u16)]
#[non_exhaustive]
pub enum MesgNum {
    FileId = 0,
    Capabilities = 1,
    DeviceSettings = 2,
    UserProfile = 3,
    HrmProfile = 4,
    SdmProfile = 5,
    BikeProfile = 6,
    ZonesTarget = 7,
    HrZone = 8,
    PowerZone = 9,
    MetZone = 10,
    Sport = 12,
    TrainingSettings = 13,
    Goal = 15,
    Session = 18,
    Lap = 19,
    Record = 20,
    Event = 21,
    DeviceInfo = 23,
    Workout = 26,
    WorkoutStep = 27,
    Schedule = 28,
    WeightScale = 30,
    Course = 31,
    CoursePoint = 32,
    Totals = 33,
    Activity = 34,
    Software = 35,
    FileCapabilities = 37,
    MesgCapabilities = 38,
    FieldCapabilities = 39,
    FileCreator = 49,
    BloodPressure = 51,
    SpeedZone = 53,
    Monitoring = 55,
    TrainingFile = 72,
    Hrv = 78,
    AntRx = 80,
    AntTx = 81,
    AntChannelId = 82,
    Length = 101,
    MonitoringInfo = 103,
    Pad = 105,
    SlaveDevice = 106,
    Connectivity = 127,
    WeatherConditions = 128,
    WeatherAlert = 129,
    CadenceZone = 131,
    Hr = 132,
    SegmentLap = 142,
    MemoGlob = 145,
    SegmentId = 148,
    SegmentLeaderboardEntry = 149,
    SegmentPoint = 150,
    SegmentFile = 151,
    WorkoutSession = 158,
    WatchfaceSettings = 159,
    GpsMetadata = 160,
    CameraEvent = 161,
    TimestampCorrelation = 162,
    GyroscopeData = 164,
    AccelerometerData = 165,
    ThreeDSensorCalibration = 167,
    VideoFrame = 169,
    ObdiiData = 174,
    NmeaSentence = 177,
    AviationAttitude = 178,
    Video = 184,
    VideoTitle = 185,
    VideoDescription = 186,
    VideoClip = 187,
    OhrSettings = 188,
    ExdScreenConfiguration = 200,
    ExdDataFieldConfiguration = 201,
    ExdDataConceptConfiguration = 202,
    FieldDescription = 206,
    DeveloperDataId = 207,
    MagnetometerData = 208,
    BarometerData = 209,
    OneDSensorCalibration = 210,
    MonitoringHrData = 211,
    TimeInZone = 216,
    Set = 225,
    StressLevel = 227,
    MaxMetData = 229,
    DiveSettings = 258,
    DiveGas = 259,
    DiveAlarm = 262,
    ExerciseTitle = 264,
    DiveSummary = 268,
    Spo2Data = 269,
    SleepLevel = 275,
    Jump = 285,
    AadAccelFeatures = 289,
    BeatIntervals = 290,
    RespirationRate = 297,
    HsaAccelerometerData = 302,
    HsaStepData = 304,
    HsaSpo2Data = 305,
    HsaStressData = 306,
    HsaRespirationData = 307,
    HsaHeartRateData = 308,
    Split = 312,
    SplitSummary = 313,
    HsaBodyBatteryData = 314,
    HsaEvent = 315,
    ClimbPro = 317,
    TankUpdate = 319,
    TankSummary = 323,
    SleepAssessment = 346,
    HrvStatusSummary = 370,
    HrvValue = 371,
    RawBbi = 372,
    DeviceAuxBatteryInfo = 375,
    HsaGyroscopeData = 376,
    ChronoShotSession = 387,
    ChronoShotData = 388,
    HsaConfigurationData = 389,
    DiveApneaAlarm = 393,
    SkinTempOvernight = 398,
    HsaWristTemperatureData = 409,
    NapEvent = 412,
    SleepDisruptionSeverityPeriod = 470,
    SleepDisruptionOvernightSeverity = 471,
    MfgRangeMin = 65280,
    MfgRangeMax = 65534,
}

impl MesgNum {
    /// Snake-case canonical name from Profile.xlsx.
    pub fn as_str(&self) -> &'static str {
        match self {
            MesgNum::FileId => "file_id",
            MesgNum::Capabilities => "capabilities",
            MesgNum::DeviceSettings => "device_settings",
            MesgNum::UserProfile => "user_profile",
            MesgNum::HrmProfile => "hrm_profile",
            MesgNum::SdmProfile => "sdm_profile",
            MesgNum::BikeProfile => "bike_profile",
            MesgNum::ZonesTarget => "zones_target",
            MesgNum::HrZone => "hr_zone",
            MesgNum::PowerZone => "power_zone",
            MesgNum::MetZone => "met_zone",
            MesgNum::Sport => "sport",
            MesgNum::TrainingSettings => "training_settings",
            MesgNum::Goal => "goal",
            MesgNum::Session => "session",
            MesgNum::Lap => "lap",
            MesgNum::Record => "record",
            MesgNum::Event => "event",
            MesgNum::DeviceInfo => "device_info",
            MesgNum::Workout => "workout",
            MesgNum::WorkoutStep => "workout_step",
            MesgNum::Schedule => "schedule",
            MesgNum::WeightScale => "weight_scale",
            MesgNum::Course => "course",
            MesgNum::CoursePoint => "course_point",
            MesgNum::Totals => "totals",
            MesgNum::Activity => "activity",
            MesgNum::Software => "software",
            MesgNum::FileCapabilities => "file_capabilities",
            MesgNum::MesgCapabilities => "mesg_capabilities",
            MesgNum::FieldCapabilities => "field_capabilities",
            MesgNum::FileCreator => "file_creator",
            MesgNum::BloodPressure => "blood_pressure",
            MesgNum::SpeedZone => "speed_zone",
            MesgNum::Monitoring => "monitoring",
            MesgNum::TrainingFile => "training_file",
            MesgNum::Hrv => "hrv",
            MesgNum::AntRx => "ant_rx",
            MesgNum::AntTx => "ant_tx",
            MesgNum::AntChannelId => "ant_channel_id",
            MesgNum::Length => "length",
            MesgNum::MonitoringInfo => "monitoring_info",
            MesgNum::Pad => "pad",
            MesgNum::SlaveDevice => "slave_device",
            MesgNum::Connectivity => "connectivity",
            MesgNum::WeatherConditions => "weather_conditions",
            MesgNum::WeatherAlert => "weather_alert",
            MesgNum::CadenceZone => "cadence_zone",
            MesgNum::Hr => "hr",
            MesgNum::SegmentLap => "segment_lap",
            MesgNum::MemoGlob => "memo_glob",
            MesgNum::SegmentId => "segment_id",
            MesgNum::SegmentLeaderboardEntry => "segment_leaderboard_entry",
            MesgNum::SegmentPoint => "segment_point",
            MesgNum::SegmentFile => "segment_file",
            MesgNum::WorkoutSession => "workout_session",
            MesgNum::WatchfaceSettings => "watchface_settings",
            MesgNum::GpsMetadata => "gps_metadata",
            MesgNum::CameraEvent => "camera_event",
            MesgNum::TimestampCorrelation => "timestamp_correlation",
            MesgNum::GyroscopeData => "gyroscope_data",
            MesgNum::AccelerometerData => "accelerometer_data",
            MesgNum::ThreeDSensorCalibration => "three_d_sensor_calibration",
            MesgNum::VideoFrame => "video_frame",
            MesgNum::ObdiiData => "obdii_data",
            MesgNum::NmeaSentence => "nmea_sentence",
            MesgNum::AviationAttitude => "aviation_attitude",
            MesgNum::Video => "video",
            MesgNum::VideoTitle => "video_title",
            MesgNum::VideoDescription => "video_description",
            MesgNum::VideoClip => "video_clip",
            MesgNum::OhrSettings => "ohr_settings",
            MesgNum::ExdScreenConfiguration => "exd_screen_configuration",
            MesgNum::ExdDataFieldConfiguration => "exd_data_field_configuration",
            MesgNum::ExdDataConceptConfiguration => "exd_data_concept_configuration",
            MesgNum::FieldDescription => "field_description",
            MesgNum::DeveloperDataId => "developer_data_id",
            MesgNum::MagnetometerData => "magnetometer_data",
            MesgNum::BarometerData => "barometer_data",
            MesgNum::OneDSensorCalibration => "one_d_sensor_calibration",
            MesgNum::MonitoringHrData => "monitoring_hr_data",
            MesgNum::TimeInZone => "time_in_zone",
            MesgNum::Set => "set",
            MesgNum::StressLevel => "stress_level",
            MesgNum::MaxMetData => "max_met_data",
            MesgNum::DiveSettings => "dive_settings",
            MesgNum::DiveGas => "dive_gas",
            MesgNum::DiveAlarm => "dive_alarm",
            MesgNum::ExerciseTitle => "exercise_title",
            MesgNum::DiveSummary => "dive_summary",
            MesgNum::Spo2Data => "spo2_data",
            MesgNum::SleepLevel => "sleep_level",
            MesgNum::Jump => "jump",
            MesgNum::AadAccelFeatures => "aad_accel_features",
            MesgNum::BeatIntervals => "beat_intervals",
            MesgNum::RespirationRate => "respiration_rate",
            MesgNum::HsaAccelerometerData => "hsa_accelerometer_data",
            MesgNum::HsaStepData => "hsa_step_data",
            MesgNum::HsaSpo2Data => "hsa_spo2_data",
            MesgNum::HsaStressData => "hsa_stress_data",
            MesgNum::HsaRespirationData => "hsa_respiration_data",
            MesgNum::HsaHeartRateData => "hsa_heart_rate_data",
            MesgNum::Split => "split",
            MesgNum::SplitSummary => "split_summary",
            MesgNum::HsaBodyBatteryData => "hsa_body_battery_data",
            MesgNum::HsaEvent => "hsa_event",
            MesgNum::ClimbPro => "climb_pro",
            MesgNum::TankUpdate => "tank_update",
            MesgNum::TankSummary => "tank_summary",
            MesgNum::SleepAssessment => "sleep_assessment",
            MesgNum::HrvStatusSummary => "hrv_status_summary",
            MesgNum::HrvValue => "hrv_value",
            MesgNum::RawBbi => "raw_bbi",
            MesgNum::DeviceAuxBatteryInfo => "device_aux_battery_info",
            MesgNum::HsaGyroscopeData => "hsa_gyroscope_data",
            MesgNum::ChronoShotSession => "chrono_shot_session",
            MesgNum::ChronoShotData => "chrono_shot_data",
            MesgNum::HsaConfigurationData => "hsa_configuration_data",
            MesgNum::DiveApneaAlarm => "dive_apnea_alarm",
            MesgNum::SkinTempOvernight => "skin_temp_overnight",
            MesgNum::HsaWristTemperatureData => "hsa_wrist_temperature_data",
            MesgNum::NapEvent => "nap_event",
            MesgNum::SleepDisruptionSeverityPeriod => "sleep_disruption_severity_period",
            MesgNum::SleepDisruptionOvernightSeverity => "sleep_disruption_overnight_severity",
            MesgNum::MfgRangeMin => "mfg_range_min",
            MesgNum::MfgRangeMax => "mfg_range_max",
        }
    }

    /// Try to construct from the underlying numeric value.
    pub fn from_value(value: u16) -> Option<Self> {
        match value {
            0 => Some(MesgNum::FileId),
            1 => Some(MesgNum::Capabilities),
            2 => Some(MesgNum::DeviceSettings),
            3 => Some(MesgNum::UserProfile),
            4 => Some(MesgNum::HrmProfile),
            5 => Some(MesgNum::SdmProfile),
            6 => Some(MesgNum::BikeProfile),
            7 => Some(MesgNum::ZonesTarget),
            8 => Some(MesgNum::HrZone),
            9 => Some(MesgNum::PowerZone),
            10 => Some(MesgNum::MetZone),
            12 => Some(MesgNum::Sport),
            13 => Some(MesgNum::TrainingSettings),
            15 => Some(MesgNum::Goal),
            18 => Some(MesgNum::Session),
            19 => Some(MesgNum::Lap),
            20 => Some(MesgNum::Record),
            21 => Some(MesgNum::Event),
            23 => Some(MesgNum::DeviceInfo),
            26 => Some(MesgNum::Workout),
            27 => Some(MesgNum::WorkoutStep),
            28 => Some(MesgNum::Schedule),
            30 => Some(MesgNum::WeightScale),
            31 => Some(MesgNum::Course),
            32 => Some(MesgNum::CoursePoint),
            33 => Some(MesgNum::Totals),
            34 => Some(MesgNum::Activity),
            35 => Some(MesgNum::Software),
            37 => Some(MesgNum::FileCapabilities),
            38 => Some(MesgNum::MesgCapabilities),
            39 => Some(MesgNum::FieldCapabilities),
            49 => Some(MesgNum::FileCreator),
            51 => Some(MesgNum::BloodPressure),
            53 => Some(MesgNum::SpeedZone),
            55 => Some(MesgNum::Monitoring),
            72 => Some(MesgNum::TrainingFile),
            78 => Some(MesgNum::Hrv),
            80 => Some(MesgNum::AntRx),
            81 => Some(MesgNum::AntTx),
            82 => Some(MesgNum::AntChannelId),
            101 => Some(MesgNum::Length),
            103 => Some(MesgNum::MonitoringInfo),
            105 => Some(MesgNum::Pad),
            106 => Some(MesgNum::SlaveDevice),
            127 => Some(MesgNum::Connectivity),
            128 => Some(MesgNum::WeatherConditions),
            129 => Some(MesgNum::WeatherAlert),
            131 => Some(MesgNum::CadenceZone),
            132 => Some(MesgNum::Hr),
            142 => Some(MesgNum::SegmentLap),
            145 => Some(MesgNum::MemoGlob),
            148 => Some(MesgNum::SegmentId),
            149 => Some(MesgNum::SegmentLeaderboardEntry),
            150 => Some(MesgNum::SegmentPoint),
            151 => Some(MesgNum::SegmentFile),
            158 => Some(MesgNum::WorkoutSession),
            159 => Some(MesgNum::WatchfaceSettings),
            160 => Some(MesgNum::GpsMetadata),
            161 => Some(MesgNum::CameraEvent),
            162 => Some(MesgNum::TimestampCorrelation),
            164 => Some(MesgNum::GyroscopeData),
            165 => Some(MesgNum::AccelerometerData),
            167 => Some(MesgNum::ThreeDSensorCalibration),
            169 => Some(MesgNum::VideoFrame),
            174 => Some(MesgNum::ObdiiData),
            177 => Some(MesgNum::NmeaSentence),
            178 => Some(MesgNum::AviationAttitude),
            184 => Some(MesgNum::Video),
            185 => Some(MesgNum::VideoTitle),
            186 => Some(MesgNum::VideoDescription),
            187 => Some(MesgNum::VideoClip),
            188 => Some(MesgNum::OhrSettings),
            200 => Some(MesgNum::ExdScreenConfiguration),
            201 => Some(MesgNum::ExdDataFieldConfiguration),
            202 => Some(MesgNum::ExdDataConceptConfiguration),
            206 => Some(MesgNum::FieldDescription),
            207 => Some(MesgNum::DeveloperDataId),
            208 => Some(MesgNum::MagnetometerData),
            209 => Some(MesgNum::BarometerData),
            210 => Some(MesgNum::OneDSensorCalibration),
            211 => Some(MesgNum::MonitoringHrData),
            216 => Some(MesgNum::TimeInZone),
            225 => Some(MesgNum::Set),
            227 => Some(MesgNum::StressLevel),
            229 => Some(MesgNum::MaxMetData),
            258 => Some(MesgNum::DiveSettings),
            259 => Some(MesgNum::DiveGas),
            262 => Some(MesgNum::DiveAlarm),
            264 => Some(MesgNum::ExerciseTitle),
            268 => Some(MesgNum::DiveSummary),
            269 => Some(MesgNum::Spo2Data),
            275 => Some(MesgNum::SleepLevel),
            285 => Some(MesgNum::Jump),
            289 => Some(MesgNum::AadAccelFeatures),
            290 => Some(MesgNum::BeatIntervals),
            297 => Some(MesgNum::RespirationRate),
            302 => Some(MesgNum::HsaAccelerometerData),
            304 => Some(MesgNum::HsaStepData),
            305 => Some(MesgNum::HsaSpo2Data),
            306 => Some(MesgNum::HsaStressData),
            307 => Some(MesgNum::HsaRespirationData),
            308 => Some(MesgNum::HsaHeartRateData),
            312 => Some(MesgNum::Split),
            313 => Some(MesgNum::SplitSummary),
            314 => Some(MesgNum::HsaBodyBatteryData),
            315 => Some(MesgNum::HsaEvent),
            317 => Some(MesgNum::ClimbPro),
            319 => Some(MesgNum::TankUpdate),
            323 => Some(MesgNum::TankSummary),
            346 => Some(MesgNum::SleepAssessment),
            370 => Some(MesgNum::HrvStatusSummary),
            371 => Some(MesgNum::HrvValue),
            372 => Some(MesgNum::RawBbi),
            375 => Some(MesgNum::DeviceAuxBatteryInfo),
            376 => Some(MesgNum::HsaGyroscopeData),
            387 => Some(MesgNum::ChronoShotSession),
            388 => Some(MesgNum::ChronoShotData),
            389 => Some(MesgNum::HsaConfigurationData),
            393 => Some(MesgNum::DiveApneaAlarm),
            398 => Some(MesgNum::SkinTempOvernight),
            409 => Some(MesgNum::HsaWristTemperatureData),
            412 => Some(MesgNum::NapEvent),
            470 => Some(MesgNum::SleepDisruptionSeverityPeriod),
            471 => Some(MesgNum::SleepDisruptionOvernightSeverity),
            65280 => Some(MesgNum::MfgRangeMin),
            65534 => Some(MesgNum::MfgRangeMax),
            _ => None,
        }
    }

    /// Try to construct from the snake-case canonical name.
    pub fn from_str(name: &str) -> Option<Self> {
        match name {
            "file_id" => Some(MesgNum::FileId),
            "capabilities" => Some(MesgNum::Capabilities),
            "device_settings" => Some(MesgNum::DeviceSettings),
            "user_profile" => Some(MesgNum::UserProfile),
            "hrm_profile" => Some(MesgNum::HrmProfile),
            "sdm_profile" => Some(MesgNum::SdmProfile),
            "bike_profile" => Some(MesgNum::BikeProfile),
            "zones_target" => Some(MesgNum::ZonesTarget),
            "hr_zone" => Some(MesgNum::HrZone),
            "power_zone" => Some(MesgNum::PowerZone),
            "met_zone" => Some(MesgNum::MetZone),
            "sport" => Some(MesgNum::Sport),
            "training_settings" => Some(MesgNum::TrainingSettings),
            "goal" => Some(MesgNum::Goal),
            "session" => Some(MesgNum::Session),
            "lap" => Some(MesgNum::Lap),
            "record" => Some(MesgNum::Record),
            "event" => Some(MesgNum::Event),
            "device_info" => Some(MesgNum::DeviceInfo),
            "workout" => Some(MesgNum::Workout),
            "workout_step" => Some(MesgNum::WorkoutStep),
            "schedule" => Some(MesgNum::Schedule),
            "weight_scale" => Some(MesgNum::WeightScale),
            "course" => Some(MesgNum::Course),
            "course_point" => Some(MesgNum::CoursePoint),
            "totals" => Some(MesgNum::Totals),
            "activity" => Some(MesgNum::Activity),
            "software" => Some(MesgNum::Software),
            "file_capabilities" => Some(MesgNum::FileCapabilities),
            "mesg_capabilities" => Some(MesgNum::MesgCapabilities),
            "field_capabilities" => Some(MesgNum::FieldCapabilities),
            "file_creator" => Some(MesgNum::FileCreator),
            "blood_pressure" => Some(MesgNum::BloodPressure),
            "speed_zone" => Some(MesgNum::SpeedZone),
            "monitoring" => Some(MesgNum::Monitoring),
            "training_file" => Some(MesgNum::TrainingFile),
            "hrv" => Some(MesgNum::Hrv),
            "ant_rx" => Some(MesgNum::AntRx),
            "ant_tx" => Some(MesgNum::AntTx),
            "ant_channel_id" => Some(MesgNum::AntChannelId),
            "length" => Some(MesgNum::Length),
            "monitoring_info" => Some(MesgNum::MonitoringInfo),
            "pad" => Some(MesgNum::Pad),
            "slave_device" => Some(MesgNum::SlaveDevice),
            "connectivity" => Some(MesgNum::Connectivity),
            "weather_conditions" => Some(MesgNum::WeatherConditions),
            "weather_alert" => Some(MesgNum::WeatherAlert),
            "cadence_zone" => Some(MesgNum::CadenceZone),
            "hr" => Some(MesgNum::Hr),
            "segment_lap" => Some(MesgNum::SegmentLap),
            "memo_glob" => Some(MesgNum::MemoGlob),
            "segment_id" => Some(MesgNum::SegmentId),
            "segment_leaderboard_entry" => Some(MesgNum::SegmentLeaderboardEntry),
            "segment_point" => Some(MesgNum::SegmentPoint),
            "segment_file" => Some(MesgNum::SegmentFile),
            "workout_session" => Some(MesgNum::WorkoutSession),
            "watchface_settings" => Some(MesgNum::WatchfaceSettings),
            "gps_metadata" => Some(MesgNum::GpsMetadata),
            "camera_event" => Some(MesgNum::CameraEvent),
            "timestamp_correlation" => Some(MesgNum::TimestampCorrelation),
            "gyroscope_data" => Some(MesgNum::GyroscopeData),
            "accelerometer_data" => Some(MesgNum::AccelerometerData),
            "three_d_sensor_calibration" => Some(MesgNum::ThreeDSensorCalibration),
            "video_frame" => Some(MesgNum::VideoFrame),
            "obdii_data" => Some(MesgNum::ObdiiData),
            "nmea_sentence" => Some(MesgNum::NmeaSentence),
            "aviation_attitude" => Some(MesgNum::AviationAttitude),
            "video" => Some(MesgNum::Video),
            "video_title" => Some(MesgNum::VideoTitle),
            "video_description" => Some(MesgNum::VideoDescription),
            "video_clip" => Some(MesgNum::VideoClip),
            "ohr_settings" => Some(MesgNum::OhrSettings),
            "exd_screen_configuration" => Some(MesgNum::ExdScreenConfiguration),
            "exd_data_field_configuration" => Some(MesgNum::ExdDataFieldConfiguration),
            "exd_data_concept_configuration" => Some(MesgNum::ExdDataConceptConfiguration),
            "field_description" => Some(MesgNum::FieldDescription),
            "developer_data_id" => Some(MesgNum::DeveloperDataId),
            "magnetometer_data" => Some(MesgNum::MagnetometerData),
            "barometer_data" => Some(MesgNum::BarometerData),
            "one_d_sensor_calibration" => Some(MesgNum::OneDSensorCalibration),
            "monitoring_hr_data" => Some(MesgNum::MonitoringHrData),
            "time_in_zone" => Some(MesgNum::TimeInZone),
            "set" => Some(MesgNum::Set),
            "stress_level" => Some(MesgNum::StressLevel),
            "max_met_data" => Some(MesgNum::MaxMetData),
            "dive_settings" => Some(MesgNum::DiveSettings),
            "dive_gas" => Some(MesgNum::DiveGas),
            "dive_alarm" => Some(MesgNum::DiveAlarm),
            "exercise_title" => Some(MesgNum::ExerciseTitle),
            "dive_summary" => Some(MesgNum::DiveSummary),
            "spo2_data" => Some(MesgNum::Spo2Data),
            "sleep_level" => Some(MesgNum::SleepLevel),
            "jump" => Some(MesgNum::Jump),
            "aad_accel_features" => Some(MesgNum::AadAccelFeatures),
            "beat_intervals" => Some(MesgNum::BeatIntervals),
            "respiration_rate" => Some(MesgNum::RespirationRate),
            "hsa_accelerometer_data" => Some(MesgNum::HsaAccelerometerData),
            "hsa_step_data" => Some(MesgNum::HsaStepData),
            "hsa_spo2_data" => Some(MesgNum::HsaSpo2Data),
            "hsa_stress_data" => Some(MesgNum::HsaStressData),
            "hsa_respiration_data" => Some(MesgNum::HsaRespirationData),
            "hsa_heart_rate_data" => Some(MesgNum::HsaHeartRateData),
            "split" => Some(MesgNum::Split),
            "split_summary" => Some(MesgNum::SplitSummary),
            "hsa_body_battery_data" => Some(MesgNum::HsaBodyBatteryData),
            "hsa_event" => Some(MesgNum::HsaEvent),
            "climb_pro" => Some(MesgNum::ClimbPro),
            "tank_update" => Some(MesgNum::TankUpdate),
            "tank_summary" => Some(MesgNum::TankSummary),
            "sleep_assessment" => Some(MesgNum::SleepAssessment),
            "hrv_status_summary" => Some(MesgNum::HrvStatusSummary),
            "hrv_value" => Some(MesgNum::HrvValue),
            "raw_bbi" => Some(MesgNum::RawBbi),
            "device_aux_battery_info" => Some(MesgNum::DeviceAuxBatteryInfo),
            "hsa_gyroscope_data" => Some(MesgNum::HsaGyroscopeData),
            "chrono_shot_session" => Some(MesgNum::ChronoShotSession),
            "chrono_shot_data" => Some(MesgNum::ChronoShotData),
            "hsa_configuration_data" => Some(MesgNum::HsaConfigurationData),
            "dive_apnea_alarm" => Some(MesgNum::DiveApneaAlarm),
            "skin_temp_overnight" => Some(MesgNum::SkinTempOvernight),
            "hsa_wrist_temperature_data" => Some(MesgNum::HsaWristTemperatureData),
            "nap_event" => Some(MesgNum::NapEvent),
            "sleep_disruption_severity_period" => Some(MesgNum::SleepDisruptionSeverityPeriod),
            "sleep_disruption_overnight_severity" => {
                Some(MesgNum::SleepDisruptionOvernightSeverity)
            }
            "mfg_range_min" => Some(MesgNum::MfgRangeMin),
            "mfg_range_max" => Some(MesgNum::MfgRangeMax),
            _ => None,
        }
    }
}

impl MesgNum {
    /// Alias for [`Self::from_str`].
    pub fn from_name(name: &str) -> Option<Self> {
        Self::from_str(name)
    }
}