mavlink_msg_safety_set_allowed_area.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. #pragma once
  2. // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
  3. #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
  4. typedef struct __mavlink_safety_set_allowed_area_t {
  5. float p1x; /*< [m] x position 1 / Latitude 1*/
  6. float p1y; /*< [m] y position 1 / Longitude 1*/
  7. float p1z; /*< [m] z position 1 / Altitude 1*/
  8. float p2x; /*< [m] x position 2 / Latitude 2*/
  9. float p2y; /*< [m] y position 2 / Longitude 2*/
  10. float p2z; /*< [m] z position 2 / Altitude 2*/
  11. uint8_t target_system; /*< System ID*/
  12. uint8_t target_component; /*< Component ID*/
  13. uint8_t frame; /*< Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
  14. } mavlink_safety_set_allowed_area_t;
  15. #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
  16. #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN 27
  17. #define MAVLINK_MSG_ID_54_LEN 27
  18. #define MAVLINK_MSG_ID_54_MIN_LEN 27
  19. #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15
  20. #define MAVLINK_MSG_ID_54_CRC 15
  21. #if MAVLINK_COMMAND_24BIT
  22. #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
  23. 54, \
  24. "SAFETY_SET_ALLOWED_AREA", \
  25. 9, \
  26. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
  27. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
  28. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
  29. { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
  30. { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
  31. { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
  32. { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
  33. { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
  34. { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
  35. } \
  36. }
  37. #else
  38. #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
  39. "SAFETY_SET_ALLOWED_AREA", \
  40. 9, \
  41. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
  42. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
  43. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
  44. { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
  45. { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
  46. { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
  47. { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
  48. { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
  49. { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
  50. } \
  51. }
  52. #endif
  53. /**
  54. * @brief Pack a safety_set_allowed_area message
  55. * @param system_id ID of this system
  56. * @param component_id ID of this component (e.g. 200 for IMU)
  57. * @param msg The MAVLink message to compress the data into
  58. *
  59. * @param target_system System ID
  60. * @param target_component Component ID
  61. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  62. * @param p1x [m] x position 1 / Latitude 1
  63. * @param p1y [m] y position 1 / Longitude 1
  64. * @param p1z [m] z position 1 / Altitude 1
  65. * @param p2x [m] x position 2 / Latitude 2
  66. * @param p2y [m] y position 2 / Longitude 2
  67. * @param p2z [m] z position 2 / Altitude 2
  68. * @return length of the message in bytes (excluding serial stream start sign)
  69. */
  70. static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  71. uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
  72. {
  73. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  74. char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
  75. _mav_put_float(buf, 0, p1x);
  76. _mav_put_float(buf, 4, p1y);
  77. _mav_put_float(buf, 8, p1z);
  78. _mav_put_float(buf, 12, p2x);
  79. _mav_put_float(buf, 16, p2y);
  80. _mav_put_float(buf, 20, p2z);
  81. _mav_put_uint8_t(buf, 24, target_system);
  82. _mav_put_uint8_t(buf, 25, target_component);
  83. _mav_put_uint8_t(buf, 26, frame);
  84. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  85. #else
  86. mavlink_safety_set_allowed_area_t packet;
  87. packet.p1x = p1x;
  88. packet.p1y = p1y;
  89. packet.p1z = p1z;
  90. packet.p2x = p2x;
  91. packet.p2y = p2y;
  92. packet.p2z = p2z;
  93. packet.target_system = target_system;
  94. packet.target_component = target_component;
  95. packet.frame = frame;
  96. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  97. #endif
  98. msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
  99. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  100. }
  101. /**
  102. * @brief Pack a safety_set_allowed_area message on a channel
  103. * @param system_id ID of this system
  104. * @param component_id ID of this component (e.g. 200 for IMU)
  105. * @param chan The MAVLink channel this message will be sent over
  106. * @param msg The MAVLink message to compress the data into
  107. * @param target_system System ID
  108. * @param target_component Component ID
  109. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  110. * @param p1x [m] x position 1 / Latitude 1
  111. * @param p1y [m] y position 1 / Longitude 1
  112. * @param p1z [m] z position 1 / Altitude 1
  113. * @param p2x [m] x position 2 / Latitude 2
  114. * @param p2y [m] y position 2 / Longitude 2
  115. * @param p2z [m] z position 2 / Altitude 2
  116. * @return length of the message in bytes (excluding serial stream start sign)
  117. */
  118. static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  119. mavlink_message_t* msg,
  120. uint8_t target_system,uint8_t target_component,uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
  121. {
  122. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  123. char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
  124. _mav_put_float(buf, 0, p1x);
  125. _mav_put_float(buf, 4, p1y);
  126. _mav_put_float(buf, 8, p1z);
  127. _mav_put_float(buf, 12, p2x);
  128. _mav_put_float(buf, 16, p2y);
  129. _mav_put_float(buf, 20, p2z);
  130. _mav_put_uint8_t(buf, 24, target_system);
  131. _mav_put_uint8_t(buf, 25, target_component);
  132. _mav_put_uint8_t(buf, 26, frame);
  133. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  134. #else
  135. mavlink_safety_set_allowed_area_t packet;
  136. packet.p1x = p1x;
  137. packet.p1y = p1y;
  138. packet.p1z = p1z;
  139. packet.p2x = p2x;
  140. packet.p2y = p2y;
  141. packet.p2z = p2z;
  142. packet.target_system = target_system;
  143. packet.target_component = target_component;
  144. packet.frame = frame;
  145. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  146. #endif
  147. msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
  148. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  149. }
  150. /**
  151. * @brief Encode a safety_set_allowed_area struct
  152. *
  153. * @param system_id ID of this system
  154. * @param component_id ID of this component (e.g. 200 for IMU)
  155. * @param msg The MAVLink message to compress the data into
  156. * @param safety_set_allowed_area C-struct to read the message contents from
  157. */
  158. static inline uint16_t mavlink_msg_safety_set_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
  159. {
  160. return mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z);
  161. }
  162. /**
  163. * @brief Encode a safety_set_allowed_area struct on a channel
  164. *
  165. * @param system_id ID of this system
  166. * @param component_id ID of this component (e.g. 200 for IMU)
  167. * @param chan The MAVLink channel this message will be sent over
  168. * @param msg The MAVLink message to compress the data into
  169. * @param safety_set_allowed_area C-struct to read the message contents from
  170. */
  171. static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
  172. {
  173. return mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z);
  174. }
  175. /**
  176. * @brief Send a safety_set_allowed_area message
  177. * @param chan MAVLink channel to send the message
  178. *
  179. * @param target_system System ID
  180. * @param target_component Component ID
  181. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  182. * @param p1x [m] x position 1 / Latitude 1
  183. * @param p1y [m] y position 1 / Longitude 1
  184. * @param p1z [m] z position 1 / Altitude 1
  185. * @param p2x [m] x position 2 / Latitude 2
  186. * @param p2y [m] y position 2 / Longitude 2
  187. * @param p2z [m] z position 2 / Altitude 2
  188. */
  189. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  190. static inline void mavlink_msg_safety_set_allowed_area_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
  191. {
  192. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  193. char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
  194. _mav_put_float(buf, 0, p1x);
  195. _mav_put_float(buf, 4, p1y);
  196. _mav_put_float(buf, 8, p1z);
  197. _mav_put_float(buf, 12, p2x);
  198. _mav_put_float(buf, 16, p2y);
  199. _mav_put_float(buf, 20, p2z);
  200. _mav_put_uint8_t(buf, 24, target_system);
  201. _mav_put_uint8_t(buf, 25, target_component);
  202. _mav_put_uint8_t(buf, 26, frame);
  203. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  204. #else
  205. mavlink_safety_set_allowed_area_t packet;
  206. packet.p1x = p1x;
  207. packet.p1y = p1y;
  208. packet.p1z = p1z;
  209. packet.p2x = p2x;
  210. packet.p2y = p2y;
  211. packet.p2z = p2z;
  212. packet.target_system = target_system;
  213. packet.target_component = target_component;
  214. packet.frame = frame;
  215. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  216. #endif
  217. }
  218. /**
  219. * @brief Send a safety_set_allowed_area message
  220. * @param chan MAVLink channel to send the message
  221. * @param struct The MAVLink struct to serialize
  222. */
  223. static inline void mavlink_msg_safety_set_allowed_area_send_struct(mavlink_channel_t chan, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
  224. {
  225. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  226. mavlink_msg_safety_set_allowed_area_send(chan, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z);
  227. #else
  228. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)safety_set_allowed_area, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  229. #endif
  230. }
  231. #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  232. /*
  233. This variant of _send() can be used to save stack space by re-using
  234. memory from the receive buffer. The caller provides a
  235. mavlink_message_t which is the size of a full mavlink message. This
  236. is usually the receive buffer for the channel, and allows a reply to an
  237. incoming message with minimum stack space usage.
  238. */
  239. static inline void mavlink_msg_safety_set_allowed_area_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
  240. {
  241. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  242. char *buf = (char *)msgbuf;
  243. _mav_put_float(buf, 0, p1x);
  244. _mav_put_float(buf, 4, p1y);
  245. _mav_put_float(buf, 8, p1z);
  246. _mav_put_float(buf, 12, p2x);
  247. _mav_put_float(buf, 16, p2y);
  248. _mav_put_float(buf, 20, p2z);
  249. _mav_put_uint8_t(buf, 24, target_system);
  250. _mav_put_uint8_t(buf, 25, target_component);
  251. _mav_put_uint8_t(buf, 26, frame);
  252. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  253. #else
  254. mavlink_safety_set_allowed_area_t *packet = (mavlink_safety_set_allowed_area_t *)msgbuf;
  255. packet->p1x = p1x;
  256. packet->p1y = p1y;
  257. packet->p1z = p1z;
  258. packet->p2x = p2x;
  259. packet->p2y = p2y;
  260. packet->p2z = p2z;
  261. packet->target_system = target_system;
  262. packet->target_component = target_component;
  263. packet->frame = frame;
  264. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
  265. #endif
  266. }
  267. #endif
  268. #endif
  269. // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
  270. /**
  271. * @brief Get field target_system from safety_set_allowed_area message
  272. *
  273. * @return System ID
  274. */
  275. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
  276. {
  277. return _MAV_RETURN_uint8_t(msg, 24);
  278. }
  279. /**
  280. * @brief Get field target_component from safety_set_allowed_area message
  281. *
  282. * @return Component ID
  283. */
  284. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
  285. {
  286. return _MAV_RETURN_uint8_t(msg, 25);
  287. }
  288. /**
  289. * @brief Get field frame from safety_set_allowed_area message
  290. *
  291. * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  292. */
  293. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
  294. {
  295. return _MAV_RETURN_uint8_t(msg, 26);
  296. }
  297. /**
  298. * @brief Get field p1x from safety_set_allowed_area message
  299. *
  300. * @return [m] x position 1 / Latitude 1
  301. */
  302. static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
  303. {
  304. return _MAV_RETURN_float(msg, 0);
  305. }
  306. /**
  307. * @brief Get field p1y from safety_set_allowed_area message
  308. *
  309. * @return [m] y position 1 / Longitude 1
  310. */
  311. static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
  312. {
  313. return _MAV_RETURN_float(msg, 4);
  314. }
  315. /**
  316. * @brief Get field p1z from safety_set_allowed_area message
  317. *
  318. * @return [m] z position 1 / Altitude 1
  319. */
  320. static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
  321. {
  322. return _MAV_RETURN_float(msg, 8);
  323. }
  324. /**
  325. * @brief Get field p2x from safety_set_allowed_area message
  326. *
  327. * @return [m] x position 2 / Latitude 2
  328. */
  329. static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
  330. {
  331. return _MAV_RETURN_float(msg, 12);
  332. }
  333. /**
  334. * @brief Get field p2y from safety_set_allowed_area message
  335. *
  336. * @return [m] y position 2 / Longitude 2
  337. */
  338. static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
  339. {
  340. return _MAV_RETURN_float(msg, 16);
  341. }
  342. /**
  343. * @brief Get field p2z from safety_set_allowed_area message
  344. *
  345. * @return [m] z position 2 / Altitude 2
  346. */
  347. static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
  348. {
  349. return _MAV_RETURN_float(msg, 20);
  350. }
  351. /**
  352. * @brief Decode a safety_set_allowed_area message into a struct
  353. *
  354. * @param msg The message to decode
  355. * @param safety_set_allowed_area C-struct to decode the message contents into
  356. */
  357. static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
  358. {
  359. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  360. safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg);
  361. safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg);
  362. safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg);
  363. safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg);
  364. safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg);
  365. safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg);
  366. safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg);
  367. safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg);
  368. safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg);
  369. #else
  370. uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN? msg->len : MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN;
  371. memset(safety_set_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  372. memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), len);
  373. #endif
  374. }