mavlink_msg_command_int.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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
  127. * @param system_id ID of this system
  128. * @param component_id ID of this component (e.g. 200 for IMU)
  129. * @param status MAVLink status structure
  130. * @param msg The MAVLink message to compress the data into
  131. *
  132. * @param target_system System ID
  133. * @param target_component Component ID
  134. * @param frame The coordinate system of the COMMAND.
  135. * @param command The scheduled action for the mission item.
  136. * @param current Not used.
  137. * @param autocontinue Not used (set 0).
  138. * @param param1 PARAM1, see MAV_CMD enum
  139. * @param param2 PARAM2, see MAV_CMD enum
  140. * @param param3 PARAM3, see MAV_CMD enum
  141. * @param param4 PARAM4, see MAV_CMD enum
  142. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  143. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  144. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  145. * @return length of the message in bytes (excluding serial stream start sign)
  146. */
  147. static inline uint16_t mavlink_msg_command_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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. #if MAVLINK_CRC_EXTRA
  185. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN, MAVLINK_MSG_ID_COMMAND_INT_CRC);
  186. #else
  187. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  188. #endif
  189. }
  190. /**
  191. * @brief Pack a command_int message on a channel
  192. * @param system_id ID of this system
  193. * @param component_id ID of this component (e.g. 200 for IMU)
  194. * @param chan The MAVLink channel this message will be sent over
  195. * @param msg The MAVLink message to compress the data into
  196. * @param target_system System ID
  197. * @param target_component Component ID
  198. * @param frame The coordinate system of the COMMAND.
  199. * @param command The scheduled action for the mission item.
  200. * @param current Not used.
  201. * @param autocontinue Not used (set 0).
  202. * @param param1 PARAM1, see MAV_CMD enum
  203. * @param param2 PARAM2, see MAV_CMD enum
  204. * @param param3 PARAM3, see MAV_CMD enum
  205. * @param param4 PARAM4, see MAV_CMD enum
  206. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  207. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  208. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  209. * @return length of the message in bytes (excluding serial stream start sign)
  210. */
  211. static inline uint16_t mavlink_msg_command_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  212. mavlink_message_t* msg,
  213. 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)
  214. {
  215. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  216. char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
  217. _mav_put_float(buf, 0, param1);
  218. _mav_put_float(buf, 4, param2);
  219. _mav_put_float(buf, 8, param3);
  220. _mav_put_float(buf, 12, param4);
  221. _mav_put_int32_t(buf, 16, x);
  222. _mav_put_int32_t(buf, 20, y);
  223. _mav_put_float(buf, 24, z);
  224. _mav_put_uint16_t(buf, 28, command);
  225. _mav_put_uint8_t(buf, 30, target_system);
  226. _mav_put_uint8_t(buf, 31, target_component);
  227. _mav_put_uint8_t(buf, 32, frame);
  228. _mav_put_uint8_t(buf, 33, current);
  229. _mav_put_uint8_t(buf, 34, autocontinue);
  230. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  231. #else
  232. mavlink_command_int_t packet;
  233. packet.param1 = param1;
  234. packet.param2 = param2;
  235. packet.param3 = param3;
  236. packet.param4 = param4;
  237. packet.x = x;
  238. packet.y = y;
  239. packet.z = z;
  240. packet.command = command;
  241. packet.target_system = target_system;
  242. packet.target_component = target_component;
  243. packet.frame = frame;
  244. packet.current = current;
  245. packet.autocontinue = autocontinue;
  246. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  247. #endif
  248. msg->msgid = MAVLINK_MSG_ID_COMMAND_INT;
  249. 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);
  250. }
  251. /**
  252. * @brief Encode a command_int struct
  253. *
  254. * @param system_id ID of this system
  255. * @param component_id ID of this component (e.g. 200 for IMU)
  256. * @param msg The MAVLink message to compress the data into
  257. * @param command_int C-struct to read the message contents from
  258. */
  259. 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)
  260. {
  261. 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);
  262. }
  263. /**
  264. * @brief Encode a command_int struct on a channel
  265. *
  266. * @param system_id ID of this system
  267. * @param component_id ID of this component (e.g. 200 for IMU)
  268. * @param chan The MAVLink channel this message will be sent over
  269. * @param msg The MAVLink message to compress the data into
  270. * @param command_int C-struct to read the message contents from
  271. */
  272. 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)
  273. {
  274. 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);
  275. }
  276. /**
  277. * @brief Encode a command_int struct with provided status structure
  278. *
  279. * @param system_id ID of this system
  280. * @param component_id ID of this component (e.g. 200 for IMU)
  281. * @param status MAVLink status structure
  282. * @param msg The MAVLink message to compress the data into
  283. * @param command_int C-struct to read the message contents from
  284. */
  285. static inline uint16_t mavlink_msg_command_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_command_int_t* command_int)
  286. {
  287. return mavlink_msg_command_int_pack_status(system_id, component_id, _status, 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);
  288. }
  289. /**
  290. * @brief Send a command_int message
  291. * @param chan MAVLink channel to send the message
  292. *
  293. * @param target_system System ID
  294. * @param target_component Component ID
  295. * @param frame The coordinate system of the COMMAND.
  296. * @param command The scheduled action for the mission item.
  297. * @param current Not used.
  298. * @param autocontinue Not used (set 0).
  299. * @param param1 PARAM1, see MAV_CMD enum
  300. * @param param2 PARAM2, see MAV_CMD enum
  301. * @param param3 PARAM3, see MAV_CMD enum
  302. * @param param4 PARAM4, see MAV_CMD enum
  303. * @param x PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  304. * @param y PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  305. * @param z PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  306. */
  307. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  308. 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)
  309. {
  310. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  311. char buf[MAVLINK_MSG_ID_COMMAND_INT_LEN];
  312. _mav_put_float(buf, 0, param1);
  313. _mav_put_float(buf, 4, param2);
  314. _mav_put_float(buf, 8, param3);
  315. _mav_put_float(buf, 12, param4);
  316. _mav_put_int32_t(buf, 16, x);
  317. _mav_put_int32_t(buf, 20, y);
  318. _mav_put_float(buf, 24, z);
  319. _mav_put_uint16_t(buf, 28, command);
  320. _mav_put_uint8_t(buf, 30, target_system);
  321. _mav_put_uint8_t(buf, 31, target_component);
  322. _mav_put_uint8_t(buf, 32, frame);
  323. _mav_put_uint8_t(buf, 33, current);
  324. _mav_put_uint8_t(buf, 34, autocontinue);
  325. _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);
  326. #else
  327. mavlink_command_int_t packet;
  328. packet.param1 = param1;
  329. packet.param2 = param2;
  330. packet.param3 = param3;
  331. packet.param4 = param4;
  332. packet.x = x;
  333. packet.y = y;
  334. packet.z = z;
  335. packet.command = command;
  336. packet.target_system = target_system;
  337. packet.target_component = target_component;
  338. packet.frame = frame;
  339. packet.current = current;
  340. packet.autocontinue = autocontinue;
  341. _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);
  342. #endif
  343. }
  344. /**
  345. * @brief Send a command_int message
  346. * @param chan MAVLink channel to send the message
  347. * @param struct The MAVLink struct to serialize
  348. */
  349. static inline void mavlink_msg_command_int_send_struct(mavlink_channel_t chan, const mavlink_command_int_t* command_int)
  350. {
  351. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  352. 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);
  353. #else
  354. _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);
  355. #endif
  356. }
  357. #if MAVLINK_MSG_ID_COMMAND_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  358. /*
  359. This variant of _send() can be used to save stack space by re-using
  360. memory from the receive buffer. The caller provides a
  361. mavlink_message_t which is the size of a full mavlink message. This
  362. is usually the receive buffer for the channel, and allows a reply to an
  363. incoming message with minimum stack space usage.
  364. */
  365. 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)
  366. {
  367. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  368. char *buf = (char *)msgbuf;
  369. _mav_put_float(buf, 0, param1);
  370. _mav_put_float(buf, 4, param2);
  371. _mav_put_float(buf, 8, param3);
  372. _mav_put_float(buf, 12, param4);
  373. _mav_put_int32_t(buf, 16, x);
  374. _mav_put_int32_t(buf, 20, y);
  375. _mav_put_float(buf, 24, z);
  376. _mav_put_uint16_t(buf, 28, command);
  377. _mav_put_uint8_t(buf, 30, target_system);
  378. _mav_put_uint8_t(buf, 31, target_component);
  379. _mav_put_uint8_t(buf, 32, frame);
  380. _mav_put_uint8_t(buf, 33, current);
  381. _mav_put_uint8_t(buf, 34, autocontinue);
  382. _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);
  383. #else
  384. mavlink_command_int_t *packet = (mavlink_command_int_t *)msgbuf;
  385. packet->param1 = param1;
  386. packet->param2 = param2;
  387. packet->param3 = param3;
  388. packet->param4 = param4;
  389. packet->x = x;
  390. packet->y = y;
  391. packet->z = z;
  392. packet->command = command;
  393. packet->target_system = target_system;
  394. packet->target_component = target_component;
  395. packet->frame = frame;
  396. packet->current = current;
  397. packet->autocontinue = autocontinue;
  398. _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);
  399. #endif
  400. }
  401. #endif
  402. #endif
  403. // MESSAGE COMMAND_INT UNPACKING
  404. /**
  405. * @brief Get field target_system from command_int message
  406. *
  407. * @return System ID
  408. */
  409. static inline uint8_t mavlink_msg_command_int_get_target_system(const mavlink_message_t* msg)
  410. {
  411. return _MAV_RETURN_uint8_t(msg, 30);
  412. }
  413. /**
  414. * @brief Get field target_component from command_int message
  415. *
  416. * @return Component ID
  417. */
  418. static inline uint8_t mavlink_msg_command_int_get_target_component(const mavlink_message_t* msg)
  419. {
  420. return _MAV_RETURN_uint8_t(msg, 31);
  421. }
  422. /**
  423. * @brief Get field frame from command_int message
  424. *
  425. * @return The coordinate system of the COMMAND.
  426. */
  427. static inline uint8_t mavlink_msg_command_int_get_frame(const mavlink_message_t* msg)
  428. {
  429. return _MAV_RETURN_uint8_t(msg, 32);
  430. }
  431. /**
  432. * @brief Get field command from command_int message
  433. *
  434. * @return The scheduled action for the mission item.
  435. */
  436. static inline uint16_t mavlink_msg_command_int_get_command(const mavlink_message_t* msg)
  437. {
  438. return _MAV_RETURN_uint16_t(msg, 28);
  439. }
  440. /**
  441. * @brief Get field current from command_int message
  442. *
  443. * @return Not used.
  444. */
  445. static inline uint8_t mavlink_msg_command_int_get_current(const mavlink_message_t* msg)
  446. {
  447. return _MAV_RETURN_uint8_t(msg, 33);
  448. }
  449. /**
  450. * @brief Get field autocontinue from command_int message
  451. *
  452. * @return Not used (set 0).
  453. */
  454. static inline uint8_t mavlink_msg_command_int_get_autocontinue(const mavlink_message_t* msg)
  455. {
  456. return _MAV_RETURN_uint8_t(msg, 34);
  457. }
  458. /**
  459. * @brief Get field param1 from command_int message
  460. *
  461. * @return PARAM1, see MAV_CMD enum
  462. */
  463. static inline float mavlink_msg_command_int_get_param1(const mavlink_message_t* msg)
  464. {
  465. return _MAV_RETURN_float(msg, 0);
  466. }
  467. /**
  468. * @brief Get field param2 from command_int message
  469. *
  470. * @return PARAM2, see MAV_CMD enum
  471. */
  472. static inline float mavlink_msg_command_int_get_param2(const mavlink_message_t* msg)
  473. {
  474. return _MAV_RETURN_float(msg, 4);
  475. }
  476. /**
  477. * @brief Get field param3 from command_int message
  478. *
  479. * @return PARAM3, see MAV_CMD enum
  480. */
  481. static inline float mavlink_msg_command_int_get_param3(const mavlink_message_t* msg)
  482. {
  483. return _MAV_RETURN_float(msg, 8);
  484. }
  485. /**
  486. * @brief Get field param4 from command_int message
  487. *
  488. * @return PARAM4, see MAV_CMD enum
  489. */
  490. static inline float mavlink_msg_command_int_get_param4(const mavlink_message_t* msg)
  491. {
  492. return _MAV_RETURN_float(msg, 12);
  493. }
  494. /**
  495. * @brief Get field x from command_int message
  496. *
  497. * @return PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7
  498. */
  499. static inline int32_t mavlink_msg_command_int_get_x(const mavlink_message_t* msg)
  500. {
  501. return _MAV_RETURN_int32_t(msg, 16);
  502. }
  503. /**
  504. * @brief Get field y from command_int message
  505. *
  506. * @return PARAM6 / local: y position in meters * 1e4, global: longitude in degrees * 10^7
  507. */
  508. static inline int32_t mavlink_msg_command_int_get_y(const mavlink_message_t* msg)
  509. {
  510. return _MAV_RETURN_int32_t(msg, 20);
  511. }
  512. /**
  513. * @brief Get field z from command_int message
  514. *
  515. * @return PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame).
  516. */
  517. static inline float mavlink_msg_command_int_get_z(const mavlink_message_t* msg)
  518. {
  519. return _MAV_RETURN_float(msg, 24);
  520. }
  521. /**
  522. * @brief Decode a command_int message into a struct
  523. *
  524. * @param msg The message to decode
  525. * @param command_int C-struct to decode the message contents into
  526. */
  527. static inline void mavlink_msg_command_int_decode(const mavlink_message_t* msg, mavlink_command_int_t* command_int)
  528. {
  529. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  530. command_int->param1 = mavlink_msg_command_int_get_param1(msg);
  531. command_int->param2 = mavlink_msg_command_int_get_param2(msg);
  532. command_int->param3 = mavlink_msg_command_int_get_param3(msg);
  533. command_int->param4 = mavlink_msg_command_int_get_param4(msg);
  534. command_int->x = mavlink_msg_command_int_get_x(msg);
  535. command_int->y = mavlink_msg_command_int_get_y(msg);
  536. command_int->z = mavlink_msg_command_int_get_z(msg);
  537. command_int->command = mavlink_msg_command_int_get_command(msg);
  538. command_int->target_system = mavlink_msg_command_int_get_target_system(msg);
  539. command_int->target_component = mavlink_msg_command_int_get_target_component(msg);
  540. command_int->frame = mavlink_msg_command_int_get_frame(msg);
  541. command_int->current = mavlink_msg_command_int_get_current(msg);
  542. command_int->autocontinue = mavlink_msg_command_int_get_autocontinue(msg);
  543. #else
  544. uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_INT_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_INT_LEN;
  545. memset(command_int, 0, MAVLINK_MSG_ID_COMMAND_INT_LEN);
  546. memcpy(command_int, _MAV_PAYLOAD(msg), len);
  547. #endif
  548. }