NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_isr_location.h
Go to the documentation of this file.
1 // MESSAGE ISR_LOCATION PACKING
2 
3 #define MAVLINK_MSG_ID_ISR_LOCATION 189
4 
6 {
7  float latitude;
8  float longitude;
9  float height;
10  uint8_t target;
11  uint8_t option1;
12  uint8_t option2;
13  uint8_t option3;
15 
16 #define MAVLINK_MSG_ID_ISR_LOCATION_LEN 16
17 #define MAVLINK_MSG_ID_189_LEN 16
18 
19 #define MAVLINK_MSG_ID_ISR_LOCATION_CRC 246
20 #define MAVLINK_MSG_ID_189_CRC 246
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_ISR_LOCATION { \
25  "ISR_LOCATION", \
26  7, \
27  { { "latitude", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_isr_location_t, latitude) }, \
28  { "longitude", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_isr_location_t, longitude) }, \
29  { "height", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_isr_location_t, height) }, \
30  { "target", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_isr_location_t, target) }, \
31  { "option1", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_isr_location_t, option1) }, \
32  { "option2", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_isr_location_t, option2) }, \
33  { "option3", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_isr_location_t, option3) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_isr_location_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint8_t target, float latitude, float longitude, float height, uint8_t option1, uint8_t option2, uint8_t option3)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_float(buf, 0, latitude);
59  _mav_put_float(buf, 4, longitude);
60  _mav_put_float(buf, 8, height);
61  _mav_put_uint8_t(buf, 12, target);
62  _mav_put_uint8_t(buf, 13, option1);
63  _mav_put_uint8_t(buf, 14, option2);
64  _mav_put_uint8_t(buf, 15, option3);
65 
67 #else
69  packet.latitude = latitude;
70  packet.longitude = longitude;
71  packet.height = height;
72  packet.target = target;
73  packet.option1 = option1;
74  packet.option2 = option2;
75  packet.option3 = option3;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_ISR_LOCATION;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_isr_location_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint8_t target,float latitude,float longitude,float height,uint8_t option1,uint8_t option2,uint8_t option3)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_float(buf, 0, latitude);
110  _mav_put_float(buf, 4, longitude);
111  _mav_put_float(buf, 8, height);
112  _mav_put_uint8_t(buf, 12, target);
113  _mav_put_uint8_t(buf, 13, option1);
114  _mav_put_uint8_t(buf, 14, option2);
115  _mav_put_uint8_t(buf, 15, option3);
116 
118 #else
119  mavlink_isr_location_t packet;
120  packet.latitude = latitude;
121  packet.longitude = longitude;
122  packet.height = height;
123  packet.target = target;
124  packet.option1 = option1;
125  packet.option2 = option2;
126  packet.option3 = option3;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_ISR_LOCATION;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_isr_location_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_isr_location_t* isr_location)
148 {
149  return mavlink_msg_isr_location_pack(system_id, component_id, msg, isr_location->target, isr_location->latitude, isr_location->longitude, isr_location->height, isr_location->option1, isr_location->option2, isr_location->option3);
150 }
151 
161 static inline uint16_t mavlink_msg_isr_location_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_isr_location_t* isr_location)
162 {
163  return mavlink_msg_isr_location_pack_chan(system_id, component_id, chan, msg, isr_location->target, isr_location->latitude, isr_location->longitude, isr_location->height, isr_location->option1, isr_location->option2, isr_location->option3);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_isr_location_send(mavlink_channel_t chan, uint8_t target, float latitude, float longitude, float height, uint8_t option1, uint8_t option2, uint8_t option3)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_float(buf, 0, latitude);
185  _mav_put_float(buf, 4, longitude);
186  _mav_put_float(buf, 8, height);
187  _mav_put_uint8_t(buf, 12, target);
188  _mav_put_uint8_t(buf, 13, option1);
189  _mav_put_uint8_t(buf, 14, option2);
190  _mav_put_uint8_t(buf, 15, option3);
191 
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, buf, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
196 #endif
197 #else
198  mavlink_isr_location_t packet;
199  packet.latitude = latitude;
200  packet.longitude = longitude;
201  packet.height = height;
202  packet.target = target;
203  packet.option1 = option1;
204  packet.option2 = option2;
205  packet.option3 = option3;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, (const char *)&packet, MAVLINK_MSG_ID_ISR_LOCATION_LEN, MAVLINK_MSG_ID_ISR_LOCATION_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, (const char *)&packet, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_ISR_LOCATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static inline void mavlink_msg_isr_location_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target, float latitude, float longitude, float height, uint8_t option1, uint8_t option2, uint8_t option3)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_float(buf, 0, latitude);
228  _mav_put_float(buf, 4, longitude);
229  _mav_put_float(buf, 8, height);
230  _mav_put_uint8_t(buf, 12, target);
231  _mav_put_uint8_t(buf, 13, option1);
232  _mav_put_uint8_t(buf, 14, option2);
233  _mav_put_uint8_t(buf, 15, option3);
234 
235 #if MAVLINK_CRC_EXTRA
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, buf, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
239 #endif
240 #else
242  packet->latitude = latitude;
243  packet->longitude = longitude;
244  packet->height = height;
245  packet->target = target;
246  packet->option1 = option1;
247  packet->option2 = option2;
248  packet->option3 = option3;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, (const char *)packet, MAVLINK_MSG_ID_ISR_LOCATION_LEN, MAVLINK_MSG_ID_ISR_LOCATION_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ISR_LOCATION, (const char *)packet, MAVLINK_MSG_ID_ISR_LOCATION_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE ISR_LOCATION UNPACKING
262 
263 
269 static inline uint8_t mavlink_msg_isr_location_get_target(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint8_t(msg, 12);
272 }
273 
279 static inline float mavlink_msg_isr_location_get_latitude(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_float(msg, 0);
282 }
283 
289 static inline float mavlink_msg_isr_location_get_longitude(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_float(msg, 4);
292 }
293 
299 static inline float mavlink_msg_isr_location_get_height(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_float(msg, 8);
302 }
303 
309 static inline uint8_t mavlink_msg_isr_location_get_option1(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_uint8_t(msg, 13);
312 }
313 
319 static inline uint8_t mavlink_msg_isr_location_get_option2(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_uint8_t(msg, 14);
322 }
323 
329 static inline uint8_t mavlink_msg_isr_location_get_option3(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_uint8_t(msg, 15);
332 }
333 
340 static inline void mavlink_msg_isr_location_decode(const mavlink_message_t* msg, mavlink_isr_location_t* isr_location)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  isr_location->latitude = mavlink_msg_isr_location_get_latitude(msg);
344  isr_location->longitude = mavlink_msg_isr_location_get_longitude(msg);
345  isr_location->height = mavlink_msg_isr_location_get_height(msg);
346  isr_location->target = mavlink_msg_isr_location_get_target(msg);
347  isr_location->option1 = mavlink_msg_isr_location_get_option1(msg);
348  isr_location->option2 = mavlink_msg_isr_location_get_option2(msg);
349  isr_location->option3 = mavlink_msg_isr_location_get_option3(msg);
350 #else
351  memcpy(isr_location, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ISR_LOCATION_LEN);
352 #endif
353 }
#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