4#define MAVLINK_MSG_ID_HEARTBEAT 0
7typedef struct __mavlink_heartbeat_t {
12 uint8_t system_status;
13 uint8_t mavlink_version;
14}) mavlink_heartbeat_t;
16#define MAVLINK_MSG_ID_HEARTBEAT_LEN 9
17#define MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN 9
18#define MAVLINK_MSG_ID_0_LEN 9
19#define MAVLINK_MSG_ID_0_MIN_LEN 9
21#define MAVLINK_MSG_ID_HEARTBEAT_CRC 50
22#define MAVLINK_MSG_ID_0_CRC 50
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_HEARTBEAT { \
31 { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_heartbeat_t, type) }, \
32 { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_heartbeat_t, autopilot) }, \
33 { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_heartbeat_t, base_mode) }, \
34 { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_heartbeat_t, custom_mode) }, \
35 { "system_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_heartbeat_t, system_status) }, \
36 { "mavlink_version", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_heartbeat_t, mavlink_version) }, \
40#define MAVLINK_MESSAGE_INFO_HEARTBEAT { \
43 { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_heartbeat_t, type) }, \
44 { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_heartbeat_t, autopilot) }, \
45 { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_heartbeat_t, base_mode) }, \
46 { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_heartbeat_t, custom_mode) }, \
47 { "system_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_heartbeat_t, system_status) }, \
48 { "mavlink_version", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_heartbeat_t, mavlink_version) }, \
66static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
67 uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
69#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70 char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
71 _mav_put_uint32_t(buf, 0, custom_mode);
72 _mav_put_uint8_t(buf, 4, type);
73 _mav_put_uint8_t(buf, 5, autopilot);
74 _mav_put_uint8_t(buf, 6, base_mode);
75 _mav_put_uint8_t(buf, 7, system_status);
76 _mav_put_uint8_t(buf, 8, 3);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
80 mavlink_heartbeat_t packet;
81 packet.custom_mode = custom_mode;
83 packet.autopilot = autopilot;
84 packet.base_mode = base_mode;
85 packet.system_status = system_status;
86 packet.mavlink_version = 3;
88 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
91 msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
92 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
108static inline uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
109 mavlink_message_t* msg,
110 uint8_t type,uint8_t autopilot,uint8_t base_mode,uint32_t custom_mode,uint8_t system_status)
112#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113 char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
114 _mav_put_uint32_t(buf, 0, custom_mode);
115 _mav_put_uint8_t(buf, 4, type);
116 _mav_put_uint8_t(buf, 5, autopilot);
117 _mav_put_uint8_t(buf, 6, base_mode);
118 _mav_put_uint8_t(buf, 7, system_status);
119 _mav_put_uint8_t(buf, 8, 3);
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HEARTBEAT_LEN);
123 mavlink_heartbeat_t packet;
124 packet.custom_mode = custom_mode;
126 packet.autopilot = autopilot;
127 packet.base_mode = base_mode;
128 packet.system_status = system_status;
129 packet.mavlink_version = 3;
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HEARTBEAT_LEN);
134 msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
135 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
146static inline uint16_t mavlink_msg_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const mavlink_heartbeat_t* heartbeat)
148 return mavlink_msg_heartbeat_pack(system_id, component_id, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status);
160static inline uint16_t mavlink_msg_heartbeat_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg,
const mavlink_heartbeat_t* heartbeat)
162 return mavlink_msg_heartbeat_pack_chan(system_id, component_id, chan, msg, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status);
175#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
177static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
179#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
180 char buf[MAVLINK_MSG_ID_HEARTBEAT_LEN];
181 _mav_put_uint32_t(buf, 0, custom_mode);
182 _mav_put_uint8_t(buf, 4, type);
183 _mav_put_uint8_t(buf, 5, autopilot);
184 _mav_put_uint8_t(buf, 6, base_mode);
185 _mav_put_uint8_t(buf, 7, system_status);
186 _mav_put_uint8_t(buf, 8, 3);
188 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
190 mavlink_heartbeat_t packet;
191 packet.custom_mode = custom_mode;
193 packet.autopilot = autopilot;
194 packet.base_mode = base_mode;
195 packet.system_status = system_status;
196 packet.mavlink_version = 3;
198 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (
const char *)&packet, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
207static inline void mavlink_msg_heartbeat_send_struct(mavlink_channel_t chan,
const mavlink_heartbeat_t* heartbeat)
209#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 mavlink_msg_heartbeat_send(chan, heartbeat->type, heartbeat->autopilot, heartbeat->base_mode, heartbeat->custom_mode, heartbeat->system_status);
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (
const char *)heartbeat, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
216#if MAVLINK_MSG_ID_HEARTBEAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
224static inline void mavlink_msg_heartbeat_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t autopilot, uint8_t base_mode, uint32_t custom_mode, uint8_t system_status)
226#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
227 char *buf = (
char *)msgbuf;
228 _mav_put_uint32_t(buf, 0, custom_mode);
229 _mav_put_uint8_t(buf, 4, type);
230 _mav_put_uint8_t(buf, 5, autopilot);
231 _mav_put_uint8_t(buf, 6, base_mode);
232 _mav_put_uint8_t(buf, 7, system_status);
233 _mav_put_uint8_t(buf, 8, 3);
235 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
237 mavlink_heartbeat_t *packet = (mavlink_heartbeat_t *)msgbuf;
238 packet->custom_mode = custom_mode;
240 packet->autopilot = autopilot;
241 packet->base_mode = base_mode;
242 packet->system_status = system_status;
243 packet->mavlink_version = 3;
245 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (
const char *)packet, MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN, MAVLINK_MSG_ID_HEARTBEAT_LEN, MAVLINK_MSG_ID_HEARTBEAT_CRC);
260static inline uint8_t mavlink_msg_heartbeat_get_type(
const mavlink_message_t* msg)
262 return _MAV_RETURN_uint8_t(msg, 4);
270static inline uint8_t mavlink_msg_heartbeat_get_autopilot(
const mavlink_message_t* msg)
272 return _MAV_RETURN_uint8_t(msg, 5);
280static inline uint8_t mavlink_msg_heartbeat_get_base_mode(
const mavlink_message_t* msg)
282 return _MAV_RETURN_uint8_t(msg, 6);
290static inline uint32_t mavlink_msg_heartbeat_get_custom_mode(
const mavlink_message_t* msg)
292 return _MAV_RETURN_uint32_t(msg, 0);
300static inline uint8_t mavlink_msg_heartbeat_get_system_status(
const mavlink_message_t* msg)
302 return _MAV_RETURN_uint8_t(msg, 7);
310static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(
const mavlink_message_t* msg)
312 return _MAV_RETURN_uint8_t(msg, 8);
321static inline void mavlink_msg_heartbeat_decode(
const mavlink_message_t* msg, mavlink_heartbeat_t* heartbeat)
323#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
324 heartbeat->custom_mode = mavlink_msg_heartbeat_get_custom_mode(msg);
325 heartbeat->type = mavlink_msg_heartbeat_get_type(msg);
326 heartbeat->autopilot = mavlink_msg_heartbeat_get_autopilot(msg);
327 heartbeat->base_mode = mavlink_msg_heartbeat_get_base_mode(msg);
328 heartbeat->system_status = mavlink_msg_heartbeat_get_system_status(msg);
329 heartbeat->mavlink_version = mavlink_msg_heartbeat_get_mavlink_version(msg);
331 uint8_t len = msg->len < MAVLINK_MSG_ID_HEARTBEAT_LEN? msg->len : MAVLINK_MSG_ID_HEARTBEAT_LEN;
332 memset(heartbeat, 0, MAVLINK_MSG_ID_HEARTBEAT_LEN);
333 memcpy(heartbeat, _MAV_PAYLOAD(msg), len);