vkweigher.Version_res.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <canard.h>
  5. #define VKWEIGHER_VERSION_RESPONSE_MAX_SIZE 20
  6. #define VKWEIGHER_VERSION_RESPONSE_SIGNATURE (0xE51B5A9BD0C35CCCULL)
  7. #define VKWEIGHER_VERSION_RESPONSE_ID 233
  8. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  9. class vkweigher_Version_cxx_iface;
  10. #endif
  11. struct vkweigher_VersionResponse {
  12. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  13. using cxx_iface = vkweigher_Version_cxx_iface;
  14. #endif
  15. int8_t fw_ver[16];
  16. uint32_t SN_num;
  17. };
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22. uint32_t vkweigher_VersionResponse_encode(struct vkweigher_VersionResponse* msg, uint8_t* buffer
  23. #if CANARD_ENABLE_TAO_OPTION
  24. , bool tao
  25. #endif
  26. );
  27. bool vkweigher_VersionResponse_decode(const CanardRxTransfer* transfer, struct vkweigher_VersionResponse* msg);
  28. #if defined(CANARD_DSDLC_INTERNAL)
  29. static inline void _vkweigher_VersionResponse_encode(uint8_t* buffer, uint32_t* bit_ofs, struct vkweigher_VersionResponse* msg, bool tao);
  30. static inline bool _vkweigher_VersionResponse_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct vkweigher_VersionResponse* msg, bool tao);
  31. void _vkweigher_VersionResponse_encode(uint8_t* buffer, uint32_t* bit_ofs, struct vkweigher_VersionResponse* msg, bool tao) {
  32. (void)buffer;
  33. (void)bit_ofs;
  34. (void)msg;
  35. (void)tao;
  36. for (size_t i=0; i < 16; i++) {
  37. canardEncodeScalar(buffer, *bit_ofs, 8, &msg->fw_ver[i]);
  38. *bit_ofs += 8;
  39. }
  40. canardEncodeScalar(buffer, *bit_ofs, 32, &msg->SN_num);
  41. *bit_ofs += 32;
  42. }
  43. /*
  44. decode vkweigher_VersionResponse, return true on failure, false on success
  45. */
  46. bool _vkweigher_VersionResponse_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct vkweigher_VersionResponse* msg, bool tao) {
  47. (void)transfer;
  48. (void)bit_ofs;
  49. (void)msg;
  50. (void)tao;
  51. for (size_t i=0; i < 16; i++) {
  52. canardDecodeScalar(transfer, *bit_ofs, 8, true, &msg->fw_ver[i]);
  53. *bit_ofs += 8;
  54. }
  55. canardDecodeScalar(transfer, *bit_ofs, 32, false, &msg->SN_num);
  56. *bit_ofs += 32;
  57. return false; /* success */
  58. }
  59. #endif
  60. #ifdef CANARD_DSDLC_TEST_BUILD
  61. struct vkweigher_VersionResponse sample_vkweigher_VersionResponse_msg(void);
  62. #endif
  63. #ifdef __cplusplus
  64. } // extern "C"
  65. #ifdef DRONECAN_CXX_WRAPPERS
  66. #include <canard/cxx_wrappers.h>
  67. #endif
  68. #endif