| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- #pragma once
- #include <stdbool.h>
- #include <stdint.h>
- #include <canard.h>
- #define VKWEIGHER_WEIGHERSTATUS_MAX_SIZE 35
- #define VKWEIGHER_WEIGHERSTATUS_SIGNATURE (0x5B77380AAF093557ULL)
- #define VKWEIGHER_WEIGHERSTATUS_ID 52000
- #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
- class vkweigher_WeigherStatus_cxx_iface;
- #endif
- struct vkweigher_WeigherStatus {
- #if defined(__cplusplus) && defined(DRONECAN_CXX_WRAPPERS)
- using cxx_iface = vkweigher_WeigherStatus_cxx_iface;
- #endif
- uint32_t weight;
- uint16_t rate;
- uint8_t status;
- int16_t gx;
- int16_t gy;
- int16_t gz;
- int16_t ax;
- int16_t ay;
- int16_t az;
- float Q[4];
- };
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- uint32_t vkweigher_WeigherStatus_encode(struct vkweigher_WeigherStatus* msg, uint8_t* buffer
- #if CANARD_ENABLE_TAO_OPTION
- , bool tao
- #endif
- );
- bool vkweigher_WeigherStatus_decode(const CanardRxTransfer* transfer, struct vkweigher_WeigherStatus* msg);
- #if defined(CANARD_DSDLC_INTERNAL)
- static inline void _vkweigher_WeigherStatus_encode(uint8_t* buffer, uint32_t* bit_ofs, struct vkweigher_WeigherStatus* msg, bool tao);
- static inline bool _vkweigher_WeigherStatus_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct vkweigher_WeigherStatus* msg, bool tao);
- void _vkweigher_WeigherStatus_encode(uint8_t* buffer, uint32_t* bit_ofs, struct vkweigher_WeigherStatus* msg, bool tao) {
- (void)buffer;
- (void)bit_ofs;
- (void)msg;
- (void)tao;
- canardEncodeScalar(buffer, *bit_ofs, 32, &msg->weight);
- *bit_ofs += 32;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->rate);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 8, &msg->status);
- *bit_ofs += 8;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->gx);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->gy);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->gz);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->ax);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->ay);
- *bit_ofs += 16;
- canardEncodeScalar(buffer, *bit_ofs, 16, &msg->az);
- *bit_ofs += 16;
- for (size_t i=0; i < 4; i++) {
- canardEncodeScalar(buffer, *bit_ofs, 32, &msg->Q[i]);
- *bit_ofs += 32;
- }
- }
- /*
- decode vkweigher_WeigherStatus, return true on failure, false on success
- */
- bool _vkweigher_WeigherStatus_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct vkweigher_WeigherStatus* msg, bool tao) {
- (void)transfer;
- (void)bit_ofs;
- (void)msg;
- (void)tao;
- canardDecodeScalar(transfer, *bit_ofs, 32, false, &msg->weight);
- *bit_ofs += 32;
- canardDecodeScalar(transfer, *bit_ofs, 16, false, &msg->rate);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 8, false, &msg->status);
- *bit_ofs += 8;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->gx);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->gy);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->gz);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->ax);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->ay);
- *bit_ofs += 16;
- canardDecodeScalar(transfer, *bit_ofs, 16, true, &msg->az);
- *bit_ofs += 16;
- for (size_t i=0; i < 4; i++) {
- canardDecodeScalar(transfer, *bit_ofs, 32, true, &msg->Q[i]);
- *bit_ofs += 32;
- }
- return false; /* success */
- }
- #endif
- #ifdef CANARD_DSDLC_TEST_BUILD
- struct vkweigher_WeigherStatus sample_vkweigher_WeigherStatus_msg(void);
- #endif
- #ifdef __cplusplus
- } // extern "C"
- #ifdef DRONECAN_CXX_WRAPPERS
- #include <canard/cxx_wrappers.h>
- BROADCAST_MESSAGE_CXX_IFACE(vkweigher_WeigherStatus, VKWEIGHER_WEIGHERSTATUS_ID, VKWEIGHER_WEIGHERSTATUS_SIGNATURE, VKWEIGHER_WEIGHERSTATUS_MAX_SIZE);
- #endif
- #endif
|