1
0

mavlink_msg_log_request_list.h 12 KB

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