mavlink_msg_command_int.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. #pragma once
  2. // MESSAGE COMMAND_INT PACKING
  3. #define MAVLINK_MSG_ID_COMMAND_INT 75
  4. typedef struct __mavlink_command_int_t {
  5. float param1; /*< PARAM1, see MAV_CMD enum*/
  6. float param2; /*< PARAM2, see MAV_CMD enum*/
  7. float param3; /*< PARAM3, see MAV_CMD enum*/
  8. float param4; /*< PARAM4, see MAV_CMD enum*/
  9. int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/
  10. int32_t y; /*< PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7*/
  11. float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).*/
  12. uint16_t command; /*< The scheduled action for the mission item.*/
  13. uint8_t target_system; /*< System ID*/
  14. uint8_t target_component; /*< Component ID*/
  15. uint8_t frame; /*< The coordinate system of the COMMAND.*/
  16. uint8_t current; /*< Not used.*/
  17. uint8_t autocontinue; /*< Not used (set 0).*/
  18. } mavlink_command_int_t;
  19. #define MAVLINK_MSG_ID_COMMAND_INT_LEN 35
  20. #define MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN 35
  21. #define MAVLINK_MSG_ID_75_LEN 35
  22. #define MAVLINK_MSG_ID_75_MIN_LEN 35
  23. #define MAVLINK_MSG_ID_COMMAND_INT_CRC 158
  24. #define MAVLINK_MSG_ID_75_CRC 158
  25. #if MAVLINK_COMMAND_24BIT
  26. #define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
  27. 75, \
  28. "COMMAND_INT", \
  29. 13, \
  30. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
  31. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
  32. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
  33. { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
  34. { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
  35. { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
  36. { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
  37. { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
  38. { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
  39. { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
  40. { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
  41. { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
  42. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
  43. } \
  44. }
  45. #else
  46. #define MAVLINK_MESSAGE_INFO_COMMAND_INT { \
  47. "COMMAND_INT", \
  48. 13, \
  49. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_int_t, target_system) }, \
  50. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_int_t, target_component) }, \
  51. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_int_t, frame) }, \
  52. { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_int_t, command) }, \
  53. { "current", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_command_int_t, current) }, \
  54. { "autocontinue", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_command_int_t, autocontinue) }, \
  55. { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_int_t, param1) }, \
  56. { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_int_t, param2) }, \
  57. { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_int_t, param3) }, \
  58. { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_int_t, param4) }, \
  59. { "x", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_command_int_t, x) }, \
  60. { "y", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_command_int_t, y) }, \
  61. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_int_t, z) }, \
  62. } \
  63. }
  64. #endif
  65. /**
  66. * @brief Pack a command_int message
  67. * @param system_id ID of this system
  68. * @param component_id ID of this component (e.g. 200 for IMU)
  69. * @param msg The MAVLink message to compress the data into
  70. *
  71. * @param target_system System ID
  72. * @param target_component Component ID
  73. * @param frame The coordinate system of the COMMAND.
  74. * @param command The scheduled action for the mission item.
  75. * @param current Not used.
  76. * @param autocontinue Not used (set 0).
  77. * @param param1 PARAM1, see MAV_CMD enum
  78. * @param param2 PARAM2, see MAV_CMD enum
  79. * @param param3 PARAM3, see MAV_CMD enum
  80. * @param param4 PARAM4, see MAV_CMD enum
  81. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  82. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  83. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  84. * @return length of the message in bytes (excluding serial stream start sign)
  85. */
  86. static inline uint16_t mavlink_msg_command_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  87. uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
  88. {
  89. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  90. char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
  91. _mav_put_float(buf, 0, param1);
  92. _mav_put_float(buf, 4, param2);
  93. _mav_put_float(buf, 8, param3);
  94. _mav_put_float(buf, 12, param4);
  95. _mav_put_int32_t(buf, 16, x);
  96. _mav_put_int32_t(buf, 20, y);
  97. _mav_put_float(buf, 24, z);
  98. _mav_put_uint16_t(buf, 28, command);
  99. _mav_put_uint8_t(buf, 30, target_system);
  100. _mav_put_uint8_t(buf, 31, target_component);
  101. _mav_put_uint8_t(buf, 32, frame);
  102. _mav_put_uint8_t(buf, 33, current);
  103. _mav_put_uint8_t(buf, 34, autocontinue);
  104. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  105. #else
  106. mavlink_command_int_t packet;
  107. packet.param1 = param1;
  108. packet.param2 = param2;
  109. packet.param3 = param3;
  110. packet.param4 = param4;
  111. packet.x = x;
  112. packet.y = y;
  113. packet.z = z;
  114. packet.command = command;
  115. packet.target_system = target_system;
  116. packet.target_component = target_component;
  117. packet.frame = frame;
  118. packet.current = current;
  119. packet.autocontinue = autocontinue;
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  121. #endif
  122. msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
  123. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  124. }
  125. /**
  126. * @brief Pack a command_int message on a channel
  127. * @param system_id ID of this system
  128. * @param component_id ID of this component (e.g. 200 for IMU)
  129. * @param chan The MAVLink channel this message will be sent over
  130. * @param msg The MAVLink message to compress the data into
  131. * @param target_system System ID
  132. * @param target_component Component ID
  133. * @param frame The coordinate system of the COMMAND.
  134. * @param command The scheduled action for the mission item.
  135. * @param current Not used.
  136. * @param autocontinue Not used (set 0).
  137. * @param param1 PARAM1, see MAV_CMD enum
  138. * @param param2 PARAM2, see MAV_CMD enum
  139. * @param param3 PARAM3, see MAV_CMD enum
  140. * @param param4 PARAM4, see MAV_CMD enum
  141. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  142. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  143. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  144. * @return length of the message in bytes (excluding serial stream start sign)
  145. */
  146. static inline uint16_t mavlink_msg_command_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  147. mavlink_message_t* msg,
  148. uint8_t target_system,uint8_t target_component,uint8_t frame,uint16_t command,uint8_t current,uint8_t autocontinue,float param1,float param2,float param3,float param4,int32_t x,int32_t y,float z)
  149. {
  150. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  151. char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
  152. _mav_put_float(buf, 0, param1);
  153. _mav_put_float(buf, 4, param2);
  154. _mav_put_float(buf, 8, param3);
  155. _mav_put_float(buf, 12, param4);
  156. _mav_put_int32_t(buf, 16, x);
  157. _mav_put_int32_t(buf, 20, y);
  158. _mav_put_float(buf, 24, z);
  159. _mav_put_uint16_t(buf, 28, command);
  160. _mav_put_uint8_t(buf, 30, target_system);
  161. _mav_put_uint8_t(buf, 31, target_component);
  162. _mav_put_uint8_t(buf, 32, frame);
  163. _mav_put_uint8_t(buf, 33, current);
  164. _mav_put_uint8_t(buf, 34, autocontinue);
  165. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  166. #else
  167. mavlink_command_int_t packet;
  168. packet.param1 = param1;
  169. packet.param2 = param2;
  170. packet.param3 = param3;
  171. packet.param4 = param4;
  172. packet.x = x;
  173. packet.y = y;
  174. packet.z = z;
  175. packet.command = command;
  176. packet.target_system = target_system;
  177. packet.target_component = target_component;
  178. packet.frame = frame;
  179. packet.current = current;
  180. packet.autocontinue = autocontinue;
  181. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  182. #endif
  183. msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
  184. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  185. }
  186. /**
  187. * @brief Encode a command_int struct
  188. *
  189. * @param system_id ID of this system
  190. * @param component_id ID of this component (e.g. 200 for IMU)
  191. * @param msg The MAVLink message to compress the data into
  192. * @param command_int C-struct to read the message contents from
  193. */
  194. static inline uint16_t mavlink_msg_command_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
  195. {
  196. return mavlink_msg_command_int_pack(system_id, component_id, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
  197. }
  198. /**
  199. * @brief Encode a command_int struct on a channel
  200. *
  201. * @param system_id ID of this system
  202. * @param component_id ID of this component (e.g. 200 for IMU)
  203. * @param chan The MAVLink channel this message will be sent over
  204. * @param msg The MAVLink message to compress the data into
  205. * @param command_int C-struct to read the message contents from
  206. */
  207. static inline uint16_t mavlink_msg_command_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
  208. {
  209. return mavlink_msg_command_int_pack_chan(system_id, component_id, chan, msg, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
  210. }
  211. /**
  212. * @brief Send a command_int message
  213. * @param chan MAVLink channel to send the message
  214. *
  215. * @param target_system System ID
  216. * @param target_component Component ID
  217. * @param frame The coordinate system of the COMMAND.
  218. * @param command The scheduled action for the mission item.
  219. * @param current Not used.
  220. * @param autocontinue Not used (set 0).
  221. * @param param1 PARAM1, see MAV_CMD enum
  222. * @param param2 PARAM2, see MAV_CMD enum
  223. * @param param3 PARAM3, see MAV_CMD enum
  224. * @param param4 PARAM4, see MAV_CMD enum
  225. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  226. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  227. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  228. */
  229. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  230. static inline void mavlink_msg_command_int_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
  231. {
  232. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  233. char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
  234. _mav_put_float(buf, 0, param1);
  235. _mav_put_float(buf, 4, param2);
  236. _mav_put_float(buf, 8, param3);
  237. _mav_put_float(buf, 12, param4);
  238. _mav_put_int32_t(buf, 16, x);
  239. _mav_put_int32_t(buf, 20, y);
  240. _mav_put_float(buf, 24, z);
  241. _mav_put_uint16_t(buf, 28, command);
  242. _mav_put_uint8_t(buf, 30, target_system);
  243. _mav_put_uint8_t(buf, 31, target_component);
  244. _mav_put_uint8_t(buf, 32, frame);
  245. _mav_put_uint8_t(buf, 33, current);
  246. _mav_put_uint8_t(buf, 34, autocontinue);
  247. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  248. #else
  249. mavlink_command_int_t packet;
  250. packet.param1 = param1;
  251. packet.param2 = param2;
  252. packet.param3 = param3;
  253. packet.param4 = param4;
  254. packet.x = x;
  255. packet.y = y;
  256. packet.z = z;
  257. packet.command = command;
  258. packet.target_system = target_system;
  259. packet.target_component = target_component;
  260. packet.frame = frame;
  261. packet.current = current;
  262. packet.autocontinue = autocontinue;
  263. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  264. #endif
  265. }
  266. /**
  267. * @brief Send a command_int message
  268. * @param chan MAVLink channel to send the message
  269. * @param struct The MAVLink struct to serialize
  270. */
  271. static inline void mavlink_msg_command_int_send_struct(mavlink_channel_t chan, const mavlink_command_int_t* command_int)
  272. {
  273. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  274. mavlink_msg_command_int_send(chan, command_int->target_system, command_int->target_component, command_int->frame, command_int->command, command_int->current, command_int->autocontinue, command_int->param1, command_int->param2, command_int->param3, command_int->param4, command_int->x, command_int->y, command_int->z);
  275. #else
  276. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)command_int, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  277. #endif
  278. }
  279. #if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  280. /*
  281. This variant of _send() can be used to save stack space by re-using
  282. memory from the receive buffer. The caller provides a
  283. mavlink_message_t which is the size of a full mavlink message. This
  284. is usually the receive buffer for the channel, and allows a reply to an
  285. incoming message with minimum stack space usage.
  286. */
  287. static inline void mavlink_msg_command_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, float param1, float param2, float param3, float param4, int32_t x, int32_t y, float z)
  288. {
  289. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  290. char *buf = (char *)msgbuf;
  291. _mav_put_float(buf, 0, param1);
  292. _mav_put_float(buf, 4, param2);
  293. _mav_put_float(buf, 8, param3);
  294. _mav_put_float(buf, 12, param4);
  295. _mav_put_int32_t(buf, 16, x);
  296. _mav_put_int32_t(buf, 20, y);
  297. _mav_put_float(buf, 24, z);
  298. _mav_put_uint16_t(buf, 28, command);
  299. _mav_put_uint8_t(buf, 30, target_system);
  300. _mav_put_uint8_t(buf, 31, target_component);
  301. _mav_put_uint8_t(buf, 32, frame);
  302. _mav_put_uint8_t(buf, 33, current);
  303. _mav_put_uint8_t(buf, 34, autocontinue);
  304. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, buf, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  305. #else
  306. mavlink_command_int_t *packet = (mavlink_command_int_t *)msgbuf;
  307. packet->param1 = param1;
  308. packet->param2 = param2;
  309. packet->param3 = param3;
  310. packet->param4 = param4;
  311. packet->x = x;
  312. packet->y = y;
  313. packet->z = z;
  314. packet->command = command;
  315. packet->target_system = target_system;
  316. packet->target_component = target_component;
  317. packet->frame = frame;
  318. packet->current = current;
  319. packet->autocontinue = autocontinue;
  320. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_INT, (const char *)packet, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  321. #endif
  322. }
  323. #endif
  324. #endif
  325. // MESSAGE COMMAND_INT UNPACKING
  326. /**
  327. * @brief Get field target_system from command_int message
  328. *
  329. * @return System ID
  330. */
  331. static inline uint8_t mavlink_msg_command_int_get_target_system(const mavlink_message_t* msg)
  332. {
  333. return _MAV_RETURN_uint8_t(msg, 30);
  334. }
  335. /**
  336. * @brief Get field target_component from command_int message
  337. *
  338. * @return Component ID
  339. */
  340. static inline uint8_t mavlink_msg_command_int_get_target_component(const mavlink_message_t* msg)
  341. {
  342. return _MAV_RETURN_uint8_t(msg, 31);
  343. }
  344. /**
  345. * @brief Get field frame from command_int message
  346. *
  347. * @return The coordinate system of the COMMAND.
  348. */
  349. static inline uint8_t mavlink_msg_command_int_get_frame(const mavlink_message_t* msg)
  350. {
  351. return _MAV_RETURN_uint8_t(msg, 32);
  352. }
  353. /**
  354. * @brief Get field command from command_int message
  355. *
  356. * @return The scheduled action for the mission item.
  357. */
  358. static inline uint16_t mavlink_msg_command_int_get_command(const mavlink_message_t* msg)
  359. {
  360. return _MAV_RETURN_uint16_t(msg, 28);
  361. }
  362. /**
  363. * @brief Get field current from command_int message
  364. *
  365. * @return Not used.
  366. */
  367. static inline uint8_t mavlink_msg_command_int_get_current(const mavlink_message_t* msg)
  368. {
  369. return _MAV_RETURN_uint8_t(msg, 33);
  370. }
  371. /**
  372. * @brief Get field autocontinue from command_int message
  373. *
  374. * @return Not used (set 0).
  375. */
  376. static inline uint8_t mavlink_msg_command_int_get_autocontinue(const mavlink_message_t* msg)
  377. {
  378. return _MAV_RETURN_uint8_t(msg, 34);
  379. }
  380. /**
  381. * @brief Get field param1 from command_int message
  382. *
  383. * @return PARAM1, see MAV_CMD enum
  384. */
  385. static inline float mavlink_msg_command_int_get_param1(const mavlink_message_t* msg)
  386. {
  387. return _MAV_RETURN_float(msg, 0);
  388. }
  389. /**
  390. * @brief Get field param2 from command_int message
  391. *
  392. * @return PARAM2, see MAV_CMD enum
  393. */
  394. static inline float mavlink_msg_command_int_get_param2(const mavlink_message_t* msg)
  395. {
  396. return _MAV_RETURN_float(msg, 4);
  397. }
  398. /**
  399. * @brief Get field param3 from command_int message
  400. *
  401. * @return PARAM3, see MAV_CMD enum
  402. */
  403. static inline float mavlink_msg_command_int_get_param3(const mavlink_message_t* msg)
  404. {
  405. return _MAV_RETURN_float(msg, 8);
  406. }
  407. /**
  408. * @brief Get field param4 from command_int message
  409. *
  410. * @return PARAM4, see MAV_CMD enum
  411. */
  412. static inline float mavlink_msg_command_int_get_param4(const mavlink_message_t* msg)
  413. {
  414. return _MAV_RETURN_float(msg, 12);
  415. }
  416. /**
  417. * @brief Get field x from command_int message
  418. *
  419. * @return PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  420. */
  421. static inline int32_t mavlink_msg_command_int_get_x(const mavlink_message_t* msg)
  422. {
  423. return _MAV_RETURN_int32_t(msg, 16);
  424. }
  425. /**
  426. * @brief Get field y from command_int message
  427. *
  428. * @return PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  429. */
  430. static inline int32_t mavlink_msg_command_int_get_y(const mavlink_message_t* msg)
  431. {
  432. return _MAV_RETURN_int32_t(msg, 20);
  433. }
  434. /**
  435. * @brief Get field z from command_int message
  436. *
  437. * @return PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  438. */
  439. static inline float mavlink_msg_command_int_get_z(const mavlink_message_t* msg)
  440. {
  441. return _MAV_RETURN_float(msg, 24);
  442. }
  443. /**
  444. * @brief Decode a command_int message into a struct
  445. *
  446. * @param msg The message to decode
  447. * @param command_int C-struct to decode the message contents into
  448. */
  449. static inline void mavlink_msg_command_int_decode(const mavlink_message_t* msg, mavlink_command_int_t* command_int)
  450. {
  451. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  452. command_int->param1 = mavlink_msg_command_int_get_param1(msg);
  453. command_int->param2 = mavlink_msg_command_int_get_param2(msg);
  454. command_int->param3 = mavlink_msg_command_int_get_param3(msg);
  455. command_int->param4 = mavlink_msg_command_int_get_param4(msg);
  456. command_int->x = mavlink_msg_command_int_get_x(msg);
  457. command_int->y = mavlink_msg_command_int_get_y(msg);
  458. command_int->z = mavlink_msg_command_int_get_z(msg);
  459. command_int->command = mavlink_msg_command_int_get_command(msg);
  460. command_int->target_system = mavlink_msg_command_int_get_target_system(msg);
  461. command_int->target_component = mavlink_msg_command_int_get_target_component(msg);
  462. command_int->frame = mavlink_msg_command_int_get_frame(msg);
  463. command_int->current = mavlink_msg_command_int_get_current(msg);
  464. command_int->autocontinue = mavlink_msg_command_int_get_autocontinue(msg);
  465. #else
  466. uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_INT_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_INT_LEN;
  467. memset(command_int, 0, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  468. memcpy(command_int, _MAV_PAYLOAD(msg), len);
  469. #endif
  470. }