/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_log_request_end.h

https://gitlab.com/fsgdez/apm_planner · C Header · 233 lines · 133 code · 31 blank · 69 comment · 4 complexity · 021c67e344b056e9858cfef5be9d4fe0 MD5 · raw file

  1. // MESSAGE LOG_REQUEST_END PACKING
  2. #define MAVLINK_MSG_ID_LOG_REQUEST_END 122
  3. typedef struct __mavlink_log_request_end_t
  4. {
  5. uint8_t target_system; ///< System ID
  6. uint8_t target_component; ///< Component ID
  7. } mavlink_log_request_end_t;
  8. #define MAVLINK_MSG_ID_LOG_REQUEST_END_LEN 2
  9. #define MAVLINK_MSG_ID_122_LEN 2
  10. #define MAVLINK_MSG_ID_LOG_REQUEST_END_CRC 203
  11. #define MAVLINK_MSG_ID_122_CRC 203
  12. #define MAVLINK_MESSAGE_INFO_LOG_REQUEST_END { \
  13. "LOG_REQUEST_END", \
  14. 2, \
  15. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_log_request_end_t, target_system) }, \
  16. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_log_request_end_t, target_component) }, \
  17. } \
  18. }
  19. /**
  20. * @brief Pack a log_request_end message
  21. * @param system_id ID of this system
  22. * @param component_id ID of this component (e.g. 200 for IMU)
  23. * @param msg The MAVLink message to compress the data into
  24. *
  25. * @param target_system System ID
  26. * @param target_component Component ID
  27. * @return length of the message in bytes (excluding serial stream start sign)
  28. */
  29. static inline uint16_t mavlink_msg_log_request_end_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  30. uint8_t target_system, uint8_t target_component)
  31. {
  32. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  33. char buf[MAVLINK_MSG_ID_LOG_REQUEST_END_LEN];
  34. _mav_put_uint8_t(buf, 0, target_system);
  35. _mav_put_uint8_t(buf, 1, target_component);
  36. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  37. #else
  38. mavlink_log_request_end_t packet;
  39. packet.target_system = target_system;
  40. packet.target_component = target_component;
  41. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  42. #endif
  43. msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_END;
  44. #if MAVLINK_CRC_EXTRA
  45. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  46. #else
  47. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  48. #endif
  49. }
  50. /**
  51. * @brief Pack a log_request_end message on a channel
  52. * @param system_id ID of this system
  53. * @param component_id ID of this component (e.g. 200 for IMU)
  54. * @param chan The MAVLink channel this message will be sent over
  55. * @param msg The MAVLink message to compress the data into
  56. * @param target_system System ID
  57. * @param target_component Component ID
  58. * @return length of the message in bytes (excluding serial stream start sign)
  59. */
  60. static inline uint16_t mavlink_msg_log_request_end_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  61. mavlink_message_t* msg,
  62. uint8_t target_system,uint8_t target_component)
  63. {
  64. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  65. char buf[MAVLINK_MSG_ID_LOG_REQUEST_END_LEN];
  66. _mav_put_uint8_t(buf, 0, target_system);
  67. _mav_put_uint8_t(buf, 1, target_component);
  68. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  69. #else
  70. mavlink_log_request_end_t packet;
  71. packet.target_system = target_system;
  72. packet.target_component = target_component;
  73. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  74. #endif
  75. msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_END;
  76. #if MAVLINK_CRC_EXTRA
  77. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  78. #else
  79. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  80. #endif
  81. }
  82. /**
  83. * @brief Encode a log_request_end struct
  84. *
  85. * @param system_id ID of this system
  86. * @param component_id ID of this component (e.g. 200 for IMU)
  87. * @param msg The MAVLink message to compress the data into
  88. * @param log_request_end C-struct to read the message contents from
  89. */
  90. static inline uint16_t mavlink_msg_log_request_end_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_log_request_end_t* log_request_end)
  91. {
  92. return mavlink_msg_log_request_end_pack(system_id, component_id, msg, log_request_end->target_system, log_request_end->target_component);
  93. }
  94. /**
  95. * @brief Encode a log_request_end struct on a channel
  96. *
  97. * @param system_id ID of this system
  98. * @param component_id ID of this component (e.g. 200 for IMU)
  99. * @param chan The MAVLink channel this message will be sent over
  100. * @param msg The MAVLink message to compress the data into
  101. * @param log_request_end C-struct to read the message contents from
  102. */
  103. static inline uint16_t mavlink_msg_log_request_end_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_log_request_end_t* log_request_end)
  104. {
  105. return mavlink_msg_log_request_end_pack_chan(system_id, component_id, chan, msg, log_request_end->target_system, log_request_end->target_component);
  106. }
  107. /**
  108. * @brief Send a log_request_end message
  109. * @param chan MAVLink channel to send the message
  110. *
  111. * @param target_system System ID
  112. * @param target_component Component ID
  113. */
  114. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  115. static inline void mavlink_msg_log_request_end_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component)
  116. {
  117. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  118. char buf[MAVLINK_MSG_ID_LOG_REQUEST_END_LEN];
  119. _mav_put_uint8_t(buf, 0, target_system);
  120. _mav_put_uint8_t(buf, 1, target_component);
  121. #if MAVLINK_CRC_EXTRA
  122. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  123. #else
  124. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  125. #endif
  126. #else
  127. mavlink_log_request_end_t packet;
  128. packet.target_system = target_system;
  129. packet.target_component = target_component;
  130. #if MAVLINK_CRC_EXTRA
  131. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, (const char *)&packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  132. #else
  133. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, (const char *)&packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  134. #endif
  135. #endif
  136. }
  137. #if MAVLINK_MSG_ID_LOG_REQUEST_END_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  138. /*
  139. This varient of _send() can be used to save stack space by re-using
  140. memory from the receive buffer. The caller provides a
  141. mavlink_message_t which is the size of a full mavlink message. This
  142. is usually the receive buffer for the channel, and allows a reply to an
  143. incoming message with minimum stack space usage.
  144. */
  145. static inline void mavlink_msg_log_request_end_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component)
  146. {
  147. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  148. char *buf = (char *)msgbuf;
  149. _mav_put_uint8_t(buf, 0, target_system);
  150. _mav_put_uint8_t(buf, 1, target_component);
  151. #if MAVLINK_CRC_EXTRA
  152. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  153. #else
  154. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, buf, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  155. #endif
  156. #else
  157. mavlink_log_request_end_t *packet = (mavlink_log_request_end_t *)msgbuf;
  158. packet->target_system = target_system;
  159. packet->target_component = target_component;
  160. #if MAVLINK_CRC_EXTRA
  161. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, (const char *)packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN, MAVLINK_MSG_ID_LOG_REQUEST_END_CRC);
  162. #else
  163. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_END, (const char *)packet, MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  164. #endif
  165. #endif
  166. }
  167. #endif
  168. #endif
  169. // MESSAGE LOG_REQUEST_END UNPACKING
  170. /**
  171. * @brief Get field target_system from log_request_end message
  172. *
  173. * @return System ID
  174. */
  175. static inline uint8_t mavlink_msg_log_request_end_get_target_system(const mavlink_message_t* msg)
  176. {
  177. return _MAV_RETURN_uint8_t(msg, 0);
  178. }
  179. /**
  180. * @brief Get field target_component from log_request_end message
  181. *
  182. * @return Component ID
  183. */
  184. static inline uint8_t mavlink_msg_log_request_end_get_target_component(const mavlink_message_t* msg)
  185. {
  186. return _MAV_RETURN_uint8_t(msg, 1);
  187. }
  188. /**
  189. * @brief Decode a log_request_end message into a struct
  190. *
  191. * @param msg The message to decode
  192. * @param log_request_end C-struct to decode the message contents into
  193. */
  194. static inline void mavlink_msg_log_request_end_decode(const mavlink_message_t* msg, mavlink_log_request_end_t* log_request_end)
  195. {
  196. #if MAVLINK_NEED_BYTE_SWAP
  197. log_request_end->target_system = mavlink_msg_log_request_end_get_target_system(msg);
  198. log_request_end->target_component = mavlink_msg_log_request_end_get_target_component(msg);
  199. #else
  200. memcpy(log_request_end, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LOG_REQUEST_END_LEN);
  201. #endif
  202. }