mavlink_msg_statustext.h
Go to the documentation of this file.
00001 // MESSAGE STATUSTEXT PACKING
00002 
00003 #define MAVLINK_MSG_ID_STATUSTEXT 253
00004 
00005 typedef struct __mavlink_statustext_t
00006 {
00007  uint8_t severity; /*< Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.*/
00008  char text[50]; /*< Status text message, without null termination character*/
00009 } mavlink_statustext_t;
00010 
00011 #define MAVLINK_MSG_ID_STATUSTEXT_LEN 51
00012 #define MAVLINK_MSG_ID_253_LEN 51
00013 
00014 #define MAVLINK_MSG_ID_STATUSTEXT_CRC 83
00015 #define MAVLINK_MSG_ID_253_CRC 83
00016 
00017 #define MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN 50
00018 
00019 #define MAVLINK_MESSAGE_INFO_STATUSTEXT { \
00020         "STATUSTEXT", \
00021         2, \
00022         {  { "severity", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_statustext_t, severity) }, \
00023          { "text", NULL, MAVLINK_TYPE_CHAR, 50, 1, offsetof(mavlink_statustext_t, text) }, \
00024          } \
00025 }
00026 
00027 
00038 static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00039                                                        uint8_t severity, const char *text)
00040 {
00041 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00042         char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
00043         _mav_put_uint8_t(buf, 0, severity);
00044         _mav_put_char_array(buf, 1, text, 50);
00045         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00046 #else
00047         mavlink_statustext_t packet;
00048         packet.severity = severity;
00049         mav_array_memcpy(packet.text, text, sizeof(char)*50);
00050         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00051 #endif
00052 
00053         msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
00054 #if MAVLINK_CRC_EXTRA
00055     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00056 #else
00057     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00058 #endif
00059 }
00060 
00071 static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00072                                                            mavlink_message_t* msg,
00073                                                            uint8_t severity,const char *text)
00074 {
00075 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00076         char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
00077         _mav_put_uint8_t(buf, 0, severity);
00078         _mav_put_char_array(buf, 1, text, 50);
00079         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00080 #else
00081         mavlink_statustext_t packet;
00082         packet.severity = severity;
00083         mav_array_memcpy(packet.text, text, sizeof(char)*50);
00084         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00085 #endif
00086 
00087         msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
00088 #if MAVLINK_CRC_EXTRA
00089     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00090 #else
00091     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00092 #endif
00093 }
00094 
00103 static inline uint16_t mavlink_msg_statustext_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_statustext_t* statustext)
00104 {
00105         return mavlink_msg_statustext_pack(system_id, component_id, msg, statustext->severity, statustext->text);
00106 }
00107 
00117 static inline uint16_t mavlink_msg_statustext_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_statustext_t* statustext)
00118 {
00119         return mavlink_msg_statustext_pack_chan(system_id, component_id, chan, msg, statustext->severity, statustext->text);
00120 }
00121 
00129 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00130 
00131 static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t severity, const char *text)
00132 {
00133 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00134         char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
00135         _mav_put_uint8_t(buf, 0, severity);
00136         _mav_put_char_array(buf, 1, text, 50);
00137 #if MAVLINK_CRC_EXTRA
00138     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00139 #else
00140     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00141 #endif
00142 #else
00143         mavlink_statustext_t packet;
00144         packet.severity = severity;
00145         mav_array_memcpy(packet.text, text, sizeof(char)*50);
00146 #if MAVLINK_CRC_EXTRA
00147     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00148 #else
00149     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00150 #endif
00151 #endif
00152 }
00153 
00154 #if MAVLINK_MSG_ID_STATUSTEXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00155 /*
00156   This varient of _send() can be used to save stack space by re-using
00157   memory from the receive buffer.  The caller provides a
00158   mavlink_message_t which is the size of a full mavlink message. This
00159   is usually the receive buffer for the channel, and allows a reply to an
00160   incoming message with minimum stack space usage.
00161  */
00162 static inline void mavlink_msg_statustext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint8_t severity, const char *text)
00163 {
00164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00165         char *buf = (char *)msgbuf;
00166         _mav_put_uint8_t(buf, 0, severity);
00167         _mav_put_char_array(buf, 1, text, 50);
00168 #if MAVLINK_CRC_EXTRA
00169     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00170 #else
00171     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00172 #endif
00173 #else
00174         mavlink_statustext_t *packet = (mavlink_statustext_t *)msgbuf;
00175         packet->severity = severity;
00176         mav_array_memcpy(packet->text, text, sizeof(char)*50);
00177 #if MAVLINK_CRC_EXTRA
00178     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
00179 #else
00180     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
00181 #endif
00182 #endif
00183 }
00184 #endif
00185 
00186 #endif
00187 
00188 // MESSAGE STATUSTEXT UNPACKING
00189 
00190 
00196 static inline uint8_t mavlink_msg_statustext_get_severity(const mavlink_message_t* msg)
00197 {
00198         return _MAV_RETURN_uint8_t(msg,  0);
00199 }
00200 
00206 static inline uint16_t mavlink_msg_statustext_get_text(const mavlink_message_t* msg, char *text)
00207 {
00208         return _MAV_RETURN_char_array(msg, text, 50,  1);
00209 }
00210 
00217 static inline void mavlink_msg_statustext_decode(const mavlink_message_t* msg, mavlink_statustext_t* statustext)
00218 {
00219 #if MAVLINK_NEED_BYTE_SWAP
00220         statustext->severity = mavlink_msg_statustext_get_severity(msg);
00221         mavlink_msg_statustext_get_text(msg, statustext->text);
00222 #else
00223         memcpy(statustext, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_STATUSTEXT_LEN);
00224 #endif
00225 }


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:35