mavlink_msg_vk_bms_info.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. #pragma once
  2. // MESSAGE VK_BMS_INFO PACKING
  3. #define MAVLINK_MSG_ID_VK_BMS_INFO 53004
  4. typedef struct __mavlink_vk_bms_info_t {
  5. uint32_t time_boot_ms; /*< [ms] Timestamp in ms from system boot.*/
  6. uint16_t cyc_cnt; /*< BMS change and discharge
  7. cycle times*/
  8. uint8_t man_name[20]; /*< BMS manufactor string*/
  9. uint8_t model_name[20]; /*< BMS equpment model name string*/
  10. uint8_t sn_id[20]; /*< BMS SN id string*/
  11. uint8_t hw_ver[10]; /*< BMS hardware version string*/
  12. uint8_t fw_ver[10]; /*< BMS firmware version string*/
  13. } mavlink_vk_bms_info_t;
  14. #define MAVLINK_MSG_ID_VK_BMS_INFO_LEN 86
  15. #define MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN 86
  16. #define MAVLINK_MSG_ID_53004_LEN 86
  17. #define MAVLINK_MSG_ID_53004_MIN_LEN 86
  18. #define MAVLINK_MSG_ID_VK_BMS_INFO_CRC 3
  19. #define MAVLINK_MSG_ID_53004_CRC 3
  20. #define MAVLINK_MSG_VK_BMS_INFO_FIELD_MAN_NAME_LEN 20
  21. #define MAVLINK_MSG_VK_BMS_INFO_FIELD_MODEL_NAME_LEN 20
  22. #define MAVLINK_MSG_VK_BMS_INFO_FIELD_SN_ID_LEN 20
  23. #define MAVLINK_MSG_VK_BMS_INFO_FIELD_HW_VER_LEN 10
  24. #define MAVLINK_MSG_VK_BMS_INFO_FIELD_FW_VER_LEN 10
  25. #if MAVLINK_COMMAND_24BIT
  26. #define MAVLINK_MESSAGE_INFO_VK_BMS_INFO { \
  27. 53004, \
  28. "VK_BMS_INFO", \
  29. 7, \
  30. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_info_t, time_boot_ms) }, \
  31. { "man_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_vk_bms_info_t, man_name) }, \
  32. { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 26, offsetof(mavlink_vk_bms_info_t, model_name) }, \
  33. { "sn_id", NULL, MAVLINK_TYPE_UINT8_T, 20, 46, offsetof(mavlink_vk_bms_info_t, sn_id) }, \
  34. { "hw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 66, offsetof(mavlink_vk_bms_info_t, hw_ver) }, \
  35. { "fw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 76, offsetof(mavlink_vk_bms_info_t, fw_ver) }, \
  36. { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_vk_bms_info_t, cyc_cnt) }, \
  37. } \
  38. }
  39. #else
  40. #define MAVLINK_MESSAGE_INFO_VK_BMS_INFO { \
  41. "VK_BMS_INFO", \
  42. 7, \
  43. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_vk_bms_info_t, time_boot_ms) }, \
  44. { "man_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_vk_bms_info_t, man_name) }, \
  45. { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 20, 26, offsetof(mavlink_vk_bms_info_t, model_name) }, \
  46. { "sn_id", NULL, MAVLINK_TYPE_UINT8_T, 20, 46, offsetof(mavlink_vk_bms_info_t, sn_id) }, \
  47. { "hw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 66, offsetof(mavlink_vk_bms_info_t, hw_ver) }, \
  48. { "fw_ver", NULL, MAVLINK_TYPE_UINT8_T, 10, 76, offsetof(mavlink_vk_bms_info_t, fw_ver) }, \
  49. { "cyc_cnt", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_vk_bms_info_t, cyc_cnt) }, \
  50. } \
  51. }
  52. #endif
  53. /**
  54. * @brief Pack a vk_bms_info message
  55. * @param system_id ID of this system
  56. * @param component_id ID of this component (e.g. 200 for IMU)
  57. * @param msg The MAVLink message to compress the data into
  58. *
  59. * @param time_boot_ms [ms] Timestamp in ms from system boot.
  60. * @param man_name BMS manufactor string
  61. * @param model_name BMS equpment model name string
  62. * @param sn_id BMS SN id string
  63. * @param hw_ver BMS hardware version string
  64. * @param fw_ver BMS firmware version string
  65. * @param cyc_cnt BMS change and discharge
  66. cycle times
  67. * @return length of the message in bytes (excluding serial stream start sign)
  68. */
  69. static inline uint16_t mavlink_msg_vk_bms_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  70. uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver, uint16_t cyc_cnt)
  71. {
  72. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  73. char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
  74. _mav_put_uint32_t(buf, 0, time_boot_ms);
  75. _mav_put_uint16_t(buf, 4, cyc_cnt);
  76. _mav_put_uint8_t_array(buf, 6, man_name, 20);
  77. _mav_put_uint8_t_array(buf, 26, model_name, 20);
  78. _mav_put_uint8_t_array(buf, 46, sn_id, 20);
  79. _mav_put_uint8_t_array(buf, 66, hw_ver, 10);
  80. _mav_put_uint8_t_array(buf, 76, fw_ver, 10);
  81. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  82. #else
  83. mavlink_vk_bms_info_t packet;
  84. packet.time_boot_ms = time_boot_ms;
  85. packet.cyc_cnt = cyc_cnt;
  86. mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
  87. mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
  88. mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
  89. mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
  90. mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
  91. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  92. #endif
  93. msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
  94. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  95. }
  96. /**
  97. * @brief Pack a vk_bms_info message
  98. * @param system_id ID of this system
  99. * @param component_id ID of this component (e.g. 200 for IMU)
  100. * @param status MAVLink status structure
  101. * @param msg The MAVLink message to compress the data into
  102. *
  103. * @param time_boot_ms [ms] Timestamp in ms from system boot.
  104. * @param man_name BMS manufactor string
  105. * @param model_name BMS equpment model name string
  106. * @param sn_id BMS SN id string
  107. * @param hw_ver BMS hardware version string
  108. * @param fw_ver BMS firmware version string
  109. * @param cyc_cnt BMS change and discharge
  110. cycle times
  111. * @return length of the message in bytes (excluding serial stream start sign)
  112. */
  113. static inline uint16_t mavlink_msg_vk_bms_info_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  114. uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver, uint16_t cyc_cnt)
  115. {
  116. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  117. char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
  118. _mav_put_uint32_t(buf, 0, time_boot_ms);
  119. _mav_put_uint16_t(buf, 4, cyc_cnt);
  120. _mav_put_uint8_t_array(buf, 6, man_name, 20);
  121. _mav_put_uint8_t_array(buf, 26, model_name, 20);
  122. _mav_put_uint8_t_array(buf, 46, sn_id, 20);
  123. _mav_put_uint8_t_array(buf, 66, hw_ver, 10);
  124. _mav_put_uint8_t_array(buf, 76, fw_ver, 10);
  125. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  126. #else
  127. mavlink_vk_bms_info_t packet;
  128. packet.time_boot_ms = time_boot_ms;
  129. packet.cyc_cnt = cyc_cnt;
  130. mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
  131. mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
  132. mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
  133. mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
  134. mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
  135. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  136. #endif
  137. msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
  138. #if MAVLINK_CRC_EXTRA
  139. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  140. #else
  141. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  142. #endif
  143. }
  144. /**
  145. * @brief Pack a vk_bms_info message on a channel
  146. * @param system_id ID of this system
  147. * @param component_id ID of this component (e.g. 200 for IMU)
  148. * @param chan The MAVLink channel this message will be sent over
  149. * @param msg The MAVLink message to compress the data into
  150. * @param time_boot_ms [ms] Timestamp in ms from system boot.
  151. * @param man_name BMS manufactor string
  152. * @param model_name BMS equpment model name string
  153. * @param sn_id BMS SN id string
  154. * @param hw_ver BMS hardware version string
  155. * @param fw_ver BMS firmware version string
  156. * @param cyc_cnt BMS change and discharge
  157. cycle times
  158. * @return length of the message in bytes (excluding serial stream start sign)
  159. */
  160. static inline uint16_t mavlink_msg_vk_bms_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  161. mavlink_message_t* msg,
  162. uint32_t time_boot_ms,const uint8_t *man_name,const uint8_t *model_name,const uint8_t *sn_id,const uint8_t *hw_ver,const uint8_t *fw_ver,uint16_t cyc_cnt)
  163. {
  164. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  165. char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
  166. _mav_put_uint32_t(buf, 0, time_boot_ms);
  167. _mav_put_uint16_t(buf, 4, cyc_cnt);
  168. _mav_put_uint8_t_array(buf, 6, man_name, 20);
  169. _mav_put_uint8_t_array(buf, 26, model_name, 20);
  170. _mav_put_uint8_t_array(buf, 46, sn_id, 20);
  171. _mav_put_uint8_t_array(buf, 66, hw_ver, 10);
  172. _mav_put_uint8_t_array(buf, 76, fw_ver, 10);
  173. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  174. #else
  175. mavlink_vk_bms_info_t packet;
  176. packet.time_boot_ms = time_boot_ms;
  177. packet.cyc_cnt = cyc_cnt;
  178. mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
  179. mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
  180. mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
  181. mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
  182. mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
  183. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  184. #endif
  185. msg->msgid = MAVLINK_MSG_ID_VK_BMS_INFO;
  186. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  187. }
  188. /**
  189. * @brief Encode a vk_bms_info struct
  190. *
  191. * @param system_id ID of this system
  192. * @param component_id ID of this component (e.g. 200 for IMU)
  193. * @param msg The MAVLink message to compress the data into
  194. * @param vk_bms_info C-struct to read the message contents from
  195. */
  196. static inline uint16_t mavlink_msg_vk_bms_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
  197. {
  198. return mavlink_msg_vk_bms_info_pack(system_id, component_id, msg, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver, vk_bms_info->cyc_cnt);
  199. }
  200. /**
  201. * @brief Encode a vk_bms_info struct on a channel
  202. *
  203. * @param system_id ID of this system
  204. * @param component_id ID of this component (e.g. 200 for IMU)
  205. * @param chan The MAVLink channel this message will be sent over
  206. * @param msg The MAVLink message to compress the data into
  207. * @param vk_bms_info C-struct to read the message contents from
  208. */
  209. static inline uint16_t mavlink_msg_vk_bms_info_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
  210. {
  211. return mavlink_msg_vk_bms_info_pack_chan(system_id, component_id, chan, msg, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver, vk_bms_info->cyc_cnt);
  212. }
  213. /**
  214. * @brief Encode a vk_bms_info struct with provided status structure
  215. *
  216. * @param system_id ID of this system
  217. * @param component_id ID of this component (e.g. 200 for IMU)
  218. * @param status MAVLink status structure
  219. * @param msg The MAVLink message to compress the data into
  220. * @param vk_bms_info C-struct to read the message contents from
  221. */
  222. static inline uint16_t mavlink_msg_vk_bms_info_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_vk_bms_info_t* vk_bms_info)
  223. {
  224. return mavlink_msg_vk_bms_info_pack_status(system_id, component_id, _status, msg, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver, vk_bms_info->cyc_cnt);
  225. }
  226. /**
  227. * @brief Send a vk_bms_info message
  228. * @param chan MAVLink channel to send the message
  229. *
  230. * @param time_boot_ms [ms] Timestamp in ms from system boot.
  231. * @param man_name BMS manufactor string
  232. * @param model_name BMS equpment model name string
  233. * @param sn_id BMS SN id string
  234. * @param hw_ver BMS hardware version string
  235. * @param fw_ver BMS firmware version string
  236. * @param cyc_cnt BMS change and discharge
  237. cycle times
  238. */
  239. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  240. static inline void mavlink_msg_vk_bms_info_send(mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver, uint16_t cyc_cnt)
  241. {
  242. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  243. char buf[MAVLINK_MSG_ID_VK_BMS_INFO_LEN];
  244. _mav_put_uint32_t(buf, 0, time_boot_ms);
  245. _mav_put_uint16_t(buf, 4, cyc_cnt);
  246. _mav_put_uint8_t_array(buf, 6, man_name, 20);
  247. _mav_put_uint8_t_array(buf, 26, model_name, 20);
  248. _mav_put_uint8_t_array(buf, 46, sn_id, 20);
  249. _mav_put_uint8_t_array(buf, 66, hw_ver, 10);
  250. _mav_put_uint8_t_array(buf, 76, fw_ver, 10);
  251. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, buf, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  252. #else
  253. mavlink_vk_bms_info_t packet;
  254. packet.time_boot_ms = time_boot_ms;
  255. packet.cyc_cnt = cyc_cnt;
  256. mav_array_memcpy(packet.man_name, man_name, sizeof(uint8_t)*20);
  257. mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*20);
  258. mav_array_memcpy(packet.sn_id, sn_id, sizeof(uint8_t)*20);
  259. mav_array_memcpy(packet.hw_ver, hw_ver, sizeof(uint8_t)*10);
  260. mav_array_memcpy(packet.fw_ver, fw_ver, sizeof(uint8_t)*10);
  261. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)&packet, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  262. #endif
  263. }
  264. /**
  265. * @brief Send a vk_bms_info message
  266. * @param chan MAVLink channel to send the message
  267. * @param struct The MAVLink struct to serialize
  268. */
  269. static inline void mavlink_msg_vk_bms_info_send_struct(mavlink_channel_t chan, const mavlink_vk_bms_info_t* vk_bms_info)
  270. {
  271. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  272. mavlink_msg_vk_bms_info_send(chan, vk_bms_info->time_boot_ms, vk_bms_info->man_name, vk_bms_info->model_name, vk_bms_info->sn_id, vk_bms_info->hw_ver, vk_bms_info->fw_ver, vk_bms_info->cyc_cnt);
  273. #else
  274. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)vk_bms_info, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  275. #endif
  276. }
  277. #if MAVLINK_MSG_ID_VK_BMS_INFO_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  278. /*
  279. This variant of _send() can be used to save stack space by re-using
  280. memory from the receive buffer. The caller provides a
  281. mavlink_message_t which is the size of a full mavlink message. This
  282. is usually the receive buffer for the channel, and allows a reply to an
  283. incoming message with minimum stack space usage.
  284. */
  285. static inline void mavlink_msg_vk_bms_info_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *man_name, const uint8_t *model_name, const uint8_t *sn_id, const uint8_t *hw_ver, const uint8_t *fw_ver, uint16_t cyc_cnt)
  286. {
  287. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  288. char *buf = (char *)msgbuf;
  289. _mav_put_uint32_t(buf, 0, time_boot_ms);
  290. _mav_put_uint16_t(buf, 4, cyc_cnt);
  291. _mav_put_uint8_t_array(buf, 6, man_name, 20);
  292. _mav_put_uint8_t_array(buf, 26, model_name, 20);
  293. _mav_put_uint8_t_array(buf, 46, sn_id, 20);
  294. _mav_put_uint8_t_array(buf, 66, hw_ver, 10);
  295. _mav_put_uint8_t_array(buf, 76, fw_ver, 10);
  296. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, buf, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  297. #else
  298. mavlink_vk_bms_info_t *packet = (mavlink_vk_bms_info_t *)msgbuf;
  299. packet->time_boot_ms = time_boot_ms;
  300. packet->cyc_cnt = cyc_cnt;
  301. mav_array_memcpy(packet->man_name, man_name, sizeof(uint8_t)*20);
  302. mav_array_memcpy(packet->model_name, model_name, sizeof(uint8_t)*20);
  303. mav_array_memcpy(packet->sn_id, sn_id, sizeof(uint8_t)*20);
  304. mav_array_memcpy(packet->hw_ver, hw_ver, sizeof(uint8_t)*10);
  305. mav_array_memcpy(packet->fw_ver, fw_ver, sizeof(uint8_t)*10);
  306. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VK_BMS_INFO, (const char *)packet, MAVLINK_MSG_ID_VK_BMS_INFO_MIN_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_LEN, MAVLINK_MSG_ID_VK_BMS_INFO_CRC);
  307. #endif
  308. }
  309. #endif
  310. #endif
  311. // MESSAGE VK_BMS_INFO UNPACKING
  312. /**
  313. * @brief Get field time_boot_ms from vk_bms_info message
  314. *
  315. * @return [ms] Timestamp in ms from system boot.
  316. */
  317. static inline uint32_t mavlink_msg_vk_bms_info_get_time_boot_ms(const mavlink_message_t* msg)
  318. {
  319. return _MAV_RETURN_uint32_t(msg, 0);
  320. }
  321. /**
  322. * @brief Get field man_name from vk_bms_info message
  323. *
  324. * @return BMS manufactor string
  325. */
  326. static inline uint16_t mavlink_msg_vk_bms_info_get_man_name(const mavlink_message_t* msg, uint8_t *man_name)
  327. {
  328. return _MAV_RETURN_uint8_t_array(msg, man_name, 20, 6);
  329. }
  330. /**
  331. * @brief Get field model_name from vk_bms_info message
  332. *
  333. * @return BMS equpment model name string
  334. */
  335. static inline uint16_t mavlink_msg_vk_bms_info_get_model_name(const mavlink_message_t* msg, uint8_t *model_name)
  336. {
  337. return _MAV_RETURN_uint8_t_array(msg, model_name, 20, 26);
  338. }
  339. /**
  340. * @brief Get field sn_id from vk_bms_info message
  341. *
  342. * @return BMS SN id string
  343. */
  344. static inline uint16_t mavlink_msg_vk_bms_info_get_sn_id(const mavlink_message_t* msg, uint8_t *sn_id)
  345. {
  346. return _MAV_RETURN_uint8_t_array(msg, sn_id, 20, 46);
  347. }
  348. /**
  349. * @brief Get field hw_ver from vk_bms_info message
  350. *
  351. * @return BMS hardware version string
  352. */
  353. static inline uint16_t mavlink_msg_vk_bms_info_get_hw_ver(const mavlink_message_t* msg, uint8_t *hw_ver)
  354. {
  355. return _MAV_RETURN_uint8_t_array(msg, hw_ver, 10, 66);
  356. }
  357. /**
  358. * @brief Get field fw_ver from vk_bms_info message
  359. *
  360. * @return BMS firmware version string
  361. */
  362. static inline uint16_t mavlink_msg_vk_bms_info_get_fw_ver(const mavlink_message_t* msg, uint8_t *fw_ver)
  363. {
  364. return _MAV_RETURN_uint8_t_array(msg, fw_ver, 10, 76);
  365. }
  366. /**
  367. * @brief Get field cyc_cnt from vk_bms_info message
  368. *
  369. * @return BMS change and discharge
  370. cycle times
  371. */
  372. static inline uint16_t mavlink_msg_vk_bms_info_get_cyc_cnt(const mavlink_message_t* msg)
  373. {
  374. return _MAV_RETURN_uint16_t(msg, 4);
  375. }
  376. /**
  377. * @brief Decode a vk_bms_info message into a struct
  378. *
  379. * @param msg The message to decode
  380. * @param vk_bms_info C-struct to decode the message contents into
  381. */
  382. static inline void mavlink_msg_vk_bms_info_decode(const mavlink_message_t* msg, mavlink_vk_bms_info_t* vk_bms_info)
  383. {
  384. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  385. vk_bms_info->time_boot_ms = mavlink_msg_vk_bms_info_get_time_boot_ms(msg);
  386. vk_bms_info->cyc_cnt = mavlink_msg_vk_bms_info_get_cyc_cnt(msg);
  387. mavlink_msg_vk_bms_info_get_man_name(msg, vk_bms_info->man_name);
  388. mavlink_msg_vk_bms_info_get_model_name(msg, vk_bms_info->model_name);
  389. mavlink_msg_vk_bms_info_get_sn_id(msg, vk_bms_info->sn_id);
  390. mavlink_msg_vk_bms_info_get_hw_ver(msg, vk_bms_info->hw_ver);
  391. mavlink_msg_vk_bms_info_get_fw_ver(msg, vk_bms_info->fw_ver);
  392. #else
  393. uint8_t len = msg->len < MAVLINK_MSG_ID_VK_BMS_INFO_LEN? msg->len : MAVLINK_MSG_ID_VK_BMS_INFO_LEN;
  394. memset(vk_bms_info, 0, MAVLINK_MSG_ID_VK_BMS_INFO_LEN);
  395. memcpy(vk_bms_info, _MAV_PAYLOAD(msg), len);
  396. #endif
  397. }