source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_mission_item_reached.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 8.2 KB
Line 
1// MESSAGE MISSION_ITEM_REACHED PACKING
2
3#define MAVLINK_MSG_ID_MISSION_ITEM_REACHED 46
4
5typedef struct MAVLINK_PACKED __mavlink_mission_item_reached_t
6{
7 uint16_t seq; /*< Sequence*/
8} mavlink_mission_item_reached_t;
9
10#define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN 2
11#define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN 2
12#define MAVLINK_MSG_ID_46_LEN 2
13#define MAVLINK_MSG_ID_46_MIN_LEN 2
14
15#define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC 11
16#define MAVLINK_MSG_ID_46_CRC 11
17
18
19
20#if MAVLINK_COMMAND_24BIT
21#define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \
22 46, \
23 "MISSION_ITEM_REACHED", \
24 1, \
25 { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \
26 } \
27}
28#else
29#define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \
30 "MISSION_ITEM_REACHED", \
31 1, \
32 { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \
33 } \
34}
35#endif
36
37/**
38 * @brief Pack a mission_item_reached message
39 * @param system_id ID of this system
40 * @param component_id ID of this component (e.g. 200 for IMU)
41 * @param msg The MAVLink message to compress the data into
42 *
43 * @param seq Sequence
44 * @return length of the message in bytes (excluding serial stream start sign)
45 */
46static inline uint16_t mavlink_msg_mission_item_reached_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
47 uint16_t seq)
48{
49#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
50 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
51 _mav_put_uint16_t(buf, 0, seq);
52
53 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
54#else
55 mavlink_mission_item_reached_t packet;
56 packet.seq = seq;
57
58 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
59#endif
60
61 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
62 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
63}
64
65/**
66 * @brief Pack a mission_item_reached message on a channel
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param chan The MAVLink channel this message will be sent over
70 * @param msg The MAVLink message to compress the data into
71 * @param seq Sequence
72 * @return length of the message in bytes (excluding serial stream start sign)
73 */
74static inline uint16_t mavlink_msg_mission_item_reached_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
75 mavlink_message_t* msg,
76 uint16_t seq)
77{
78#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
80 _mav_put_uint16_t(buf, 0, seq);
81
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
83#else
84 mavlink_mission_item_reached_t packet;
85 packet.seq = seq;
86
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
88#endif
89
90 msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
91 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
92}
93
94/**
95 * @brief Encode a mission_item_reached struct
96 *
97 * @param system_id ID of this system
98 * @param component_id ID of this component (e.g. 200 for IMU)
99 * @param msg The MAVLink message to compress the data into
100 * @param mission_item_reached C-struct to read the message contents from
101 */
102static inline uint16_t mavlink_msg_mission_item_reached_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached)
103{
104 return mavlink_msg_mission_item_reached_pack(system_id, component_id, msg, mission_item_reached->seq);
105}
106
107/**
108 * @brief Encode a mission_item_reached struct on a channel
109 *
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param chan The MAVLink channel this message will be sent over
113 * @param msg The MAVLink message to compress the data into
114 * @param mission_item_reached C-struct to read the message contents from
115 */
116static inline uint16_t mavlink_msg_mission_item_reached_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached)
117{
118 return mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, chan, msg, mission_item_reached->seq);
119}
120
121/**
122 * @brief Send a mission_item_reached message
123 * @param chan MAVLink channel to send the message
124 *
125 * @param seq Sequence
126 */
127#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
128
129static inline void mavlink_msg_mission_item_reached_send(mavlink_channel_t chan, uint16_t seq)
130{
131#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
132 char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN];
133 _mav_put_uint16_t(buf, 0, seq);
134
135 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
136#else
137 mavlink_mission_item_reached_t packet;
138 packet.seq = seq;
139
140 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)&packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
141#endif
142}
143
144/**
145 * @brief Send a mission_item_reached message
146 * @param chan MAVLink channel to send the message
147 * @param struct The MAVLink struct to serialize
148 */
149static inline void mavlink_msg_mission_item_reached_send_struct(mavlink_channel_t chan, const mavlink_mission_item_reached_t* mission_item_reached)
150{
151#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
152 mavlink_msg_mission_item_reached_send(chan, mission_item_reached->seq);
153#else
154 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)mission_item_reached, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
155#endif
156}
157
158#if MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
159/*
160 This varient of _send() can be used to save stack space by re-using
161 memory from the receive buffer. The caller provides a
162 mavlink_message_t which is the size of a full mavlink message. This
163 is usually the receive buffer for the channel, and allows a reply to an
164 incoming message with minimum stack space usage.
165 */
166static inline void mavlink_msg_mission_item_reached_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq)
167{
168#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
169 char *buf = (char *)msgbuf;
170 _mav_put_uint16_t(buf, 0, seq);
171
172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
173#else
174 mavlink_mission_item_reached_t *packet = (mavlink_mission_item_reached_t *)msgbuf;
175 packet->seq = seq;
176
177 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC);
178#endif
179}
180#endif
181
182#endif
183
184// MESSAGE MISSION_ITEM_REACHED UNPACKING
185
186
187/**
188 * @brief Get field seq from mission_item_reached message
189 *
190 * @return Sequence
191 */
192static inline uint16_t mavlink_msg_mission_item_reached_get_seq(const mavlink_message_t* msg)
193{
194 return _MAV_RETURN_uint16_t(msg, 0);
195}
196
197/**
198 * @brief Decode a mission_item_reached message into a struct
199 *
200 * @param msg The message to decode
201 * @param mission_item_reached C-struct to decode the message contents into
202 */
203static inline void mavlink_msg_mission_item_reached_decode(const mavlink_message_t* msg, mavlink_mission_item_reached_t* mission_item_reached)
204{
205#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206 mission_item_reached->seq = mavlink_msg_mission_item_reached_get_seq(msg);
207#else
208 uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN;
209 memset(mission_item_reached, 0, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN);
210 memcpy(mission_item_reached, _MAV_PAYLOAD(msg), len);
211#endif
212}
Note: See TracBrowser for help on using the repository browser.