mavlink_msg_safety_set_allowed_area.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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
  103. * @param system_id ID of this system
  104. * @param component_id ID of this component (e.g. 200 for IMU)
  105. * @param status MAVLink status structure
  106. * @param msg The MAVLink message to compress the data into
  107. *
  108. * @param target_system System ID
  109. * @param target_component Component ID
  110. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  111. * @param p1x [m] x position 1 / Latitude 1
  112. * @param p1y [m] y position 1 / Longitude 1
  113. * @param p1z [m] z position 1 / Altitude 1
  114. * @param p2x [m] x position 2 / Latitude 2
  115. * @param p2y [m] y position 2 / Longitude 2
  116. * @param p2z [m] z position 2 / Altitude 2
  117. * @return length of the message in bytes (excluding serial stream start sign)
  118. */
  119. static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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. #if MAVLINK_CRC_EXTRA
  149. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, 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);
  150. #else
  151. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  152. #endif
  153. }
  154. /**
  155. * @brief Pack a safety_set_allowed_area message on a channel
  156. * @param system_id ID of this system
  157. * @param component_id ID of this component (e.g. 200 for IMU)
  158. * @param chan The MAVLink channel this message will be sent over
  159. * @param msg The MAVLink message to compress the data into
  160. * @param target_system System ID
  161. * @param target_component Component ID
  162. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  163. * @param p1x [m] x position 1 / Latitude 1
  164. * @param p1y [m] y position 1 / Longitude 1
  165. * @param p1z [m] z position 1 / Altitude 1
  166. * @param p2x [m] x position 2 / Latitude 2
  167. * @param p2y [m] y position 2 / Longitude 2
  168. * @param p2z [m] z position 2 / Altitude 2
  169. * @return length of the message in bytes (excluding serial stream start sign)
  170. */
  171. static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  172. mavlink_message_t* msg,
  173. uint8_t target_system,uint8_t target_component,uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
  174. {
  175. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  176. char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
  177. _mav_put_float(buf, 0, p1x);
  178. _mav_put_float(buf, 4, p1y);
  179. _mav_put_float(buf, 8, p1z);
  180. _mav_put_float(buf, 12, p2x);
  181. _mav_put_float(buf, 16, p2y);
  182. _mav_put_float(buf, 20, p2z);
  183. _mav_put_uint8_t(buf, 24, target_system);
  184. _mav_put_uint8_t(buf, 25, target_component);
  185. _mav_put_uint8_t(buf, 26, frame);
  186. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  187. #else
  188. mavlink_safety_set_allowed_area_t packet;
  189. packet.p1x = p1x;
  190. packet.p1y = p1y;
  191. packet.p1z = p1z;
  192. packet.p2x = p2x;
  193. packet.p2y = p2y;
  194. packet.p2z = p2z;
  195. packet.target_system = target_system;
  196. packet.target_component = target_component;
  197. packet.frame = frame;
  198. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  199. #endif
  200. msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
  201. 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);
  202. }
  203. /**
  204. * @brief Encode a safety_set_allowed_area struct
  205. *
  206. * @param system_id ID of this system
  207. * @param component_id ID of this component (e.g. 200 for IMU)
  208. * @param msg The MAVLink message to compress the data into
  209. * @param safety_set_allowed_area C-struct to read the message contents from
  210. */
  211. 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)
  212. {
  213. 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);
  214. }
  215. /**
  216. * @brief Encode a safety_set_allowed_area struct on a channel
  217. *
  218. * @param system_id ID of this system
  219. * @param component_id ID of this component (e.g. 200 for IMU)
  220. * @param chan The MAVLink channel this message will be sent over
  221. * @param msg The MAVLink message to compress the data into
  222. * @param safety_set_allowed_area C-struct to read the message contents from
  223. */
  224. 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)
  225. {
  226. 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);
  227. }
  228. /**
  229. * @brief Encode a safety_set_allowed_area struct with provided status structure
  230. *
  231. * @param system_id ID of this system
  232. * @param component_id ID of this component (e.g. 200 for IMU)
  233. * @param status MAVLink status structure
  234. * @param msg The MAVLink message to compress the data into
  235. * @param safety_set_allowed_area C-struct to read the message contents from
  236. */
  237. static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
  238. {
  239. return mavlink_msg_safety_set_allowed_area_pack_status(system_id, component_id, _status, 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);
  240. }
  241. /**
  242. * @brief Send a safety_set_allowed_area message
  243. * @param chan MAVLink channel to send the message
  244. *
  245. * @param target_system System ID
  246. * @param target_component Component ID
  247. * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  248. * @param p1x [m] x position 1 / Latitude 1
  249. * @param p1y [m] y position 1 / Longitude 1
  250. * @param p1z [m] z position 1 / Altitude 1
  251. * @param p2x [m] x position 2 / Latitude 2
  252. * @param p2y [m] y position 2 / Longitude 2
  253. * @param p2z [m] z position 2 / Altitude 2
  254. */
  255. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  256. 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)
  257. {
  258. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  259. char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
  260. _mav_put_float(buf, 0, p1x);
  261. _mav_put_float(buf, 4, p1y);
  262. _mav_put_float(buf, 8, p1z);
  263. _mav_put_float(buf, 12, p2x);
  264. _mav_put_float(buf, 16, p2y);
  265. _mav_put_float(buf, 20, p2z);
  266. _mav_put_uint8_t(buf, 24, target_system);
  267. _mav_put_uint8_t(buf, 25, target_component);
  268. _mav_put_uint8_t(buf, 26, frame);
  269. _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);
  270. #else
  271. mavlink_safety_set_allowed_area_t packet;
  272. packet.p1x = p1x;
  273. packet.p1y = p1y;
  274. packet.p1z = p1z;
  275. packet.p2x = p2x;
  276. packet.p2y = p2y;
  277. packet.p2z = p2z;
  278. packet.target_system = target_system;
  279. packet.target_component = target_component;
  280. packet.frame = frame;
  281. _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);
  282. #endif
  283. }
  284. /**
  285. * @brief Send a safety_set_allowed_area message
  286. * @param chan MAVLink channel to send the message
  287. * @param struct The MAVLink struct to serialize
  288. */
  289. 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)
  290. {
  291. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  292. 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);
  293. #else
  294. _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);
  295. #endif
  296. }
  297. #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  298. /*
  299. This variant of _send() can be used to save stack space by re-using
  300. memory from the receive buffer. The caller provides a
  301. mavlink_message_t which is the size of a full mavlink message. This
  302. is usually the receive buffer for the channel, and allows a reply to an
  303. incoming message with minimum stack space usage.
  304. */
  305. 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)
  306. {
  307. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  308. char *buf = (char *)msgbuf;
  309. _mav_put_float(buf, 0, p1x);
  310. _mav_put_float(buf, 4, p1y);
  311. _mav_put_float(buf, 8, p1z);
  312. _mav_put_float(buf, 12, p2x);
  313. _mav_put_float(buf, 16, p2y);
  314. _mav_put_float(buf, 20, p2z);
  315. _mav_put_uint8_t(buf, 24, target_system);
  316. _mav_put_uint8_t(buf, 25, target_component);
  317. _mav_put_uint8_t(buf, 26, frame);
  318. _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);
  319. #else
  320. mavlink_safety_set_allowed_area_t *packet = (mavlink_safety_set_allowed_area_t *)msgbuf;
  321. packet->p1x = p1x;
  322. packet->p1y = p1y;
  323. packet->p1z = p1z;
  324. packet->p2x = p2x;
  325. packet->p2y = p2y;
  326. packet->p2z = p2z;
  327. packet->target_system = target_system;
  328. packet->target_component = target_component;
  329. packet->frame = frame;
  330. _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);
  331. #endif
  332. }
  333. #endif
  334. #endif
  335. // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
  336. /**
  337. * @brief Get field target_system from safety_set_allowed_area message
  338. *
  339. * @return System ID
  340. */
  341. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
  342. {
  343. return _MAV_RETURN_uint8_t(msg, 24);
  344. }
  345. /**
  346. * @brief Get field target_component from safety_set_allowed_area message
  347. *
  348. * @return Component ID
  349. */
  350. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
  351. {
  352. return _MAV_RETURN_uint8_t(msg, 25);
  353. }
  354. /**
  355. * @brief Get field frame from safety_set_allowed_area message
  356. *
  357. * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
  358. */
  359. static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
  360. {
  361. return _MAV_RETURN_uint8_t(msg, 26);
  362. }
  363. /**
  364. * @brief Get field p1x from safety_set_allowed_area message
  365. *
  366. * @return [m] x position 1 / Latitude 1
  367. */
  368. static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
  369. {
  370. return _MAV_RETURN_float(msg, 0);
  371. }
  372. /**
  373. * @brief Get field p1y from safety_set_allowed_area message
  374. *
  375. * @return [m] y position 1 / Longitude 1
  376. */
  377. static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
  378. {
  379. return _MAV_RETURN_float(msg, 4);
  380. }
  381. /**
  382. * @brief Get field p1z from safety_set_allowed_area message
  383. *
  384. * @return [m] z position 1 / Altitude 1
  385. */
  386. static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
  387. {
  388. return _MAV_RETURN_float(msg, 8);
  389. }
  390. /**
  391. * @brief Get field p2x from safety_set_allowed_area message
  392. *
  393. * @return [m] x position 2 / Latitude 2
  394. */
  395. static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
  396. {
  397. return _MAV_RETURN_float(msg, 12);
  398. }
  399. /**
  400. * @brief Get field p2y from safety_set_allowed_area message
  401. *
  402. * @return [m] y position 2 / Longitude 2
  403. */
  404. static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
  405. {
  406. return _MAV_RETURN_float(msg, 16);
  407. }
  408. /**
  409. * @brief Get field p2z from safety_set_allowed_area message
  410. *
  411. * @return [m] z position 2 / Altitude 2
  412. */
  413. static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
  414. {
  415. return _MAV_RETURN_float(msg, 20);
  416. }
  417. /**
  418. * @brief Decode a safety_set_allowed_area message into a struct
  419. *
  420. * @param msg The message to decode
  421. * @param safety_set_allowed_area C-struct to decode the message contents into
  422. */
  423. 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)
  424. {
  425. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  426. safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg);
  427. safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg);
  428. safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg);
  429. safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg);
  430. safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg);
  431. safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg);
  432. safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg);
  433. safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg);
  434. safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg);
  435. #else
  436. uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN? msg->len : MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN;
  437. memset(safety_set_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
  438. memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), len);
  439. #endif
  440. }