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
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
#![doc = "This file was automatically generated, do not edit"]
use crate::MavlinkVersion;
use crate::{bytes::Bytes, bytes_mut::BytesMut, error::*, Message, MessageData};
#[allow(unused_imports)]
use bitflags::bitflags;
#[allow(unused_imports)]
use num_derive::FromPrimitive;
#[allow(unused_imports)]
use num_derive::ToPrimitive;
#[allow(unused_imports)]
use num_traits::FromPrimitive;
#[allow(unused_imports)]
use num_traits::ToPrimitive;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[doc = "Micro air vehicle / autopilot classes. This identifies the individual model."]
pub enum MavAutopilot {
    #[doc = "Generic autopilot, full support for everything"]
    MAV_AUTOPILOT_GENERIC = 0,
    #[doc = "Reserved for future use."]
    MAV_AUTOPILOT_RESERVED = 1,
    #[doc = "SLUGS autopilot, http://slugsuav.soe.ucsc.edu"]
    MAV_AUTOPILOT_SLUGS = 2,
    #[doc = "ArduPilot - Plane/Copter/Rover/Sub/Tracker, https://ardupilot.org"]
    MAV_AUTOPILOT_ARDUPILOTMEGA = 3,
    #[doc = "OpenPilot, http://openpilot.org"]
    MAV_AUTOPILOT_OPENPILOT = 4,
    #[doc = "Generic autopilot only supporting simple waypoints"]
    MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY = 5,
    #[doc = "Generic autopilot supporting waypoints and other simple navigation commands"]
    MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY = 6,
    #[doc = "Generic autopilot supporting the full mission command set"]
    MAV_AUTOPILOT_GENERIC_MISSION_FULL = 7,
    #[doc = "No valid autopilot, e.g. a GCS or other MAVLink component"]
    MAV_AUTOPILOT_INVALID = 8,
    #[doc = "PPZ UAV - http://nongnu.org/paparazzi"]
    MAV_AUTOPILOT_PPZ = 9,
    #[doc = "UAV Dev Board"]
    MAV_AUTOPILOT_UDB = 10,
    #[doc = "FlexiPilot"]
    MAV_AUTOPILOT_FP = 11,
    #[doc = "PX4 Autopilot - http://px4.io/"]
    MAV_AUTOPILOT_PX4 = 12,
    #[doc = "SMACCMPilot - http://smaccmpilot.org"]
    MAV_AUTOPILOT_SMACCMPILOT = 13,
    #[doc = "AutoQuad -- http://autoquad.org"]
    MAV_AUTOPILOT_AUTOQUAD = 14,
    #[doc = "Armazila -- http://armazila.com"]
    MAV_AUTOPILOT_ARMAZILA = 15,
    #[doc = "Aerob -- http://aerob.ru"]
    MAV_AUTOPILOT_AEROB = 16,
    #[doc = "ASLUAV autopilot -- http://www.asl.ethz.ch"]
    MAV_AUTOPILOT_ASLUAV = 17,
    #[doc = "SmartAP Autopilot - http://sky-drones.com"]
    MAV_AUTOPILOT_SMARTAP = 18,
    #[doc = "AirRails - http://uaventure.com"]
    MAV_AUTOPILOT_AIRRAILS = 19,
    #[doc = "Fusion Reflex - https://fusion.engineering"]
    MAV_AUTOPILOT_REFLEX = 20,
}
impl MavAutopilot {
    pub const DEFAULT: Self = Self::MAV_AUTOPILOT_GENERIC;
}
impl Default for MavAutopilot {
    fn default() -> Self {
        Self::DEFAULT
    }
}
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[doc = "MAVLINK component type reported in HEARTBEAT message. Flight controllers must report the type of the vehicle on which they are mounted (e.g. MAV_TYPE_OCTOROTOR). All other components must report a value appropriate for their type (e.g. a camera must use MAV_TYPE_CAMERA)."]
pub enum MavType {
    #[doc = "Generic micro air vehicle"]
    MAV_TYPE_GENERIC = 0,
    #[doc = "Fixed wing aircraft."]
    MAV_TYPE_FIXED_WING = 1,
    #[doc = "Quadrotor"]
    MAV_TYPE_QUADROTOR = 2,
    #[doc = "Coaxial helicopter"]
    MAV_TYPE_COAXIAL = 3,
    #[doc = "Normal helicopter with tail rotor."]
    MAV_TYPE_HELICOPTER = 4,
    #[doc = "Ground installation"]
    MAV_TYPE_ANTENNA_TRACKER = 5,
    #[doc = "Operator control unit / ground control station"]
    MAV_TYPE_GCS = 6,
    #[doc = "Airship, controlled"]
    MAV_TYPE_AIRSHIP = 7,
    #[doc = "Free balloon, uncontrolled"]
    MAV_TYPE_FREE_BALLOON = 8,
    #[doc = "Rocket"]
    MAV_TYPE_ROCKET = 9,
    #[doc = "Ground rover"]
    MAV_TYPE_GROUND_ROVER = 10,
    #[doc = "Surface vessel, boat, ship"]
    MAV_TYPE_SURFACE_BOAT = 11,
    #[doc = "Submarine"]
    MAV_TYPE_SUBMARINE = 12,
    #[doc = "Hexarotor"]
    MAV_TYPE_HEXAROTOR = 13,
    #[doc = "Octorotor"]
    MAV_TYPE_OCTOROTOR = 14,
    #[doc = "Tricopter"]
    MAV_TYPE_TRICOPTER = 15,
    #[doc = "Flapping wing"]
    MAV_TYPE_FLAPPING_WING = 16,
    #[doc = "Kite"]
    MAV_TYPE_KITE = 17,
    #[doc = "Onboard companion controller"]
    MAV_TYPE_ONBOARD_CONTROLLER = 18,
    #[doc = "Two-rotor Tailsitter VTOL that additionally uses control surfaces in vertical operation. Note, value previously named MAV_TYPE_VTOL_DUOROTOR."]
    MAV_TYPE_VTOL_TAILSITTER_DUOROTOR = 19,
    #[doc = "Quad-rotor Tailsitter VTOL using a V-shaped quad config in vertical operation. Note: value previously named MAV_TYPE_VTOL_QUADROTOR."]
    MAV_TYPE_VTOL_TAILSITTER_QUADROTOR = 20,
    #[doc = "Tiltrotor VTOL. Fuselage and wings stay (nominally) horizontal in all flight phases. It able to tilt (some) rotors to provide thrust in cruise flight."]
    MAV_TYPE_VTOL_TILTROTOR = 21,
    #[doc = "VTOL with separate fixed rotors for hover and cruise flight. Fuselage and wings stay (nominally) horizontal in all flight phases."]
    MAV_TYPE_VTOL_FIXEDROTOR = 22,
    #[doc = "Tailsitter VTOL. Fuselage and wings orientation changes depending on flight phase: vertical for hover, horizontal for cruise. Use more specific VTOL MAV_TYPE_VTOL_DUOROTOR or MAV_TYPE_VTOL_QUADROTOR if appropriate."]
    MAV_TYPE_VTOL_TAILSITTER = 23,
    #[doc = "Tiltwing VTOL. Fuselage stays horizontal in all flight phases. The whole wing, along with any attached engine, can tilt between vertical and horizontal mode."]
    MAV_TYPE_VTOL_TILTWING = 24,
    #[doc = "VTOL reserved 5"]
    MAV_TYPE_VTOL_RESERVED5 = 25,
    #[doc = "Gimbal"]
    MAV_TYPE_GIMBAL = 26,
    #[doc = "ADSB system"]
    MAV_TYPE_ADSB = 27,
    #[doc = "Steerable, nonrigid airfoil"]
    MAV_TYPE_PARAFOIL = 28,
    #[doc = "Dodecarotor"]
    MAV_TYPE_DODECAROTOR = 29,
    #[doc = "Camera"]
    MAV_TYPE_CAMERA = 30,
    #[doc = "Charging station"]
    MAV_TYPE_CHARGING_STATION = 31,
    #[doc = "FLARM collision avoidance system"]
    MAV_TYPE_FLARM = 32,
    #[doc = "Servo"]
    MAV_TYPE_SERVO = 33,
    #[doc = "Open Drone ID. See https://mavlink.io/en/services/opendroneid.html."]
    MAV_TYPE_ODID = 34,
    #[doc = "Decarotor"]
    MAV_TYPE_DECAROTOR = 35,
    #[doc = "Battery"]
    MAV_TYPE_BATTERY = 36,
    #[doc = "Parachute"]
    MAV_TYPE_PARACHUTE = 37,
    #[doc = "Log"]
    MAV_TYPE_LOG = 38,
    #[doc = "OSD"]
    MAV_TYPE_OSD = 39,
    #[doc = "IMU"]
    MAV_TYPE_IMU = 40,
    #[doc = "GPS"]
    MAV_TYPE_GPS = 41,
    #[doc = "Winch"]
    MAV_TYPE_WINCH = 42,
}
impl MavType {
    pub const DEFAULT: Self = Self::MAV_TYPE_GENERIC;
}
impl Default for MavType {
    fn default() -> Self {
        Self::DEFAULT
    }
}
bitflags! { # [cfg_attr (feature = "serde" , derive (Serialize , Deserialize))] # [doc = "These flags encode the MAV mode."] pub struct MavModeFlag : u8 { # [doc = "0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. Additional note: this flag is to be ignore when sent in the command MAV_CMD_DO_SET_MODE and MAV_CMD_COMPONENT_ARM_DISARM shall be used instead. The flag can still be used to report the armed state."] const MAV_MODE_FLAG_SAFETY_ARMED = 128 ; # [doc = "0b01000000 remote control input is enabled."] const MAV_MODE_FLAG_MANUAL_INPUT_ENABLED = 64 ; # [doc = "0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational."] const MAV_MODE_FLAG_HIL_ENABLED = 32 ; # [doc = "0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around."] const MAV_MODE_FLAG_STABILIZE_ENABLED = 16 ; # [doc = "0b00001000 guided mode enabled, system flies waypoints / mission items."] const MAV_MODE_FLAG_GUIDED_ENABLED = 8 ; # [doc = "0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation."] const MAV_MODE_FLAG_AUTO_ENABLED = 4 ; # [doc = "0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations."] const MAV_MODE_FLAG_TEST_ENABLED = 2 ; # [doc = "0b00000001 Reserved for future use."] const MAV_MODE_FLAG_CUSTOM_MODE_ENABLED = 1 ; } }
impl MavModeFlag {
    pub const DEFAULT: Self = Self::MAV_MODE_FLAG_SAFETY_ARMED;
}
impl Default for MavModeFlag {
    fn default() -> Self {
        Self::DEFAULT
    }
}
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
pub enum MavState {
    #[doc = "Uninitialized system, state is unknown."]
    MAV_STATE_UNINIT = 0,
    #[doc = "System is booting up."]
    MAV_STATE_BOOT = 1,
    #[doc = "System is calibrating and not flight-ready."]
    MAV_STATE_CALIBRATING = 2,
    #[doc = "System is grounded and on standby. It can be launched any time."]
    MAV_STATE_STANDBY = 3,
    #[doc = "System is active and might be already airborne. Motors are engaged."]
    MAV_STATE_ACTIVE = 4,
    #[doc = "System is in a non-normal flight mode. It can however still navigate."]
    MAV_STATE_CRITICAL = 5,
    #[doc = "System is in a non-normal flight mode. It lost control over parts or over the whole airframe. It is in mayday and going down."]
    MAV_STATE_EMERGENCY = 6,
    #[doc = "System just initialized its power-down sequence, will shut down now."]
    MAV_STATE_POWEROFF = 7,
    #[doc = "System is terminating itself."]
    MAV_STATE_FLIGHT_TERMINATION = 8,
}
impl MavState {
    pub const DEFAULT: Self = Self::MAV_STATE_UNINIT;
}
impl Default for MavState {
    fn default() -> Self {
        Self::DEFAULT
    }
}
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[doc = "These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not."]
pub enum MavModeFlagDecodePosition {
    #[doc = "First bit:  10000000"]
    MAV_MODE_FLAG_DECODE_POSITION_SAFETY = 128,
    #[doc = "Second bit: 01000000"]
    MAV_MODE_FLAG_DECODE_POSITION_MANUAL = 64,
    #[doc = "Third bit:  00100000"]
    MAV_MODE_FLAG_DECODE_POSITION_HIL = 32,
    #[doc = "Fourth bit: 00010000"]
    MAV_MODE_FLAG_DECODE_POSITION_STABILIZE = 16,
    #[doc = "Fifth bit:  00001000"]
    MAV_MODE_FLAG_DECODE_POSITION_GUIDED = 8,
    #[doc = "Sixth bit:   00000100"]
    MAV_MODE_FLAG_DECODE_POSITION_AUTO = 4,
    #[doc = "Seventh bit: 00000010"]
    MAV_MODE_FLAG_DECODE_POSITION_TEST = 2,
    #[doc = "Eighth bit: 00000001"]
    MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE = 1,
}
impl MavModeFlagDecodePosition {
    pub const DEFAULT: Self = Self::MAV_MODE_FLAG_DECODE_POSITION_SAFETY;
}
impl Default for MavModeFlagDecodePosition {
    fn default() -> Self {
        Self::DEFAULT
    }
}
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[doc = "Component ids (values) for the different types and instances of onboard hardware/software that might make up a MAVLink system (autopilot, cameras, servos, GPS systems, avoidance systems etc.).       Components must use the appropriate ID in their source address when sending messages. Components can also use IDs to determine if they are the intended recipient of an incoming message. The MAV_COMP_ID_ALL value is used to indicate messages that must be processed by all components.       When creating new entries, components that can have multiple instances (e.g. cameras, servos etc.) should be allocated sequential values. An appropriate number of values should be left free after these components to allow the number of instances to be expanded."]
pub enum MavComponent {
    #[doc = "Target id (target_component) used to broadcast messages to all components of the receiving system. Components should attempt to process messages with this component ID and forward to components on any other interfaces. Note: This is not a valid *source* component id for a message."]
    MAV_COMP_ID_ALL = 0,
    #[doc = "System flight controller component (\"autopilot\"). Only one autopilot is expected in a particular system."]
    MAV_COMP_ID_AUTOPILOT1 = 1,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER1 = 25,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER2 = 26,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER3 = 27,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER4 = 28,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER5 = 29,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER6 = 30,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER7 = 31,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER8 = 32,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER9 = 33,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER10 = 34,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER11 = 35,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER12 = 36,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER13 = 37,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER14 = 38,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER15 = 39,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER16 = 40,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER17 = 41,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER18 = 42,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER19 = 43,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER20 = 44,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER21 = 45,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER22 = 46,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER23 = 47,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER24 = 48,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER25 = 49,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER26 = 50,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER27 = 51,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER28 = 52,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER29 = 53,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER30 = 54,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER31 = 55,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER32 = 56,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER33 = 57,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER34 = 58,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER35 = 59,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER36 = 60,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER37 = 61,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER38 = 62,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER39 = 63,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER40 = 64,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER41 = 65,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER42 = 66,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER43 = 67,
    #[doc = "Telemetry radio (e.g. SiK radio, or other component that emits RADIO_STATUS messages)."]
    MAV_COMP_ID_TELEMETRY_RADIO = 68,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER45 = 69,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER46 = 70,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER47 = 71,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER48 = 72,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER49 = 73,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER50 = 74,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER51 = 75,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER52 = 76,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER53 = 77,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER54 = 78,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER55 = 79,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER56 = 80,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER57 = 81,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER58 = 82,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER59 = 83,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER60 = 84,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER61 = 85,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER62 = 86,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER63 = 87,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER64 = 88,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER65 = 89,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER66 = 90,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER67 = 91,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER68 = 92,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER69 = 93,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER70 = 94,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER71 = 95,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER72 = 96,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER73 = 97,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER74 = 98,
    #[doc = "Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network."]
    MAV_COMP_ID_USER75 = 99,
    #[doc = "Camera #1."]
    MAV_COMP_ID_CAMERA = 100,
    #[doc = "Camera #2."]
    MAV_COMP_ID_CAMERA2 = 101,
    #[doc = "Camera #3."]
    MAV_COMP_ID_CAMERA3 = 102,
    #[doc = "Camera #4."]
    MAV_COMP_ID_CAMERA4 = 103,
    #[doc = "Camera #5."]
    MAV_COMP_ID_CAMERA5 = 104,
    #[doc = "Camera #6."]
    MAV_COMP_ID_CAMERA6 = 105,
    #[doc = "Servo #1."]
    MAV_COMP_ID_SERVO1 = 140,
    #[doc = "Servo #2."]
    MAV_COMP_ID_SERVO2 = 141,
    #[doc = "Servo #3."]
    MAV_COMP_ID_SERVO3 = 142,
    #[doc = "Servo #4."]
    MAV_COMP_ID_SERVO4 = 143,
    #[doc = "Servo #5."]
    MAV_COMP_ID_SERVO5 = 144,
    #[doc = "Servo #6."]
    MAV_COMP_ID_SERVO6 = 145,
    #[doc = "Servo #7."]
    MAV_COMP_ID_SERVO7 = 146,
    #[doc = "Servo #8."]
    MAV_COMP_ID_SERVO8 = 147,
    #[doc = "Servo #9."]
    MAV_COMP_ID_SERVO9 = 148,
    #[doc = "Servo #10."]
    MAV_COMP_ID_SERVO10 = 149,
    #[doc = "Servo #11."]
    MAV_COMP_ID_SERVO11 = 150,
    #[doc = "Servo #12."]
    MAV_COMP_ID_SERVO12 = 151,
    #[doc = "Servo #13."]
    MAV_COMP_ID_SERVO13 = 152,
    #[doc = "Servo #14."]
    MAV_COMP_ID_SERVO14 = 153,
    #[doc = "Gimbal #1."]
    MAV_COMP_ID_GIMBAL = 154,
    #[doc = "Logging component."]
    MAV_COMP_ID_LOG = 155,
    #[doc = "Automatic Dependent Surveillance-Broadcast (ADS-B) component."]
    MAV_COMP_ID_ADSB = 156,
    #[doc = "On Screen Display (OSD) devices for video links."]
    MAV_COMP_ID_OSD = 157,
    #[doc = "Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter microservice."]
    MAV_COMP_ID_PERIPHERAL = 158,
    #[doc = "Gimbal ID for QX1."]
    MAV_COMP_ID_QX1_GIMBAL = 159,
    #[doc = "FLARM collision alert component."]
    MAV_COMP_ID_FLARM = 160,
    #[doc = "Parachute component."]
    MAV_COMP_ID_PARACHUTE = 161,
    #[doc = "Winch component."]
    MAV_COMP_ID_WINCH = 169,
    #[doc = "Gimbal #2."]
    MAV_COMP_ID_GIMBAL2 = 171,
    #[doc = "Gimbal #3."]
    MAV_COMP_ID_GIMBAL3 = 172,
    #[doc = "Gimbal #4"]
    MAV_COMP_ID_GIMBAL4 = 173,
    #[doc = "Gimbal #5."]
    MAV_COMP_ID_GIMBAL5 = 174,
    #[doc = "Gimbal #6."]
    MAV_COMP_ID_GIMBAL6 = 175,
    #[doc = "Battery #1."]
    MAV_COMP_ID_BATTERY = 180,
    #[doc = "Battery #2."]
    MAV_COMP_ID_BATTERY2 = 181,
    #[doc = "CAN over MAVLink client."]
    MAV_COMP_ID_MAVCAN = 189,
    #[doc = "Component that can generate/supply a mission flight plan (e.g. GCS or developer API)."]
    MAV_COMP_ID_MISSIONPLANNER = 190,
    #[doc = "Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on."]
    MAV_COMP_ID_ONBOARD_COMPUTER = 191,
    #[doc = "Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on."]
    MAV_COMP_ID_ONBOARD_COMPUTER2 = 192,
    #[doc = "Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on."]
    MAV_COMP_ID_ONBOARD_COMPUTER3 = 193,
    #[doc = "Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on."]
    MAV_COMP_ID_ONBOARD_COMPUTER4 = 194,
    #[doc = "Component that finds an optimal path between points based on a certain constraint (e.g. minimum snap, shortest path, cost, etc.)."]
    MAV_COMP_ID_PATHPLANNER = 195,
    #[doc = "Component that plans a collision free path between two points."]
    MAV_COMP_ID_OBSTACLE_AVOIDANCE = 196,
    #[doc = "Component that provides position estimates using VIO techniques."]
    MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY = 197,
    #[doc = "Component that manages pairing of vehicle and GCS."]
    MAV_COMP_ID_PAIRING_MANAGER = 198,
    #[doc = "Inertial Measurement Unit (IMU) #1."]
    MAV_COMP_ID_IMU = 200,
    #[doc = "Inertial Measurement Unit (IMU) #2."]
    MAV_COMP_ID_IMU_2 = 201,
    #[doc = "Inertial Measurement Unit (IMU) #3."]
    MAV_COMP_ID_IMU_3 = 202,
    #[doc = "GPS #1."]
    MAV_COMP_ID_GPS = 220,
    #[doc = "GPS #2."]
    MAV_COMP_ID_GPS2 = 221,
    #[doc = "Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet)."]
    MAV_COMP_ID_ODID_TXRX_1 = 236,
    #[doc = "Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet)."]
    MAV_COMP_ID_ODID_TXRX_2 = 237,
    #[doc = "Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet)."]
    MAV_COMP_ID_ODID_TXRX_3 = 238,
    #[doc = "Component to bridge MAVLink to UDP (i.e. from a UART)."]
    MAV_COMP_ID_UDP_BRIDGE = 240,
    #[doc = "Component to bridge to UART (i.e. from UDP)."]
    MAV_COMP_ID_UART_BRIDGE = 241,
    #[doc = "Component handling TUNNEL messages (e.g. vendor specific GUI of a component)."]
    MAV_COMP_ID_TUNNEL_NODE = 242,
    #[doc = "Deprecated, don't use. Component for handling system messages (e.g. to ARM, takeoff, etc.)."]
    MAV_COMP_ID_SYSTEM_CONTROL = 250,
}
impl MavComponent {
    pub const DEFAULT: Self = Self::MAV_COMP_ID_ALL;
}
impl Default for MavComponent {
    fn default() -> Self {
        Self::DEFAULT
    }
}
#[doc = "id: 0"]
#[doc = "The heartbeat message shows that a system or component is present and responding. The type and autopilot fields (along with the message component id), allow the receiving system to treat further messages from this system appropriately (e.g. by laying out the user interface based on the autopilot). This microservice is documented at https://mavlink.io/en/services/heartbeat.html."]
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct HEARTBEAT_DATA {
    #[doc = "A bitfield for use for autopilot-specific flags."]
    pub custom_mode: u32,
    #[doc = "Vehicle or component type. For a flight controller component the vehicle type (quadrotor, helicopter, etc.). For other components the component type (e.g. camera, gimbal, etc.). This should be used in preference to component id for identifying the component type.."]
    pub mavtype: MavType,
    #[doc = "Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.."]
    pub autopilot: MavAutopilot,
    #[doc = "System mode bitmap.."]
    pub base_mode: MavModeFlag,
    #[doc = "System status flag.."]
    pub system_status: MavState,
    #[doc = "MAVLink version, not writable by user, gets added by protocol because of magic data type: uint8_t_mavlink_version."]
    pub mavlink_version: u8,
}
impl HEARTBEAT_DATA {
    pub const ENCODED_LEN: usize = 9usize;
    pub const DEFAULT: Self = Self {
        custom_mode: 0_u32,
        mavtype: MavType::DEFAULT,
        autopilot: MavAutopilot::DEFAULT,
        base_mode: MavModeFlag::DEFAULT,
        system_status: MavState::DEFAULT,
        mavlink_version: 0_u8,
    };
}
impl Default for HEARTBEAT_DATA {
    fn default() -> Self {
        Self::DEFAULT.clone()
    }
}
impl MessageData for HEARTBEAT_DATA {
    type Message = MavMessage;
    const ID: u32 = 0u32;
    const NAME: &'static str = "HEARTBEAT";
    const EXTRA_CRC: u8 = 50u8;
    const ENCODED_LEN: usize = 9usize;
    fn deser(_version: MavlinkVersion, __input: &[u8]) -> Result<Self, ParserError> {
        let avail_len = __input.len();
        let mut payload_buf = [0; Self::ENCODED_LEN];
        let mut buf = if avail_len < Self::ENCODED_LEN {
            payload_buf[0..avail_len].copy_from_slice(__input);
            Bytes::new(&payload_buf)
        } else {
            Bytes::new(__input)
        };
        let mut __struct = Self::default();
        __struct.custom_mode = buf.get_u32_le();
        let tmp = buf.get_u8();
        __struct.mavtype = FromPrimitive::from_u8(tmp).ok_or(ParserError::InvalidEnum {
            enum_type: "MavType",
            value: tmp as u32,
        })?;
        let tmp = buf.get_u8();
        __struct.autopilot = FromPrimitive::from_u8(tmp).ok_or(ParserError::InvalidEnum {
            enum_type: "MavAutopilot",
            value: tmp as u32,
        })?;
        let tmp = buf.get_u8();
        __struct.base_mode = MavModeFlag::from_bits(tmp & MavModeFlag::all().bits()).ok_or(
            ParserError::InvalidFlag {
                flag_type: "MavModeFlag",
                value: tmp as u32,
            },
        )?;
        let tmp = buf.get_u8();
        __struct.system_status = FromPrimitive::from_u8(tmp).ok_or(ParserError::InvalidEnum {
            enum_type: "MavState",
            value: tmp as u32,
        })?;
        __struct.mavlink_version = buf.get_u8();
        Ok(__struct)
    }
    fn ser(&self, version: MavlinkVersion, bytes: &mut [u8]) -> usize {
        let mut __tmp = BytesMut::new(bytes);
        __tmp.put_u32_le(self.custom_mode);
        __tmp.put_u8(self.mavtype as u8);
        __tmp.put_u8(self.autopilot as u8);
        __tmp.put_u8(self.base_mode.bits());
        __tmp.put_u8(self.system_status as u8);
        __tmp.put_u8(self.mavlink_version);
        if matches!(version, MavlinkVersion::V2) {
            let len = __tmp.len();
            crate::remove_trailing_zeroes(&bytes[..len])
        } else {
            __tmp.len()
        }
    }
}
#[doc = "id: 300"]
#[doc = "Version and capability of protocol version. This message can be requested with MAV_CMD_REQUEST_MESSAGE and is used as part of the handshaking to establish which MAVLink version should be used on the network. Every node should respond to a request for PROTOCOL_VERSION to enable the handshaking. Library implementers should consider adding this into the default decoding state machine to allow the protocol core to respond directly.."]
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct PROTOCOL_VERSION_DATA {
    #[doc = "Currently active MAVLink version number * 100: v1.0 is 100, v2.0 is 200, etc.."]
    pub version: u16,
    #[doc = "Minimum MAVLink version supported."]
    pub min_version: u16,
    #[doc = "Maximum MAVLink version supported (set to the same value as version by default)."]
    pub max_version: u16,
    #[doc = "The first 8 bytes (not characters printed in hex!) of the git hash.."]
    #[cfg_attr(feature = "serde", serde(with = "serde_arrays"))]
    pub spec_version_hash: [u8; 8],
    #[doc = "The first 8 bytes (not characters printed in hex!) of the git hash.."]
    #[cfg_attr(feature = "serde", serde(with = "serde_arrays"))]
    pub library_version_hash: [u8; 8],
}
impl PROTOCOL_VERSION_DATA {
    pub const ENCODED_LEN: usize = 22usize;
    pub const DEFAULT: Self = Self {
        version: 0_u16,
        min_version: 0_u16,
        max_version: 0_u16,
        spec_version_hash: [0_u8; 8usize],
        library_version_hash: [0_u8; 8usize],
    };
}
impl Default for PROTOCOL_VERSION_DATA {
    fn default() -> Self {
        Self::DEFAULT.clone()
    }
}
impl MessageData for PROTOCOL_VERSION_DATA {
    type Message = MavMessage;
    const ID: u32 = 300u32;
    const NAME: &'static str = "PROTOCOL_VERSION";
    const EXTRA_CRC: u8 = 217u8;
    const ENCODED_LEN: usize = 22usize;
    fn deser(_version: MavlinkVersion, __input: &[u8]) -> Result<Self, ParserError> {
        let avail_len = __input.len();
        let mut payload_buf = [0; Self::ENCODED_LEN];
        let mut buf = if avail_len < Self::ENCODED_LEN {
            payload_buf[0..avail_len].copy_from_slice(__input);
            Bytes::new(&payload_buf)
        } else {
            Bytes::new(__input)
        };
        let mut __struct = Self::default();
        __struct.version = buf.get_u16_le();
        __struct.min_version = buf.get_u16_le();
        __struct.max_version = buf.get_u16_le();
        for v in &mut __struct.spec_version_hash {
            let val = buf.get_u8();
            *v = val;
        }
        for v in &mut __struct.library_version_hash {
            let val = buf.get_u8();
            *v = val;
        }
        Ok(__struct)
    }
    fn ser(&self, version: MavlinkVersion, bytes: &mut [u8]) -> usize {
        let mut __tmp = BytesMut::new(bytes);
        __tmp.put_u16_le(self.version);
        __tmp.put_u16_le(self.min_version);
        __tmp.put_u16_le(self.max_version);
        for val in &self.spec_version_hash {
            __tmp.put_u8(*val);
        }
        for val in &self.library_version_hash {
            __tmp.put_u8(*val);
        }
        if matches!(version, MavlinkVersion::V2) {
            let len = __tmp.len();
            crate::remove_trailing_zeroes(&bytes[..len])
        } else {
            __tmp.len()
        }
    }
}
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
pub enum MavMessage {
    HEARTBEAT(HEARTBEAT_DATA),
    PROTOCOL_VERSION(PROTOCOL_VERSION_DATA),
}
impl Message for MavMessage {
    fn parse(version: MavlinkVersion, id: u32, payload: &[u8]) -> Result<Self, ParserError> {
        match id {
            HEARTBEAT_DATA::ID => HEARTBEAT_DATA::deser(version, payload).map(Self::HEARTBEAT),
            PROTOCOL_VERSION_DATA::ID => {
                PROTOCOL_VERSION_DATA::deser(version, payload).map(Self::PROTOCOL_VERSION)
            }
            _ => Err(ParserError::UnknownMessage { id }),
        }
    }
    fn message_name(&self) -> &'static str {
        match self {
            Self::HEARTBEAT(..) => HEARTBEAT_DATA::NAME,
            Self::PROTOCOL_VERSION(..) => PROTOCOL_VERSION_DATA::NAME,
        }
    }
    fn message_id(&self) -> u32 {
        match self {
            Self::HEARTBEAT(..) => HEARTBEAT_DATA::ID,
            Self::PROTOCOL_VERSION(..) => PROTOCOL_VERSION_DATA::ID,
        }
    }
    fn message_id_from_name(name: &str) -> Result<u32, &'static str> {
        match name {
            HEARTBEAT_DATA::NAME => Ok(HEARTBEAT_DATA::ID),
            PROTOCOL_VERSION_DATA::NAME => Ok(PROTOCOL_VERSION_DATA::ID),
            _ => Err("Invalid message name."),
        }
    }
    fn default_message_from_id(id: u32) -> Result<Self, &'static str> {
        match id {
            HEARTBEAT_DATA::ID => Ok(Self::HEARTBEAT(HEARTBEAT_DATA::default())),
            PROTOCOL_VERSION_DATA::ID => {
                Ok(Self::PROTOCOL_VERSION(PROTOCOL_VERSION_DATA::default()))
            }
            _ => Err("Invalid message id."),
        }
    }
    fn ser(&self, version: MavlinkVersion, bytes: &mut [u8]) -> usize {
        match self {
            Self::HEARTBEAT(body) => body.ser(version, bytes),
            Self::PROTOCOL_VERSION(body) => body.ser(version, bytes),
        }
    }
    fn extra_crc(id: u32) -> u8 {
        match id {
            HEARTBEAT_DATA::ID => HEARTBEAT_DATA::EXTRA_CRC,
            PROTOCOL_VERSION_DATA::ID => PROTOCOL_VERSION_DATA::EXTRA_CRC,
            _ => 0,
        }
    }
}