#pragma once // MESSAGE RADAR_ALTM PACKING #define MAVLINK_MSG_ID_RADAR_ALTM 20102 typedef struct __mavlink_radar_altm_t { uint32_t time_boot_ms; /*< [ms] Timestamp (milliseconds since system boot)*/ float AGL; /*< AGL[m]*/ uint8_t enabled; /*< Enabled*/ uint8_t seq; /*< sequeue index*/ } mavlink_radar_altm_t; #define MAVLINK_MSG_ID_RADAR_ALTM_LEN 10 #define MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN 10 #define MAVLINK_MSG_ID_20102_LEN 10 #define MAVLINK_MSG_ID_20102_MIN_LEN 10 #define MAVLINK_MSG_ID_RADAR_ALTM_CRC 128 #define MAVLINK_MSG_ID_20102_CRC 128 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_RADAR_ALTM { \ 20102, \ "RADAR_ALTM", \ 4, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radar_altm_t, time_boot_ms) }, \ { "AGL", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_radar_altm_t, AGL) }, \ { "enabled", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radar_altm_t, enabled) }, \ { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_radar_altm_t, seq) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_RADAR_ALTM { \ "RADAR_ALTM", \ 4, \ { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_radar_altm_t, time_boot_ms) }, \ { "AGL", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_radar_altm_t, AGL) }, \ { "enabled", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radar_altm_t, enabled) }, \ { "seq", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_radar_altm_t, seq) }, \ } \ } #endif /** * @brief Pack a radar_altm message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * * @param time_boot_ms [ms] Timestamp (milliseconds since system boot) * @param AGL AGL[m] * @param enabled Enabled * @param seq sequeue index * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_radar_altm_pack(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg, uint32_t time_boot_ms, float AGL, uint8_t enabled, uint8_t seq) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_RADAR_ALTM_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); _mav_put_float(buf, 4, AGL); _mav_put_uint8_t(buf, 8, enabled); _mav_put_uint8_t(buf, 9, seq); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADAR_ALTM_LEN); #else mavlink_radar_altm_t packet; packet.time_boot_ms = time_boot_ms; packet.AGL = AGL; packet.enabled = enabled; packet.seq = seq; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADAR_ALTM_LEN); #endif msg->msgid = MAVLINK_MSG_ID_RADAR_ALTM; return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); } /** * @brief Pack a radar_altm message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param time_boot_ms [ms] Timestamp (milliseconds since system boot) * @param AGL AGL[m] * @param enabled Enabled * @param seq sequeue index * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_radar_altm_pack_chan(uint16_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint32_t time_boot_ms,float AGL,uint8_t enabled,uint8_t seq) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_RADAR_ALTM_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); _mav_put_float(buf, 4, AGL); _mav_put_uint8_t(buf, 8, enabled); _mav_put_uint8_t(buf, 9, seq); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADAR_ALTM_LEN); #else mavlink_radar_altm_t packet; packet.time_boot_ms = time_boot_ms; packet.AGL = AGL; packet.enabled = enabled; packet.seq = seq; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADAR_ALTM_LEN); #endif msg->msgid = MAVLINK_MSG_ID_RADAR_ALTM; return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); } /** * @brief Encode a radar_altm struct * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * @param radar_altm C-struct to read the message contents from */ static inline uint16_t mavlink_msg_radar_altm_encode(uint16_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radar_altm_t* radar_altm) { return mavlink_msg_radar_altm_pack(system_id, component_id, msg, radar_altm->time_boot_ms, radar_altm->AGL, radar_altm->enabled, radar_altm->seq); } /** * @brief Encode a radar_altm struct on a channel * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param radar_altm C-struct to read the message contents from */ static inline uint16_t mavlink_msg_radar_altm_encode_chan(uint16_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radar_altm_t* radar_altm) { return mavlink_msg_radar_altm_pack_chan(system_id, component_id, chan, msg, radar_altm->time_boot_ms, radar_altm->AGL, radar_altm->enabled, radar_altm->seq); } /** * @brief Send a radar_altm message * @param chan MAVLink channel to send the message * * @param time_boot_ms [ms] Timestamp (milliseconds since system boot) * @param AGL AGL[m] * @param enabled Enabled * @param seq sequeue index */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_radar_altm_send(mavlink_channel_t chan, uint32_t time_boot_ms, float AGL, uint8_t enabled, uint8_t seq) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_RADAR_ALTM_LEN]; _mav_put_uint32_t(buf, 0, time_boot_ms); _mav_put_float(buf, 4, AGL); _mav_put_uint8_t(buf, 8, enabled); _mav_put_uint8_t(buf, 9, seq); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_ALTM, buf, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); #else mavlink_radar_altm_t packet; packet.time_boot_ms = time_boot_ms; packet.AGL = AGL; packet.enabled = enabled; packet.seq = seq; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_ALTM, (const char *)&packet, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); #endif } /** * @brief Send a radar_altm message * @param chan MAVLink channel to send the message * @param struct The MAVLink struct to serialize */ static inline void mavlink_msg_radar_altm_send_struct(mavlink_channel_t chan, const mavlink_radar_altm_t* radar_altm) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS mavlink_msg_radar_altm_send(chan, radar_altm->time_boot_ms, radar_altm->AGL, radar_altm->enabled, radar_altm->seq); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_ALTM, (const char *)radar_altm, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); #endif } #if MAVLINK_MSG_ID_RADAR_ALTM_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* This varient of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ static inline void mavlink_msg_radar_altm_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float AGL, uint8_t enabled, uint8_t seq) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint32_t(buf, 0, time_boot_ms); _mav_put_float(buf, 4, AGL); _mav_put_uint8_t(buf, 8, enabled); _mav_put_uint8_t(buf, 9, seq); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_ALTM, buf, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); #else mavlink_radar_altm_t *packet = (mavlink_radar_altm_t *)msgbuf; packet->time_boot_ms = time_boot_ms; packet->AGL = AGL; packet->enabled = enabled; packet->seq = seq; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADAR_ALTM, (const char *)packet, MAVLINK_MSG_ID_RADAR_ALTM_MIN_LEN, MAVLINK_MSG_ID_RADAR_ALTM_LEN, MAVLINK_MSG_ID_RADAR_ALTM_CRC); #endif } #endif #endif // MESSAGE RADAR_ALTM UNPACKING /** * @brief Get field time_boot_ms from radar_altm message * * @return [ms] Timestamp (milliseconds since system boot) */ static inline uint32_t mavlink_msg_radar_altm_get_time_boot_ms(const mavlink_message_t* msg) { return _MAV_RETURN_uint32_t(msg, 0); } /** * @brief Get field AGL from radar_altm message * * @return AGL[m] */ static inline float mavlink_msg_radar_altm_get_AGL(const mavlink_message_t* msg) { return _MAV_RETURN_float(msg, 4); } /** * @brief Get field enabled from radar_altm message * * @return Enabled */ static inline uint8_t mavlink_msg_radar_altm_get_enabled(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 8); } /** * @brief Get field seq from radar_altm message * * @return sequeue index */ static inline uint8_t mavlink_msg_radar_altm_get_seq(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 9); } /** * @brief Decode a radar_altm message into a struct * * @param msg The message to decode * @param radar_altm C-struct to decode the message contents into */ static inline void mavlink_msg_radar_altm_decode(const mavlink_message_t* msg, mavlink_radar_altm_t* radar_altm) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS radar_altm->time_boot_ms = mavlink_msg_radar_altm_get_time_boot_ms(msg); radar_altm->AGL = mavlink_msg_radar_altm_get_AGL(msg); radar_altm->enabled = mavlink_msg_radar_altm_get_enabled(msg); radar_altm->seq = mavlink_msg_radar_altm_get_seq(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_RADAR_ALTM_LEN? msg->len : MAVLINK_MSG_ID_RADAR_ALTM_LEN; memset(radar_altm, 0, MAVLINK_MSG_ID_RADAR_ALTM_LEN); memcpy(radar_altm, _MAV_PAYLOAD(msg), len); #endif }