NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_fence_status.h
Go to the documentation of this file.
1 // MESSAGE FENCE_STATUS PACKING
2 
3 #define MAVLINK_MSG_ID_FENCE_STATUS 162
4 
6 {
7  uint32_t breach_time;
8  uint16_t breach_count;
9  uint8_t breach_status;
10  uint8_t breach_type;
12 
13 #define MAVLINK_MSG_ID_FENCE_STATUS_LEN 8
14 #define MAVLINK_MSG_ID_162_LEN 8
15 
16 #define MAVLINK_MSG_ID_FENCE_STATUS_CRC 189
17 #define MAVLINK_MSG_ID_162_CRC 189
18 
19 
20 
21 #define MAVLINK_MESSAGE_INFO_FENCE_STATUS { \
22  "FENCE_STATUS", \
23  4, \
24  { { "breach_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_fence_status_t, breach_time) }, \
25  { "breach_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_fence_status_t, breach_count) }, \
26  { "breach_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_fence_status_t, breach_status) }, \
27  { "breach_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_fence_status_t, breach_type) }, \
28  } \
29 }
30 
31 
44 static inline uint16_t mavlink_msg_fence_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45  uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time)
46 {
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
49  _mav_put_uint32_t(buf, 0, breach_time);
50  _mav_put_uint16_t(buf, 4, breach_count);
51  _mav_put_uint8_t(buf, 6, breach_status);
52  _mav_put_uint8_t(buf, 7, breach_type);
53 
55 #else
57  packet.breach_time = breach_time;
58  packet.breach_count = breach_count;
59  packet.breach_status = breach_status;
60  packet.breach_type = breach_type;
61 
63 #endif
64 
65  msg->msgid = MAVLINK_MSG_ID_FENCE_STATUS;
66 #if MAVLINK_CRC_EXTRA
68 #else
69  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
70 #endif
71 }
72 
85 static inline uint16_t mavlink_msg_fence_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
86  mavlink_message_t* msg,
87  uint8_t breach_status,uint16_t breach_count,uint8_t breach_type,uint32_t breach_time)
88 {
89 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91  _mav_put_uint32_t(buf, 0, breach_time);
92  _mav_put_uint16_t(buf, 4, breach_count);
93  _mav_put_uint8_t(buf, 6, breach_status);
94  _mav_put_uint8_t(buf, 7, breach_type);
95 
97 #else
99  packet.breach_time = breach_time;
100  packet.breach_count = breach_count;
101  packet.breach_status = breach_status;
102  packet.breach_type = breach_type;
103 
105 #endif
106 
107  msg->msgid = MAVLINK_MSG_ID_FENCE_STATUS;
108 #if MAVLINK_CRC_EXTRA
110 #else
111  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
112 #endif
113 }
114 
123 static inline uint16_t mavlink_msg_fence_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_status_t* fence_status)
124 {
125  return mavlink_msg_fence_status_pack(system_id, component_id, msg, fence_status->breach_status, fence_status->breach_count, fence_status->breach_type, fence_status->breach_time);
126 }
127 
137 static inline uint16_t mavlink_msg_fence_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fence_status_t* fence_status)
138 {
139  return mavlink_msg_fence_status_pack_chan(system_id, component_id, chan, msg, fence_status->breach_status, fence_status->breach_count, fence_status->breach_type, fence_status->breach_time);
140 }
141 
151 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
152 
153 static inline void mavlink_msg_fence_status_send(mavlink_channel_t chan, uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time)
154 {
155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
157  _mav_put_uint32_t(buf, 0, breach_time);
158  _mav_put_uint16_t(buf, 4, breach_count);
159  _mav_put_uint8_t(buf, 6, breach_status);
160  _mav_put_uint8_t(buf, 7, breach_type);
161 
162 #if MAVLINK_CRC_EXTRA
164 #else
165  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, buf, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
166 #endif
167 #else
168  mavlink_fence_status_t packet;
169  packet.breach_time = breach_time;
170  packet.breach_count = breach_count;
171  packet.breach_status = breach_status;
172  packet.breach_type = breach_type;
173 
174 #if MAVLINK_CRC_EXTRA
175  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_FENCE_STATUS_LEN, MAVLINK_MSG_ID_FENCE_STATUS_CRC);
176 #else
177  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
178 #endif
179 #endif
180 }
181 
182 #if MAVLINK_MSG_ID_FENCE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
183 /*
184  This varient of _send() can be used to save stack space by re-using
185  memory from the receive buffer. The caller provides a
186  mavlink_message_t which is the size of a full mavlink message. This
187  is usually the receive buffer for the channel, and allows a reply to an
188  incoming message with minimum stack space usage.
189  */
190 static inline void mavlink_msg_fence_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time)
191 {
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193  char *buf = (char *)msgbuf;
194  _mav_put_uint32_t(buf, 0, breach_time);
195  _mav_put_uint16_t(buf, 4, breach_count);
196  _mav_put_uint8_t(buf, 6, breach_status);
197  _mav_put_uint8_t(buf, 7, breach_type);
198 
199 #if MAVLINK_CRC_EXTRA
201 #else
202  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, buf, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
203 #endif
204 #else
206  packet->breach_time = breach_time;
207  packet->breach_count = breach_count;
208  packet->breach_status = breach_status;
209  packet->breach_type = breach_type;
210 
211 #if MAVLINK_CRC_EXTRA
212  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, (const char *)packet, MAVLINK_MSG_ID_FENCE_STATUS_LEN, MAVLINK_MSG_ID_FENCE_STATUS_CRC);
213 #else
214  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, (const char *)packet, MAVLINK_MSG_ID_FENCE_STATUS_LEN);
215 #endif
216 #endif
217 }
218 #endif
219 
220 #endif
221 
222 // MESSAGE FENCE_STATUS UNPACKING
223 
224 
230 static inline uint8_t mavlink_msg_fence_status_get_breach_status(const mavlink_message_t* msg)
231 {
232  return _MAV_RETURN_uint8_t(msg, 6);
233 }
234 
240 static inline uint16_t mavlink_msg_fence_status_get_breach_count(const mavlink_message_t* msg)
241 {
242  return _MAV_RETURN_uint16_t(msg, 4);
243 }
244 
250 static inline uint8_t mavlink_msg_fence_status_get_breach_type(const mavlink_message_t* msg)
251 {
252  return _MAV_RETURN_uint8_t(msg, 7);
253 }
254 
260 static inline uint32_t mavlink_msg_fence_status_get_breach_time(const mavlink_message_t* msg)
261 {
262  return _MAV_RETURN_uint32_t(msg, 0);
263 }
264 
271 static inline void mavlink_msg_fence_status_decode(const mavlink_message_t* msg, mavlink_fence_status_t* fence_status)
272 {
273 #if MAVLINK_NEED_BYTE_SWAP
274  fence_status->breach_time = mavlink_msg_fence_status_get_breach_time(msg);
275  fence_status->breach_count = mavlink_msg_fence_status_get_breach_count(msg);
276  fence_status->breach_status = mavlink_msg_fence_status_get_breach_status(msg);
277  fence_status->breach_type = mavlink_msg_fence_status_get_breach_type(msg);
278 #else
279  memcpy(fence_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FENCE_STATUS_LEN);
280 #endif
281 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141