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

https://gitlab.com/fsgdez/apm_planner · C Header · 305 lines · 178 code · 34 blank · 93 comment · 4 complexity · 7de8c5672ff99757e1723c8026f8cb0a MD5 · raw file

  1. // MESSAGE LOG_REQUEST_DATA PACKING
  2. #define MAVLINK_MSG_ID_LOG_REQUEST_DATA 119
  3. typedef struct __mavlink_log_request_data_t
  4. {
  5. uint32_t ofs; ///< Offset into the log
  6. uint32_t count; ///< Number of bytes
  7. uint16_t id; ///< Log id (from LOG_ENTRY reply)
  8. uint8_t target_system; ///< System ID
  9. uint8_t target_component; ///< Component ID
  10. } mavlink_log_request_data_t;
  11. #define MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN 12
  12. #define MAVLINK_MSG_ID_119_LEN 12
  13. #define MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC 116
  14. #define MAVLINK_MSG_ID_119_CRC 116
  15. #define MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA { \
  16. "LOG_REQUEST_DATA", \
  17. 5, \
  18. { { "ofs", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_log_request_data_t, ofs) }, \
  19. { "count", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_log_request_data_t, count) }, \
  20. { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_log_request_data_t, id) }, \
  21. { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_log_request_data_t, target_system) }, \
  22. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_log_request_data_t, target_component) }, \
  23. } \
  24. }
  25. /**
  26. * @brief Pack a log_request_data message
  27. * @param system_id ID of this system
  28. * @param component_id ID of this component (e.g. 200 for IMU)
  29. * @param msg The MAVLink message to compress the data into
  30. *
  31. * @param target_system System ID
  32. * @param target_component Component ID
  33. * @param id Log id (from LOG_ENTRY reply)
  34. * @param ofs Offset into the log
  35. * @param count Number of bytes
  36. * @return length of the message in bytes (excluding serial stream start sign)
  37. */
  38. static inline uint16_t mavlink_msg_log_request_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  39. uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
  40. {
  41. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  42. char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
  43. _mav_put_uint32_t(buf, 0, ofs);
  44. _mav_put_uint32_t(buf, 4, count);
  45. _mav_put_uint16_t(buf, 8, id);
  46. _mav_put_uint8_t(buf, 10, target_system);
  47. _mav_put_uint8_t(buf, 11, target_component);
  48. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  49. #else
  50. mavlink_log_request_data_t packet;
  51. packet.ofs = ofs;
  52. packet.count = count;
  53. packet.id = id;
  54. packet.target_system = target_system;
  55. packet.target_component = target_component;
  56. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  57. #endif
  58. msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA;
  59. #if MAVLINK_CRC_EXTRA
  60. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  61. #else
  62. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  63. #endif
  64. }
  65. /**
  66. * @brief Pack a log_request_data message on a channel
  67. * @param system_id ID of this system
  68. * @param component_id ID of this component (e.g. 200 for IMU)
  69. * @param chan The MAVLink channel this message will be sent over
  70. * @param msg The MAVLink message to compress the data into
  71. * @param target_system System ID
  72. * @param target_component Component ID
  73. * @param id Log id (from LOG_ENTRY reply)
  74. * @param ofs Offset into the log
  75. * @param count Number of bytes
  76. * @return length of the message in bytes (excluding serial stream start sign)
  77. */
  78. static inline uint16_t mavlink_msg_log_request_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  79. mavlink_message_t* msg,
  80. uint8_t target_system,uint8_t target_component,uint16_t id,uint32_t ofs,uint32_t count)
  81. {
  82. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  83. char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
  84. _mav_put_uint32_t(buf, 0, ofs);
  85. _mav_put_uint32_t(buf, 4, count);
  86. _mav_put_uint16_t(buf, 8, id);
  87. _mav_put_uint8_t(buf, 10, target_system);
  88. _mav_put_uint8_t(buf, 11, target_component);
  89. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  90. #else
  91. mavlink_log_request_data_t packet;
  92. packet.ofs = ofs;
  93. packet.count = count;
  94. packet.id = id;
  95. packet.target_system = target_system;
  96. packet.target_component = target_component;
  97. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  98. #endif
  99. msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA;
  100. #if MAVLINK_CRC_EXTRA
  101. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  102. #else
  103. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  104. #endif
  105. }
  106. /**
  107. * @brief Encode a log_request_data struct
  108. *
  109. * @param system_id ID of this system
  110. * @param component_id ID of this component (e.g. 200 for IMU)
  111. * @param msg The MAVLink message to compress the data into
  112. * @param log_request_data C-struct to read the message contents from
  113. */
  114. static inline uint16_t mavlink_msg_log_request_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_log_request_data_t* log_request_data)
  115. {
  116. return mavlink_msg_log_request_data_pack(system_id, component_id, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count);
  117. }
  118. /**
  119. * @brief Encode a log_request_data struct on a channel
  120. *
  121. * @param system_id ID of this system
  122. * @param component_id ID of this component (e.g. 200 for IMU)
  123. * @param chan The MAVLink channel this message will be sent over
  124. * @param msg The MAVLink message to compress the data into
  125. * @param log_request_data C-struct to read the message contents from
  126. */
  127. static inline uint16_t mavlink_msg_log_request_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_log_request_data_t* log_request_data)
  128. {
  129. return mavlink_msg_log_request_data_pack_chan(system_id, component_id, chan, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count);
  130. }
  131. /**
  132. * @brief Send a log_request_data message
  133. * @param chan MAVLink channel to send the message
  134. *
  135. * @param target_system System ID
  136. * @param target_component Component ID
  137. * @param id Log id (from LOG_ENTRY reply)
  138. * @param ofs Offset into the log
  139. * @param count Number of bytes
  140. */
  141. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  142. static inline void mavlink_msg_log_request_data_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
  143. {
  144. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  145. char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
  146. _mav_put_uint32_t(buf, 0, ofs);
  147. _mav_put_uint32_t(buf, 4, count);
  148. _mav_put_uint16_t(buf, 8, id);
  149. _mav_put_uint8_t(buf, 10, target_system);
  150. _mav_put_uint8_t(buf, 11, target_component);
  151. #if MAVLINK_CRC_EXTRA
  152. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  153. #else
  154. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  155. #endif
  156. #else
  157. mavlink_log_request_data_t packet;
  158. packet.ofs = ofs;
  159. packet.count = count;
  160. packet.id = id;
  161. packet.target_system = target_system;
  162. packet.target_component = target_component;
  163. #if MAVLINK_CRC_EXTRA
  164. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)&packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  165. #else
  166. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)&packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  167. #endif
  168. #endif
  169. }
  170. #if MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  171. /*
  172. This varient of _send() can be used to save stack space by re-using
  173. memory from the receive buffer. The caller provides a
  174. mavlink_message_t which is the size of a full mavlink message. This
  175. is usually the receive buffer for the channel, and allows a reply to an
  176. incoming message with minimum stack space usage.
  177. */
  178. static inline void mavlink_msg_log_request_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
  179. {
  180. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  181. char *buf = (char *)msgbuf;
  182. _mav_put_uint32_t(buf, 0, ofs);
  183. _mav_put_uint32_t(buf, 4, count);
  184. _mav_put_uint16_t(buf, 8, id);
  185. _mav_put_uint8_t(buf, 10, target_system);
  186. _mav_put_uint8_t(buf, 11, target_component);
  187. #if MAVLINK_CRC_EXTRA
  188. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  189. #else
  190. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  191. #endif
  192. #else
  193. mavlink_log_request_data_t *packet = (mavlink_log_request_data_t *)msgbuf;
  194. packet->ofs = ofs;
  195. packet->count = count;
  196. packet->id = id;
  197. packet->target_system = target_system;
  198. packet->target_component = target_component;
  199. #if MAVLINK_CRC_EXTRA
  200. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
  201. #else
  202. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  203. #endif
  204. #endif
  205. }
  206. #endif
  207. #endif
  208. // MESSAGE LOG_REQUEST_DATA UNPACKING
  209. /**
  210. * @brief Get field target_system from log_request_data message
  211. *
  212. * @return System ID
  213. */
  214. static inline uint8_t mavlink_msg_log_request_data_get_target_system(const mavlink_message_t* msg)
  215. {
  216. return _MAV_RETURN_uint8_t(msg, 10);
  217. }
  218. /**
  219. * @brief Get field target_component from log_request_data message
  220. *
  221. * @return Component ID
  222. */
  223. static inline uint8_t mavlink_msg_log_request_data_get_target_component(const mavlink_message_t* msg)
  224. {
  225. return _MAV_RETURN_uint8_t(msg, 11);
  226. }
  227. /**
  228. * @brief Get field id from log_request_data message
  229. *
  230. * @return Log id (from LOG_ENTRY reply)
  231. */
  232. static inline uint16_t mavlink_msg_log_request_data_get_id(const mavlink_message_t* msg)
  233. {
  234. return _MAV_RETURN_uint16_t(msg, 8);
  235. }
  236. /**
  237. * @brief Get field ofs from log_request_data message
  238. *
  239. * @return Offset into the log
  240. */
  241. static inline uint32_t mavlink_msg_log_request_data_get_ofs(const mavlink_message_t* msg)
  242. {
  243. return _MAV_RETURN_uint32_t(msg, 0);
  244. }
  245. /**
  246. * @brief Get field count from log_request_data message
  247. *
  248. * @return Number of bytes
  249. */
  250. static inline uint32_t mavlink_msg_log_request_data_get_count(const mavlink_message_t* msg)
  251. {
  252. return _MAV_RETURN_uint32_t(msg, 4);
  253. }
  254. /**
  255. * @brief Decode a log_request_data message into a struct
  256. *
  257. * @param msg The message to decode
  258. * @param log_request_data C-struct to decode the message contents into
  259. */
  260. static inline void mavlink_msg_log_request_data_decode(const mavlink_message_t* msg, mavlink_log_request_data_t* log_request_data)
  261. {
  262. #if MAVLINK_NEED_BYTE_SWAP
  263. log_request_data->ofs = mavlink_msg_log_request_data_get_ofs(msg);
  264. log_request_data->count = mavlink_msg_log_request_data_get_count(msg);
  265. log_request_data->id = mavlink_msg_log_request_data_get_id(msg);
  266. log_request_data->target_system = mavlink_msg_log_request_data_get_target_system(msg);
  267. log_request_data->target_component = mavlink_msg_log_request_data_get_target_component(msg);
  268. #else
  269. memcpy(log_request_data, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
  270. #endif
  271. }