vkweigher.Version_req.h 2.2 KB

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