uavcan.protocol.file.BeginFirmwareUpdate_req.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <canard.h>
  5. #include <uavcan.protocol.file.Path.h>
  6. #define UAVCAN_PROTOCOL_FILE_BEGINFIRMWAREUPDATE_REQUEST_MAX_SIZE 202
  7. #define UAVCAN_PROTOCOL_FILE_BEGINFIRMWAREUPDATE_REQUEST_SIGNATURE (0xB7D725DF72724126ULL)
  8. #define UAVCAN_PROTOCOL_FILE_BEGINFIRMWAREUPDATE_REQUEST_ID 40
  9. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  10. class uavcan_protocol_file_BeginFirmwareUpdate_cxx_iface;
  11. #endif
  12. struct uavcan_protocol_file_BeginFirmwareUpdateRequest {
  13. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  14. using cxx_iface = uavcan_protocol_file_BeginFirmwareUpdate_cxx_iface;
  15. #endif
  16. uint8_t source_node_id;
  17. struct uavcan_protocol_file_Path image_file_remote_path;
  18. };
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. uint32_t _uavcan_protocol_file_BeginFirmwareUpdateRequest_encode(struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, uint8_t* buffer
  24. #if CANARD_ENABLE_TAO_OPTION
  25. , bool tao
  26. #endif
  27. );
  28. bool _uavcan_protocol_file_BeginFirmwareUpdateRequest_decode(const CanardRxTransfer* transfer, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg);
  29. static inline uint32_t uavcan_protocol_file_BeginFirmwareUpdateRequest_encode(struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, uint8_t* buffer
  30. #if CANARD_ENABLE_TAO_OPTION
  31. , bool tao
  32. #endif
  33. ) {
  34. return _uavcan_protocol_file_BeginFirmwareUpdateRequest_encode(msg, buffer
  35. #if CANARD_ENABLE_TAO_OPTION
  36. , tao
  37. #endif
  38. );
  39. }
  40. static inline bool uavcan_protocol_file_BeginFirmwareUpdateRequest_decode(const CanardRxTransfer* transfer, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg) {
  41. return _uavcan_protocol_file_BeginFirmwareUpdateRequest_decode(transfer, msg);
  42. }
  43. #if defined(CANARD_DSDLC_INTERNAL)
  44. static inline void __uavcan_protocol_file_BeginFirmwareUpdateRequest_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, bool tao);
  45. static inline bool __uavcan_protocol_file_BeginFirmwareUpdateRequest_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, bool tao);
  46. void __uavcan_protocol_file_BeginFirmwareUpdateRequest_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, bool tao) {
  47. (void)buffer;
  48. (void)bit_ofs;
  49. (void)msg;
  50. (void)tao;
  51. canardEncodeScalar(buffer, *bit_ofs, 8, &msg->source_node_id);
  52. *bit_ofs += 8;
  53. __uavcan_protocol_file_Path_encode(buffer, bit_ofs, &msg->image_file_remote_path, tao);
  54. }
  55. /*
  56. decode uavcan_protocol_file_BeginFirmwareUpdateRequest, return true on failure, false on success
  57. */
  58. bool __uavcan_protocol_file_BeginFirmwareUpdateRequest_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_protocol_file_BeginFirmwareUpdateRequest* msg, bool tao) {
  59. (void)transfer;
  60. (void)bit_ofs;
  61. (void)msg;
  62. (void)tao;
  63. canardDecodeScalar(transfer, *bit_ofs, 8, false, &msg->source_node_id);
  64. *bit_ofs += 8;
  65. if (__uavcan_protocol_file_Path_decode(transfer, bit_ofs, &msg->image_file_remote_path, tao)) {return true;}
  66. return false; /* success */
  67. }
  68. #endif
  69. #ifdef CANARD_DSDLC_TEST_BUILD
  70. struct uavcan_protocol_file_BeginFirmwareUpdateRequest sample_uavcan_protocol_file_BeginFirmwareUpdateRequest_msg(void);
  71. #endif
  72. #ifdef __cplusplus
  73. } // extern "C"
  74. #ifdef DRONECAN_CXX_WRAPPERS
  75. #include <canard/cxx_wrappers.h>
  76. #endif
  77. #endif