mavlink_msg_open_drone_id_arm_status.h 11 KB

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