#pragma once // MESSAGE WOW_SENSOR PACKING #define MAVLINK_MSG_ID_WOW_SENSOR 20007 MAVPACKED( typedef struct __mavlink_wow_sensor_t { uint8_t ch1; /*< ch1*/ uint8_t ch2; /*< ch2*/ uint8_t ch3; /*< ch3*/ uint8_t ch4; /*< ch4*/ uint8_t ch5; /*< ch5*/ uint8_t ch6; /*< ch6*/ }) mavlink_wow_sensor_t; #define MAVLINK_MSG_ID_WOW_SENSOR_LEN 6 #define MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN 6 #define MAVLINK_MSG_ID_20007_LEN 6 #define MAVLINK_MSG_ID_20007_MIN_LEN 6 #define MAVLINK_MSG_ID_WOW_SENSOR_CRC 204 #define MAVLINK_MSG_ID_20007_CRC 204 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_WOW_SENSOR { \ 20007, \ "WOW_SENSOR", \ 6, \ { { "ch1", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_wow_sensor_t, ch1) }, \ { "ch2", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_wow_sensor_t, ch2) }, \ { "ch3", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_wow_sensor_t, ch3) }, \ { "ch4", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_wow_sensor_t, ch4) }, \ { "ch5", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_wow_sensor_t, ch5) }, \ { "ch6", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_wow_sensor_t, ch6) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_WOW_SENSOR { \ "WOW_SENSOR", \ 6, \ { { "ch1", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_wow_sensor_t, ch1) }, \ { "ch2", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_wow_sensor_t, ch2) }, \ { "ch3", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_wow_sensor_t, ch3) }, \ { "ch4", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_wow_sensor_t, ch4) }, \ { "ch5", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_wow_sensor_t, ch5) }, \ { "ch6", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_wow_sensor_t, ch6) }, \ } \ } #endif /** * @brief Pack a wow_sensor 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 ch1 ch1 * @param ch2 ch2 * @param ch3 ch3 * @param ch4 ch4 * @param ch5 ch5 * @param ch6 ch6 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_wow_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t ch1, uint8_t ch2, uint8_t ch3, uint8_t ch4, uint8_t ch5, uint8_t ch6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_WOW_SENSOR_LEN]; _mav_put_uint8_t(buf, 0, ch1); _mav_put_uint8_t(buf, 1, ch2); _mav_put_uint8_t(buf, 2, ch3); _mav_put_uint8_t(buf, 3, ch4); _mav_put_uint8_t(buf, 4, ch5); _mav_put_uint8_t(buf, 5, ch6); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WOW_SENSOR_LEN); #else mavlink_wow_sensor_t packet; packet.ch1 = ch1; packet.ch2 = ch2; packet.ch3 = ch3; packet.ch4 = ch4; packet.ch5 = ch5; packet.ch6 = ch6; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WOW_SENSOR_LEN); #endif msg->msgid = MAVLINK_MSG_ID_WOW_SENSOR; return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); } /** * @brief Pack a wow_sensor 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 ch1 ch1 * @param ch2 ch2 * @param ch3 ch3 * @param ch4 ch4 * @param ch5 ch5 * @param ch6 ch6 * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_wow_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t ch1,uint8_t ch2,uint8_t ch3,uint8_t ch4,uint8_t ch5,uint8_t ch6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_WOW_SENSOR_LEN]; _mav_put_uint8_t(buf, 0, ch1); _mav_put_uint8_t(buf, 1, ch2); _mav_put_uint8_t(buf, 2, ch3); _mav_put_uint8_t(buf, 3, ch4); _mav_put_uint8_t(buf, 4, ch5); _mav_put_uint8_t(buf, 5, ch6); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WOW_SENSOR_LEN); #else mavlink_wow_sensor_t packet; packet.ch1 = ch1; packet.ch2 = ch2; packet.ch3 = ch3; packet.ch4 = ch4; packet.ch5 = ch5; packet.ch6 = ch6; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WOW_SENSOR_LEN); #endif msg->msgid = MAVLINK_MSG_ID_WOW_SENSOR; return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); } /** * @brief Encode a wow_sensor 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 wow_sensor C-struct to read the message contents from */ static inline uint16_t mavlink_msg_wow_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_wow_sensor_t* wow_sensor) { return mavlink_msg_wow_sensor_pack(system_id, component_id, msg, wow_sensor->ch1, wow_sensor->ch2, wow_sensor->ch3, wow_sensor->ch4, wow_sensor->ch5, wow_sensor->ch6); } /** * @brief Encode a wow_sensor 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 wow_sensor C-struct to read the message contents from */ static inline uint16_t mavlink_msg_wow_sensor_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_wow_sensor_t* wow_sensor) { return mavlink_msg_wow_sensor_pack_chan(system_id, component_id, chan, msg, wow_sensor->ch1, wow_sensor->ch2, wow_sensor->ch3, wow_sensor->ch4, wow_sensor->ch5, wow_sensor->ch6); } /** * @brief Send a wow_sensor message * @param chan MAVLink channel to send the message * * @param ch1 ch1 * @param ch2 ch2 * @param ch3 ch3 * @param ch4 ch4 * @param ch5 ch5 * @param ch6 ch6 */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_wow_sensor_send(mavlink_channel_t chan, uint8_t ch1, uint8_t ch2, uint8_t ch3, uint8_t ch4, uint8_t ch5, uint8_t ch6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_WOW_SENSOR_LEN]; _mav_put_uint8_t(buf, 0, ch1); _mav_put_uint8_t(buf, 1, ch2); _mav_put_uint8_t(buf, 2, ch3); _mav_put_uint8_t(buf, 3, ch4); _mav_put_uint8_t(buf, 4, ch5); _mav_put_uint8_t(buf, 5, ch6); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WOW_SENSOR, buf, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); #else mavlink_wow_sensor_t packet; packet.ch1 = ch1; packet.ch2 = ch2; packet.ch3 = ch3; packet.ch4 = ch4; packet.ch5 = ch5; packet.ch6 = ch6; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WOW_SENSOR, (const char *)&packet, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); #endif } /** * @brief Send a wow_sensor message * @param chan MAVLink channel to send the message * @param struct The MAVLink struct to serialize */ static inline void mavlink_msg_wow_sensor_send_struct(mavlink_channel_t chan, const mavlink_wow_sensor_t* wow_sensor) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS mavlink_msg_wow_sensor_send(chan, wow_sensor->ch1, wow_sensor->ch2, wow_sensor->ch3, wow_sensor->ch4, wow_sensor->ch5, wow_sensor->ch6); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WOW_SENSOR, (const char *)wow_sensor, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); #endif } #if MAVLINK_MSG_ID_WOW_SENSOR_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_wow_sensor_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t ch1, uint8_t ch2, uint8_t ch3, uint8_t ch4, uint8_t ch5, uint8_t ch6) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_uint8_t(buf, 0, ch1); _mav_put_uint8_t(buf, 1, ch2); _mav_put_uint8_t(buf, 2, ch3); _mav_put_uint8_t(buf, 3, ch4); _mav_put_uint8_t(buf, 4, ch5); _mav_put_uint8_t(buf, 5, ch6); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WOW_SENSOR, buf, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); #else mavlink_wow_sensor_t *packet = (mavlink_wow_sensor_t *)msgbuf; packet->ch1 = ch1; packet->ch2 = ch2; packet->ch3 = ch3; packet->ch4 = ch4; packet->ch5 = ch5; packet->ch6 = ch6; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WOW_SENSOR, (const char *)packet, MAVLINK_MSG_ID_WOW_SENSOR_MIN_LEN, MAVLINK_MSG_ID_WOW_SENSOR_LEN, MAVLINK_MSG_ID_WOW_SENSOR_CRC); #endif } #endif #endif // MESSAGE WOW_SENSOR UNPACKING /** * @brief Get field ch1 from wow_sensor message * * @return ch1 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch1(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 0); } /** * @brief Get field ch2 from wow_sensor message * * @return ch2 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch2(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 1); } /** * @brief Get field ch3 from wow_sensor message * * @return ch3 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch3(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 2); } /** * @brief Get field ch4 from wow_sensor message * * @return ch4 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch4(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 3); } /** * @brief Get field ch5 from wow_sensor message * * @return ch5 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch5(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 4); } /** * @brief Get field ch6 from wow_sensor message * * @return ch6 */ static inline uint8_t mavlink_msg_wow_sensor_get_ch6(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 5); } /** * @brief Decode a wow_sensor message into a struct * * @param msg The message to decode * @param wow_sensor C-struct to decode the message contents into */ static inline void mavlink_msg_wow_sensor_decode(const mavlink_message_t* msg, mavlink_wow_sensor_t* wow_sensor) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS wow_sensor->ch1 = mavlink_msg_wow_sensor_get_ch1(msg); wow_sensor->ch2 = mavlink_msg_wow_sensor_get_ch2(msg); wow_sensor->ch3 = mavlink_msg_wow_sensor_get_ch3(msg); wow_sensor->ch4 = mavlink_msg_wow_sensor_get_ch4(msg); wow_sensor->ch5 = mavlink_msg_wow_sensor_get_ch5(msg); wow_sensor->ch6 = mavlink_msg_wow_sensor_get_ch6(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_WOW_SENSOR_LEN? msg->len : MAVLINK_MSG_ID_WOW_SENSOR_LEN; memset(wow_sensor, 0, MAVLINK_MSG_ID_WOW_SENSOR_LEN); memcpy(wow_sensor, _MAV_PAYLOAD(msg), len); #endif }