mavlink_msg_vk_fw_update_data.h 13 KB

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