uavcan.equipment.hardpoint.Command.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <canard.h>
  5. #define UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_MAX_SIZE 3
  6. #define UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_SIGNATURE (0xA1A036268B0C3455ULL)
  7. #define UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_ID 1070
  8. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  9. class uavcan_equipment_hardpoint_Command_cxx_iface;
  10. #endif
  11. struct uavcan_equipment_hardpoint_Command {
  12. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  13. using cxx_iface = uavcan_equipment_hardpoint_Command_cxx_iface;
  14. #endif
  15. uint8_t hardpoint_id;
  16. uint16_t command;
  17. };
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22. uint32_t _uavcan_equipment_hardpoint_Command_encode(struct uavcan_equipment_hardpoint_Command* msg, uint8_t* buffer
  23. #if CANARD_ENABLE_TAO_OPTION
  24. , bool tao
  25. #endif
  26. );
  27. bool _uavcan_equipment_hardpoint_Command_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_hardpoint_Command* msg);
  28. static inline uint32_t uavcan_equipment_hardpoint_Command_encode(struct uavcan_equipment_hardpoint_Command* msg, uint8_t* buffer
  29. #if CANARD_ENABLE_TAO_OPTION
  30. , bool tao
  31. #endif
  32. ) {
  33. return _uavcan_equipment_hardpoint_Command_encode(msg, buffer
  34. #if CANARD_ENABLE_TAO_OPTION
  35. , tao
  36. #endif
  37. );
  38. }
  39. static inline bool uavcan_equipment_hardpoint_Command_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_hardpoint_Command* msg) {
  40. return _uavcan_equipment_hardpoint_Command_decode(transfer, msg);
  41. }
  42. #if defined(CANARD_DSDLC_INTERNAL)
  43. static inline void __uavcan_equipment_hardpoint_Command_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_hardpoint_Command* msg, bool tao);
  44. static inline bool __uavcan_equipment_hardpoint_Command_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_hardpoint_Command* msg, bool tao);
  45. void __uavcan_equipment_hardpoint_Command_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_hardpoint_Command* msg, bool tao) {
  46. (void)buffer;
  47. (void)bit_ofs;
  48. (void)msg;
  49. (void)tao;
  50. canardEncodeScalar(buffer, *bit_ofs, 8, &msg->hardpoint_id);
  51. *bit_ofs += 8;
  52. canardEncodeScalar(buffer, *bit_ofs, 16, &msg->command);
  53. *bit_ofs += 16;
  54. }
  55. /*
  56. decode uavcan_equipment_hardpoint_Command, return true on failure, false on success
  57. */
  58. bool __uavcan_equipment_hardpoint_Command_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_hardpoint_Command* msg, bool tao) {
  59. (void)transfer;
  60. (void)bit_ofs;
  61. (void)msg;
  62. (void)tao;
  63. canardDecodeScalar(transfer, *bit_ofs, 8, false, &msg->hardpoint_id);
  64. *bit_ofs += 8;
  65. canardDecodeScalar(transfer, *bit_ofs, 16, false, &msg->command);
  66. *bit_ofs += 16;
  67. return false; /* success */
  68. }
  69. #endif
  70. #ifdef CANARD_DSDLC_TEST_BUILD
  71. struct uavcan_equipment_hardpoint_Command sample_uavcan_equipment_hardpoint_Command_msg(void);
  72. #endif
  73. #ifdef __cplusplus
  74. } // extern "C"
  75. #ifdef DRONECAN_CXX_WRAPPERS
  76. #include <canard/cxx_wrappers.h>
  77. BROADCAST_MESSAGE_CXX_IFACE(uavcan_equipment_hardpoint_Command, UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_ID, UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_SIGNATURE, UAVCAN_EQUIPMENT_HARDPOINT_COMMAND_MAX_SIZE);
  78. #endif
  79. #endif