/libs/mavlink/include/mavlink/v1.0/matrixpilot/mavlink_msg_flexifunction_buffer_function_ack.h

https://gitlab.com/fsgdez/apm_planner · C Header · 229 lines · 131 code · 29 blank · 69 comment · 3 complexity · 86072d9b38e597c4e8d0ea69f1d87e3d MD5 · raw file

  1. // MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION_ACK PACKING
  2. #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK 153
  3. typedef struct __mavlink_flexifunction_buffer_function_ack_t
  4. {
  5. uint16_t func_index; ///< Function index
  6. uint16_t result; ///< result of acknowledge, 0=fail, 1=good
  7. uint8_t target_system; ///< System ID
  8. uint8_t target_component; ///< Component ID
  9. } mavlink_flexifunction_buffer_function_ack_t;
  10. #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN 6
  11. #define MAVLINK_MSG_ID_153_LEN 6
  12. #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC 109
  13. #define MAVLINK_MSG_ID_153_CRC 109
  14. #define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION_ACK { \
  15. "FLEXIFUNCTION_BUFFER_FUNCTION_ACK", \
  16. 4, \
  17. { { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_ack_t, func_index) }, \
  18. { "result", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_ack_t, result) }, \
  19. { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_system) }, \
  20. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_flexifunction_buffer_function_ack_t, target_component) }, \
  21. } \
  22. }
  23. /**
  24. * @brief Pack a flexifunction_buffer_function_ack message
  25. * @param system_id ID of this system
  26. * @param component_id ID of this component (e.g. 200 for IMU)
  27. * @param msg The MAVLink message to compress the data into
  28. *
  29. * @param target_system System ID
  30. * @param target_component Component ID
  31. * @param func_index Function index
  32. * @param result result of acknowledge, 0=fail, 1=good
  33. * @return length of the message in bytes (excluding serial stream start sign)
  34. */
  35. static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  36. uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t result)
  37. {
  38. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  39. char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN];
  40. _mav_put_uint16_t(buf, 0, func_index);
  41. _mav_put_uint16_t(buf, 2, result);
  42. _mav_put_uint8_t(buf, 4, target_system);
  43. _mav_put_uint8_t(buf, 5, target_component);
  44. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  45. #else
  46. mavlink_flexifunction_buffer_function_ack_t packet;
  47. packet.func_index = func_index;
  48. packet.result = result;
  49. packet.target_system = target_system;
  50. packet.target_component = target_component;
  51. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  52. #endif
  53. msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK;
  54. #if MAVLINK_CRC_EXTRA
  55. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC);
  56. #else
  57. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  58. #endif
  59. }
  60. /**
  61. * @brief Pack a flexifunction_buffer_function_ack message on a channel
  62. * @param system_id ID of this system
  63. * @param component_id ID of this component (e.g. 200 for IMU)
  64. * @param chan The MAVLink channel this message was sent over
  65. * @param msg The MAVLink message to compress the data into
  66. * @param target_system System ID
  67. * @param target_component Component ID
  68. * @param func_index Function index
  69. * @param result result of acknowledge, 0=fail, 1=good
  70. * @return length of the message in bytes (excluding serial stream start sign)
  71. */
  72. static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  73. mavlink_message_t* msg,
  74. uint8_t target_system,uint8_t target_component,uint16_t func_index,uint16_t result)
  75. {
  76. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  77. char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN];
  78. _mav_put_uint16_t(buf, 0, func_index);
  79. _mav_put_uint16_t(buf, 2, result);
  80. _mav_put_uint8_t(buf, 4, target_system);
  81. _mav_put_uint8_t(buf, 5, target_component);
  82. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  83. #else
  84. mavlink_flexifunction_buffer_function_ack_t packet;
  85. packet.func_index = func_index;
  86. packet.result = result;
  87. packet.target_system = target_system;
  88. packet.target_component = target_component;
  89. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  90. #endif
  91. msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK;
  92. #if MAVLINK_CRC_EXTRA
  93. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC);
  94. #else
  95. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  96. #endif
  97. }
  98. /**
  99. * @brief Encode a flexifunction_buffer_function_ack struct into a message
  100. *
  101. * @param system_id ID of this system
  102. * @param component_id ID of this component (e.g. 200 for IMU)
  103. * @param msg The MAVLink message to compress the data into
  104. * @param flexifunction_buffer_function_ack C-struct to read the message contents from
  105. */
  106. static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack)
  107. {
  108. return mavlink_msg_flexifunction_buffer_function_ack_pack(system_id, component_id, msg, flexifunction_buffer_function_ack->target_system, flexifunction_buffer_function_ack->target_component, flexifunction_buffer_function_ack->func_index, flexifunction_buffer_function_ack->result);
  109. }
  110. /**
  111. * @brief Send a flexifunction_buffer_function_ack message
  112. * @param chan MAVLink channel to send the message
  113. *
  114. * @param target_system System ID
  115. * @param target_component Component ID
  116. * @param func_index Function index
  117. * @param result result of acknowledge, 0=fail, 1=good
  118. */
  119. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  120. static inline void mavlink_msg_flexifunction_buffer_function_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t result)
  121. {
  122. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  123. char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN];
  124. _mav_put_uint16_t(buf, 0, func_index);
  125. _mav_put_uint16_t(buf, 2, result);
  126. _mav_put_uint8_t(buf, 4, target_system);
  127. _mav_put_uint8_t(buf, 5, target_component);
  128. #if MAVLINK_CRC_EXTRA
  129. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC);
  130. #else
  131. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  132. #endif
  133. #else
  134. mavlink_flexifunction_buffer_function_ack_t packet;
  135. packet.func_index = func_index;
  136. packet.result = result;
  137. packet.target_system = target_system;
  138. packet.target_component = target_component;
  139. #if MAVLINK_CRC_EXTRA
  140. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_CRC);
  141. #else
  142. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  143. #endif
  144. #endif
  145. }
  146. #endif
  147. // MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION_ACK UNPACKING
  148. /**
  149. * @brief Get field target_system from flexifunction_buffer_function_ack message
  150. *
  151. * @return System ID
  152. */
  153. static inline uint8_t mavlink_msg_flexifunction_buffer_function_ack_get_target_system(const mavlink_message_t* msg)
  154. {
  155. return _MAV_RETURN_uint8_t(msg, 4);
  156. }
  157. /**
  158. * @brief Get field target_component from flexifunction_buffer_function_ack message
  159. *
  160. * @return Component ID
  161. */
  162. static inline uint8_t mavlink_msg_flexifunction_buffer_function_ack_get_target_component(const mavlink_message_t* msg)
  163. {
  164. return _MAV_RETURN_uint8_t(msg, 5);
  165. }
  166. /**
  167. * @brief Get field func_index from flexifunction_buffer_function_ack message
  168. *
  169. * @return Function index
  170. */
  171. static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_get_func_index(const mavlink_message_t* msg)
  172. {
  173. return _MAV_RETURN_uint16_t(msg, 0);
  174. }
  175. /**
  176. * @brief Get field result from flexifunction_buffer_function_ack message
  177. *
  178. * @return result of acknowledge, 0=fail, 1=good
  179. */
  180. static inline uint16_t mavlink_msg_flexifunction_buffer_function_ack_get_result(const mavlink_message_t* msg)
  181. {
  182. return _MAV_RETURN_uint16_t(msg, 2);
  183. }
  184. /**
  185. * @brief Decode a flexifunction_buffer_function_ack message into a struct
  186. *
  187. * @param msg The message to decode
  188. * @param flexifunction_buffer_function_ack C-struct to decode the message contents into
  189. */
  190. static inline void mavlink_msg_flexifunction_buffer_function_ack_decode(const mavlink_message_t* msg, mavlink_flexifunction_buffer_function_ack_t* flexifunction_buffer_function_ack)
  191. {
  192. #if MAVLINK_NEED_BYTE_SWAP
  193. flexifunction_buffer_function_ack->func_index = mavlink_msg_flexifunction_buffer_function_ack_get_func_index(msg);
  194. flexifunction_buffer_function_ack->result = mavlink_msg_flexifunction_buffer_function_ack_get_result(msg);
  195. flexifunction_buffer_function_ack->target_system = mavlink_msg_flexifunction_buffer_function_ack_get_target_system(msg);
  196. flexifunction_buffer_function_ack->target_component = mavlink_msg_flexifunction_buffer_function_ack_get_target_component(msg);
  197. #else
  198. memcpy(flexifunction_buffer_function_ack, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_ACK_LEN);
  199. #endif
  200. }