NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_fence_point.h
Go to the documentation of this file.
1 // MESSAGE FENCE_POINT PACKING
2 
3 #define MAVLINK_MSG_ID_FENCE_POINT 160
4 
5 typedef struct __mavlink_fence_point_t
6 {
7  float lat;
8  float lng;
9  uint8_t target_system;
10  uint8_t target_component;
11  uint8_t idx;
12  uint8_t count;
14 
15 #define MAVLINK_MSG_ID_FENCE_POINT_LEN 12
16 #define MAVLINK_MSG_ID_160_LEN 12
17 
18 #define MAVLINK_MSG_ID_FENCE_POINT_CRC 78
19 #define MAVLINK_MSG_ID_160_CRC 78
20 
21 
22 
23 #define MAVLINK_MESSAGE_INFO_FENCE_POINT { \
24  "FENCE_POINT", \
25  6, \
26  { { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_fence_point_t, lat) }, \
27  { "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fence_point_t, lng) }, \
28  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_fence_point_t, target_system) }, \
29  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_fence_point_t, target_component) }, \
30  { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_fence_point_t, idx) }, \
31  { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_fence_point_t, count) }, \
32  } \
33 }
34 
35 
50 static inline uint16_t mavlink_msg_fence_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
51  uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng)
52 {
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55  _mav_put_float(buf, 0, lat);
56  _mav_put_float(buf, 4, lng);
57  _mav_put_uint8_t(buf, 8, target_system);
58  _mav_put_uint8_t(buf, 9, target_component);
59  _mav_put_uint8_t(buf, 10, idx);
60  _mav_put_uint8_t(buf, 11, count);
61 
63 #else
64  mavlink_fence_point_t packet;
65  packet.lat = lat;
66  packet.lng = lng;
67  packet.target_system = target_system;
68  packet.target_component = target_component;
69  packet.idx = idx;
70  packet.count = count;
71 
73 #endif
74 
75  msg->msgid = MAVLINK_MSG_ID_FENCE_POINT;
76 #if MAVLINK_CRC_EXTRA
78 #else
79  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FENCE_POINT_LEN);
80 #endif
81 }
82 
97 static inline uint16_t mavlink_msg_fence_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
98  mavlink_message_t* msg,
99  uint8_t target_system,uint8_t target_component,uint8_t idx,uint8_t count,float lat,float lng)
100 {
101 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
103  _mav_put_float(buf, 0, lat);
104  _mav_put_float(buf, 4, lng);
105  _mav_put_uint8_t(buf, 8, target_system);
106  _mav_put_uint8_t(buf, 9, target_component);
107  _mav_put_uint8_t(buf, 10, idx);
108  _mav_put_uint8_t(buf, 11, count);
109 
111 #else
112  mavlink_fence_point_t packet;
113  packet.lat = lat;
114  packet.lng = lng;
115  packet.target_system = target_system;
116  packet.target_component = target_component;
117  packet.idx = idx;
118  packet.count = count;
119 
121 #endif
122 
123  msg->msgid = MAVLINK_MSG_ID_FENCE_POINT;
124 #if MAVLINK_CRC_EXTRA
126 #else
127  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FENCE_POINT_LEN);
128 #endif
129 }
130 
139 static inline uint16_t mavlink_msg_fence_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_point_t* fence_point)
140 {
141  return mavlink_msg_fence_point_pack(system_id, component_id, msg, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng);
142 }
143 
153 static inline uint16_t mavlink_msg_fence_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_fence_point_t* fence_point)
154 {
155  return mavlink_msg_fence_point_pack_chan(system_id, component_id, chan, msg, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng);
156 }
157 
169 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
170 
171 static inline void mavlink_msg_fence_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng)
172 {
173 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
175  _mav_put_float(buf, 0, lat);
176  _mav_put_float(buf, 4, lng);
177  _mav_put_uint8_t(buf, 8, target_system);
178  _mav_put_uint8_t(buf, 9, target_component);
179  _mav_put_uint8_t(buf, 10, idx);
180  _mav_put_uint8_t(buf, 11, count);
181 
182 #if MAVLINK_CRC_EXTRA
184 #else
185  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, buf, MAVLINK_MSG_ID_FENCE_POINT_LEN);
186 #endif
187 #else
188  mavlink_fence_point_t packet;
189  packet.lat = lat;
190  packet.lng = lng;
191  packet.target_system = target_system;
192  packet.target_component = target_component;
193  packet.idx = idx;
194  packet.count = count;
195 
196 #if MAVLINK_CRC_EXTRA
197  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)&packet, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC);
198 #else
199  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)&packet, MAVLINK_MSG_ID_FENCE_POINT_LEN);
200 #endif
201 #endif
202 }
203 
204 #if MAVLINK_MSG_ID_FENCE_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
205 /*
206  This varient of _send() can be used to save stack space by re-using
207  memory from the receive buffer. The caller provides a
208  mavlink_message_t which is the size of a full mavlink message. This
209  is usually the receive buffer for the channel, and allows a reply to an
210  incoming message with minimum stack space usage.
211  */
212 static inline void mavlink_msg_fence_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng)
213 {
214 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
215  char *buf = (char *)msgbuf;
216  _mav_put_float(buf, 0, lat);
217  _mav_put_float(buf, 4, lng);
218  _mav_put_uint8_t(buf, 8, target_system);
219  _mav_put_uint8_t(buf, 9, target_component);
220  _mav_put_uint8_t(buf, 10, idx);
221  _mav_put_uint8_t(buf, 11, count);
222 
223 #if MAVLINK_CRC_EXTRA
225 #else
226  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, buf, MAVLINK_MSG_ID_FENCE_POINT_LEN);
227 #endif
228 #else
229  mavlink_fence_point_t *packet = (mavlink_fence_point_t *)msgbuf;
230  packet->lat = lat;
231  packet->lng = lng;
232  packet->target_system = target_system;
233  packet->target_component = target_component;
234  packet->idx = idx;
235  packet->count = count;
236 
237 #if MAVLINK_CRC_EXTRA
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)packet, MAVLINK_MSG_ID_FENCE_POINT_LEN, MAVLINK_MSG_ID_FENCE_POINT_CRC);
239 #else
240  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)packet, MAVLINK_MSG_ID_FENCE_POINT_LEN);
241 #endif
242 #endif
243 }
244 #endif
245 
246 #endif
247 
248 // MESSAGE FENCE_POINT UNPACKING
249 
250 
256 static inline uint8_t mavlink_msg_fence_point_get_target_system(const mavlink_message_t* msg)
257 {
258  return _MAV_RETURN_uint8_t(msg, 8);
259 }
260 
266 static inline uint8_t mavlink_msg_fence_point_get_target_component(const mavlink_message_t* msg)
267 {
268  return _MAV_RETURN_uint8_t(msg, 9);
269 }
270 
276 static inline uint8_t mavlink_msg_fence_point_get_idx(const mavlink_message_t* msg)
277 {
278  return _MAV_RETURN_uint8_t(msg, 10);
279 }
280 
286 static inline uint8_t mavlink_msg_fence_point_get_count(const mavlink_message_t* msg)
287 {
288  return _MAV_RETURN_uint8_t(msg, 11);
289 }
290 
296 static inline float mavlink_msg_fence_point_get_lat(const mavlink_message_t* msg)
297 {
298  return _MAV_RETURN_float(msg, 0);
299 }
300 
306 static inline float mavlink_msg_fence_point_get_lng(const mavlink_message_t* msg)
307 {
308  return _MAV_RETURN_float(msg, 4);
309 }
310 
317 static inline void mavlink_msg_fence_point_decode(const mavlink_message_t* msg, mavlink_fence_point_t* fence_point)
318 {
319 #if MAVLINK_NEED_BYTE_SWAP
320  fence_point->lat = mavlink_msg_fence_point_get_lat(msg);
321  fence_point->lng = mavlink_msg_fence_point_get_lng(msg);
322  fence_point->target_system = mavlink_msg_fence_point_get_target_system(msg);
323  fence_point->target_component = mavlink_msg_fence_point_get_target_component(msg);
324  fence_point->idx = mavlink_msg_fence_point_get_idx(msg);
325  fence_point->count = mavlink_msg_fence_point_get_count(msg);
326 #else
327  memcpy(fence_point, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FENCE_POINT_LEN);
328 #endif
329 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#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