mavtables  0.2.1
MAVLink router and firewall.
mavlink.hpp
Go to the documentation of this file.
1 // MAVLink router and firewall.
2 // Copyright (C) 2018 Michael R. Shannon <mrshannon.aerospace@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 
18 #ifndef MAVLINK_H_
19 #define MAVLINK_H_
20 
21 
22 extern "C"
23 {
24 
25 #define MAVLINK_USE_MESSAGE_INFO
26 #include "mavlink.h"
27 
28 }
29 
30 #include <cstdint>
31 #include "macros.hpp"
32 
33 namespace mavlink
34 {
35 
36  /** \defgroup mavlink MAVLink Library and Helpers
37  *
38  * MAVLink utility macros, defines, types and functions.
39  *
40  * Including this file also includes the main MAVLink C library. This will
41  * be the reference implementation using the ArduPilot dialect by default.
42  *
43  * The dialect can be changed by setting the `DIALECT` environment
44  * variable. The default is `ardupilotmega`.
45  *
46  * The MAVLink library can be changed with the `MDIR` environement variable
47  * which should point to the directory where the `DIALECT` directory can be
48  * found.
49  */
50 
51 
52  /** MAVLink packet v1.0 header.
53  *
54  * \ingroup mavlink
55  */
57  {
58  uint8_t magic; //!< Protocol magic marker (0xFE).
59  uint8_t len; //!< Length of payload.
60  uint8_t seq; //!< Sequence of packet.
61  uint8_t sysid; //!< ID of message sender system/aircraft.
62  uint8_t compid; //!< ID of the message sneder component.
63  uint8_t msgid; //!< ID of message in payload.
64  };
65 
66 
67  /** MAVLink packet v2.0 header.
68  *
69  * \ingroup mavlink
70  */
72  {
73  uint8_t magic; //!< Protocol magic marker (0xFD).
74  uint8_t len; //!< Length of payload.
75  uint8_t incompat_flags; //!< Flags that must be understood.
76  uint8_t compat_flags; //!< Flags that can be ignored if not known.
77  uint8_t seq; //!< Sequence of packet.
78  uint8_t sysid; //!< ID of message sender system/aircraft.
79  uint8_t compid; //!< ID of the message sender component.
80  uint32_t msgid : 24; //!< ID of message in payload (3 bytes).
81  };
82 
83 
84  std::string name(unsigned long id);
85  unsigned long id(std::string name);
86 
87 }
88 
89 #endif // MAVLINK_H_
#define PACKED
Definition: macros.hpp:41