You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
9.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE STATUSTEXT_LONG PACKING
  3. #define MAVLINK_MSG_ID_STATUSTEXT_LONG 365
  4. MAVPACKED(
  5. typedef struct __mavlink_statustext_long_t {
  6. uint8_t severity; /*< Severity of status. Relies on the definitions within RFC-5424.*/
  7. char text[254]; /*< Status text message, without null termination character.*/
  8. }) mavlink_statustext_long_t;
  9. #define MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN 255
  10. #define MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN 255
  11. #define MAVLINK_MSG_ID_365_LEN 255
  12. #define MAVLINK_MSG_ID_365_MIN_LEN 255
  13. #define MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC 36
  14. #define MAVLINK_MSG_ID_365_CRC 36
  15. #define MAVLINK_MSG_STATUSTEXT_LONG_FIELD_TEXT_LEN 254
  16. #if MAVLINK_COMMAND_24BIT
  17. #define MAVLINK_MESSAGE_INFO_STATUSTEXT_LONG { \
  18. 365, \
  19. "STATUSTEXT_LONG", \
  20. 2, \
  21. { { "severity", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_statustext_long_t, severity) }, \
  22. { "text", NULL, MAVLINK_TYPE_CHAR, 254, 1, offsetof(mavlink_statustext_long_t, text) }, \
  23. } \
  24. }
  25. #else
  26. #define MAVLINK_MESSAGE_INFO_STATUSTEXT_LONG { \
  27. "STATUSTEXT_LONG", \
  28. 2, \
  29. { { "severity", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_statustext_long_t, severity) }, \
  30. { "text", NULL, MAVLINK_TYPE_CHAR, 254, 1, offsetof(mavlink_statustext_long_t, text) }, \
  31. } \
  32. }
  33. #endif
  34. /**
  35. * @brief Pack a statustext_long message
  36. * @param system_id ID of this system
  37. * @param component_id ID of this component (e.g. 200 for IMU)
  38. * @param msg The MAVLink message to compress the data into
  39. *
  40. * @param severity Severity of status. Relies on the definitions within RFC-5424.
  41. * @param text Status text message, without null termination character.
  42. * @return length of the message in bytes (excluding serial stream start sign)
  43. */
  44. static inline uint16_t mavlink_msg_statustext_long_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  45. uint8_t severity, const char *text)
  46. {
  47. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  48. char buf[MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN];
  49. _mav_put_uint8_t(buf, 0, severity);
  50. _mav_put_char_array(buf, 1, text, 254);
  51. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN);
  52. #else
  53. mavlink_statustext_long_t packet;
  54. packet.severity = severity;
  55. mav_array_memcpy(packet.text, text, sizeof(char)*254);
  56. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN);
  57. #endif
  58. msg->msgid = MAVLINK_MSG_ID_STATUSTEXT_LONG;
  59. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  60. }
  61. /**
  62. * @brief Pack a statustext_long message on a channel
  63. * @param system_id ID of this system
  64. * @param component_id ID of this component (e.g. 200 for IMU)
  65. * @param chan The MAVLink channel this message will be sent over
  66. * @param msg The MAVLink message to compress the data into
  67. * @param severity Severity of status. Relies on the definitions within RFC-5424.
  68. * @param text Status text message, without null termination character.
  69. * @return length of the message in bytes (excluding serial stream start sign)
  70. */
  71. static inline uint16_t mavlink_msg_statustext_long_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  72. mavlink_message_t* msg,
  73. uint8_t severity,const char *text)
  74. {
  75. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  76. char buf[MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN];
  77. _mav_put_uint8_t(buf, 0, severity);
  78. _mav_put_char_array(buf, 1, text, 254);
  79. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN);
  80. #else
  81. mavlink_statustext_long_t packet;
  82. packet.severity = severity;
  83. mav_array_memcpy(packet.text, text, sizeof(char)*254);
  84. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN);
  85. #endif
  86. msg->msgid = MAVLINK_MSG_ID_STATUSTEXT_LONG;
  87. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  88. }
  89. /**
  90. * @brief Encode a statustext_long struct
  91. *
  92. * @param system_id ID of this system
  93. * @param component_id ID of this component (e.g. 200 for IMU)
  94. * @param msg The MAVLink message to compress the data into
  95. * @param statustext_long C-struct to read the message contents from
  96. */
  97. static inline uint16_t mavlink_msg_statustext_long_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_statustext_long_t* statustext_long)
  98. {
  99. return mavlink_msg_statustext_long_pack(system_id, component_id, msg, statustext_long->severity, statustext_long->text);
  100. }
  101. /**
  102. * @brief Encode a statustext_long struct on a channel
  103. *
  104. * @param system_id ID of this system
  105. * @param component_id ID of this component (e.g. 200 for IMU)
  106. * @param chan The MAVLink channel this message will be sent over
  107. * @param msg The MAVLink message to compress the data into
  108. * @param statustext_long C-struct to read the message contents from
  109. */
  110. static inline uint16_t mavlink_msg_statustext_long_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_statustext_long_t* statustext_long)
  111. {
  112. return mavlink_msg_statustext_long_pack_chan(system_id, component_id, chan, msg, statustext_long->severity, statustext_long->text);
  113. }
  114. /**
  115. * @brief Send a statustext_long message
  116. * @param chan MAVLink channel to send the message
  117. *
  118. * @param severity Severity of status. Relies on the definitions within RFC-5424.
  119. * @param text Status text message, without null termination character.
  120. */
  121. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  122. static inline void mavlink_msg_statustext_long_send(mavlink_channel_t chan, uint8_t severity, const char *text)
  123. {
  124. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  125. char buf[MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN];
  126. _mav_put_uint8_t(buf, 0, severity);
  127. _mav_put_char_array(buf, 1, text, 254);
  128. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT_LONG, buf, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  129. #else
  130. mavlink_statustext_long_t packet;
  131. packet.severity = severity;
  132. mav_array_memcpy(packet.text, text, sizeof(char)*254);
  133. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT_LONG, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  134. #endif
  135. }
  136. /**
  137. * @brief Send a statustext_long message
  138. * @param chan MAVLink channel to send the message
  139. * @param struct The MAVLink struct to serialize
  140. */
  141. static inline void mavlink_msg_statustext_long_send_struct(mavlink_channel_t chan, const mavlink_statustext_long_t* statustext_long)
  142. {
  143. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  144. mavlink_msg_statustext_long_send(chan, statustext_long->severity, statustext_long->text);
  145. #else
  146. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT_LONG, (const char *)statustext_long, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  147. #endif
  148. }
  149. #if MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  150. /*
  151. This varient of _send() can be used to save stack space by re-using
  152. memory from the receive buffer. The caller provides a
  153. mavlink_message_t which is the size of a full mavlink message. This
  154. is usually the receive buffer for the channel, and allows a reply to an
  155. incoming message with minimum stack space usage.
  156. */
  157. static inline void mavlink_msg_statustext_long_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t severity, const char *text)
  158. {
  159. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  160. char *buf = (char *)msgbuf;
  161. _mav_put_uint8_t(buf, 0, severity);
  162. _mav_put_char_array(buf, 1, text, 254);
  163. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT_LONG, buf, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  164. #else
  165. mavlink_statustext_long_t *packet = (mavlink_statustext_long_t *)msgbuf;
  166. packet->severity = severity;
  167. mav_array_memcpy(packet->text, text, sizeof(char)*254);
  168. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT_LONG, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LONG_MIN_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN, MAVLINK_MSG_ID_STATUSTEXT_LONG_CRC);
  169. #endif
  170. }
  171. #endif
  172. #endif
  173. // MESSAGE STATUSTEXT_LONG UNPACKING
  174. /**
  175. * @brief Get field severity from statustext_long message
  176. *
  177. * @return Severity of status. Relies on the definitions within RFC-5424.
  178. */
  179. static inline uint8_t mavlink_msg_statustext_long_get_severity(const mavlink_message_t* msg)
  180. {
  181. return _MAV_RETURN_uint8_t(msg, 0);
  182. }
  183. /**
  184. * @brief Get field text from statustext_long message
  185. *
  186. * @return Status text message, without null termination character.
  187. */
  188. static inline uint16_t mavlink_msg_statustext_long_get_text(const mavlink_message_t* msg, char *text)
  189. {
  190. return _MAV_RETURN_char_array(msg, text, 254, 1);
  191. }
  192. /**
  193. * @brief Decode a statustext_long message into a struct
  194. *
  195. * @param msg The message to decode
  196. * @param statustext_long C-struct to decode the message contents into
  197. */
  198. static inline void mavlink_msg_statustext_long_decode(const mavlink_message_t* msg, mavlink_statustext_long_t* statustext_long)
  199. {
  200. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  201. statustext_long->severity = mavlink_msg_statustext_long_get_severity(msg);
  202. mavlink_msg_statustext_long_get_text(msg, statustext_long->text);
  203. #else
  204. uint8_t len = msg->len < MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN? msg->len : MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN;
  205. memset(statustext_long, 0, MAVLINK_MSG_ID_STATUSTEXT_LONG_LEN);
  206. memcpy(statustext_long, _MAV_PAYLOAD(msg), len);
  207. #endif
  208. }