uavcan.equipment.camera_gimbal.GEOPOICommand.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <canard.h>
  5. #include <uavcan.equipment.camera_gimbal.Mode.h>
  6. #define UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_MAX_SIZE 13
  7. #define UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_SIGNATURE (0x9371428A92F01FD6ULL)
  8. #define UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_ID 1041
  9. #define UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_HEIGHT_REFERENCE_ELLIPSOID 0
  10. #define UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_HEIGHT_REFERENCE_MEAN_SEA_LEVEL 1
  11. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  12. class uavcan_equipment_camera_gimbal_GEOPOICommand_cxx_iface;
  13. #endif
  14. struct uavcan_equipment_camera_gimbal_GEOPOICommand {
  15. #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
  16. using cxx_iface = uavcan_equipment_camera_gimbal_GEOPOICommand_cxx_iface;
  17. #endif
  18. uint8_t gimbal_id;
  19. struct uavcan_equipment_camera_gimbal_Mode mode;
  20. int32_t longitude_deg_1e7;
  21. int32_t latitude_deg_1e7;
  22. int32_t height_cm;
  23. uint8_t height_reference;
  24. };
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. uint32_t _uavcan_equipment_camera_gimbal_GEOPOICommand_encode(struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, uint8_t* buffer
  30. #if CANARD_ENABLE_TAO_OPTION
  31. , bool tao
  32. #endif
  33. );
  34. bool _uavcan_equipment_camera_gimbal_GEOPOICommand_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg);
  35. static inline uint32_t uavcan_equipment_camera_gimbal_GEOPOICommand_encode(struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, uint8_t* buffer
  36. #if CANARD_ENABLE_TAO_OPTION
  37. , bool tao
  38. #endif
  39. ) {
  40. return _uavcan_equipment_camera_gimbal_GEOPOICommand_encode(msg, buffer
  41. #if CANARD_ENABLE_TAO_OPTION
  42. , tao
  43. #endif
  44. );
  45. }
  46. static inline bool uavcan_equipment_camera_gimbal_GEOPOICommand_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg) {
  47. return _uavcan_equipment_camera_gimbal_GEOPOICommand_decode(transfer, msg);
  48. }
  49. #if defined(CANARD_DSDLC_INTERNAL)
  50. static inline void __uavcan_equipment_camera_gimbal_GEOPOICommand_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, bool tao);
  51. static inline bool __uavcan_equipment_camera_gimbal_GEOPOICommand_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, bool tao);
  52. void __uavcan_equipment_camera_gimbal_GEOPOICommand_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, bool tao) {
  53. (void)buffer;
  54. (void)bit_ofs;
  55. (void)msg;
  56. (void)tao;
  57. canardEncodeScalar(buffer, *bit_ofs, 8, &msg->gimbal_id);
  58. *bit_ofs += 8;
  59. __uavcan_equipment_camera_gimbal_Mode_encode(buffer, bit_ofs, &msg->mode, false);
  60. canardEncodeScalar(buffer, *bit_ofs, 32, &msg->longitude_deg_1e7);
  61. *bit_ofs += 32;
  62. canardEncodeScalar(buffer, *bit_ofs, 32, &msg->latitude_deg_1e7);
  63. *bit_ofs += 32;
  64. canardEncodeScalar(buffer, *bit_ofs, 22, &msg->height_cm);
  65. *bit_ofs += 22;
  66. canardEncodeScalar(buffer, *bit_ofs, 2, &msg->height_reference);
  67. *bit_ofs += 2;
  68. }
  69. /*
  70. decode uavcan_equipment_camera_gimbal_GEOPOICommand, return true on failure, false on success
  71. */
  72. bool __uavcan_equipment_camera_gimbal_GEOPOICommand_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_camera_gimbal_GEOPOICommand* msg, bool tao) {
  73. (void)transfer;
  74. (void)bit_ofs;
  75. (void)msg;
  76. (void)tao;
  77. canardDecodeScalar(transfer, *bit_ofs, 8, false, &msg->gimbal_id);
  78. *bit_ofs += 8;
  79. if (__uavcan_equipment_camera_gimbal_Mode_decode(transfer, bit_ofs, &msg->mode, false)) {return true;}
  80. canardDecodeScalar(transfer, *bit_ofs, 32, true, &msg->longitude_deg_1e7);
  81. *bit_ofs += 32;
  82. canardDecodeScalar(transfer, *bit_ofs, 32, true, &msg->latitude_deg_1e7);
  83. *bit_ofs += 32;
  84. canardDecodeScalar(transfer, *bit_ofs, 22, true, &msg->height_cm);
  85. *bit_ofs += 22;
  86. canardDecodeScalar(transfer, *bit_ofs, 2, false, &msg->height_reference);
  87. *bit_ofs += 2;
  88. return false; /* success */
  89. }
  90. #endif
  91. #ifdef CANARD_DSDLC_TEST_BUILD
  92. struct uavcan_equipment_camera_gimbal_GEOPOICommand sample_uavcan_equipment_camera_gimbal_GEOPOICommand_msg(void);
  93. #endif
  94. #ifdef __cplusplus
  95. } // extern "C"
  96. #ifdef DRONECAN_CXX_WRAPPERS
  97. #include <canard/cxx_wrappers.h>
  98. BROADCAST_MESSAGE_CXX_IFACE(uavcan_equipment_camera_gimbal_GEOPOICommand, UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_ID, UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_SIGNATURE, UAVCAN_EQUIPMENT_CAMERA_GIMBAL_GEOPOICOMMAND_MAX_SIZE);
  99. #endif
  100. #endif