/ACM_2_0_45_OSD/libraries/GCS_MAVLink/include/common/mavlink_msg_change_operator_control.h

https://github.com/MacDev240/ArduPilotMega_OSD-with-Ublox-3D-DGPS · C Header · 204 lines · 114 code · 21 blank · 69 comment · 3 complexity · aa63ea820875443b6799e8117cdc5287 MD5 · raw file

  1. // MESSAGE CHANGE_OPERATOR_CONTROL PACKING
  2. #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
  3. typedef struct __mavlink_change_operator_control_t
  4. {
  5. uint8_t target_system; ///< System the GCS requests control for
  6. uint8_t control_request; ///< 0: request control of this MAV, 1: Release control of this MAV
  7. uint8_t version; ///< 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
  8. char passkey[25]; ///< Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
  9. } mavlink_change_operator_control_t;
  10. #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
  11. #define MAVLINK_MSG_ID_5_LEN 28
  12. #define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
  13. #define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
  14. "CHANGE_OPERATOR_CONTROL", \
  15. 4, \
  16. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
  17. { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
  18. { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
  19. { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
  20. } \
  21. }
  22. /**
  23. * @brief Pack a change_operator_control message
  24. * @param system_id ID of this system
  25. * @param component_id ID of this component (e.g. 200 for IMU)
  26. * @param msg The MAVLink message to compress the data into
  27. *
  28. * @param target_system System the GCS requests control for
  29. * @param control_request 0: request control of this MAV, 1: Release control of this MAV
  30. * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
  31. * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
  32. * @return length of the message in bytes (excluding serial stream start sign)
  33. */
  34. static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  35. uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
  36. {
  37. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  38. char buf[28];
  39. _mav_put_uint8_t(buf, 0, target_system);
  40. _mav_put_uint8_t(buf, 1, control_request);
  41. _mav_put_uint8_t(buf, 2, version);
  42. _mav_put_char_array(buf, 3, passkey, 25);
  43. memcpy(_MAV_PAYLOAD(msg), buf, 28);
  44. #else
  45. mavlink_change_operator_control_t packet;
  46. packet.target_system = target_system;
  47. packet.control_request = control_request;
  48. packet.version = version;
  49. memcpy(packet.passkey, passkey, sizeof(char)*25);
  50. memcpy(_MAV_PAYLOAD(msg), &packet, 28);
  51. #endif
  52. msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
  53. return mavlink_finalize_message(msg, system_id, component_id, 28);
  54. }
  55. /**
  56. * @brief Pack a change_operator_control message on a channel
  57. * @param system_id ID of this system
  58. * @param component_id ID of this component (e.g. 200 for IMU)
  59. * @param chan The MAVLink channel this message was sent over
  60. * @param msg The MAVLink message to compress the data into
  61. * @param target_system System the GCS requests control for
  62. * @param control_request 0: request control of this MAV, 1: Release control of this MAV
  63. * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
  64. * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
  65. * @return length of the message in bytes (excluding serial stream start sign)
  66. */
  67. static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  68. mavlink_message_t* msg,
  69. uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
  70. {
  71. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  72. char buf[28];
  73. _mav_put_uint8_t(buf, 0, target_system);
  74. _mav_put_uint8_t(buf, 1, control_request);
  75. _mav_put_uint8_t(buf, 2, version);
  76. _mav_put_char_array(buf, 3, passkey, 25);
  77. memcpy(_MAV_PAYLOAD(msg), buf, 28);
  78. #else
  79. mavlink_change_operator_control_t packet;
  80. packet.target_system = target_system;
  81. packet.control_request = control_request;
  82. packet.version = version;
  83. memcpy(packet.passkey, passkey, sizeof(char)*25);
  84. memcpy(_MAV_PAYLOAD(msg), &packet, 28);
  85. #endif
  86. msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
  87. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 28);
  88. }
  89. /**
  90. * @brief Encode a change_operator_control struct into a message
  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 change_operator_control C-struct to read the message contents from
  96. */
  97. static inline uint16_t mavlink_msg_change_operator_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
  98. {
  99. return mavlink_msg_change_operator_control_pack(system_id, component_id, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
  100. }
  101. /**
  102. * @brief Send a change_operator_control message
  103. * @param chan MAVLink channel to send the message
  104. *
  105. * @param target_system System the GCS requests control for
  106. * @param control_request 0: request control of this MAV, 1: Release control of this MAV
  107. * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
  108. * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
  109. */
  110. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  111. static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
  112. {
  113. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  114. char buf[28];
  115. _mav_put_uint8_t(buf, 0, target_system);
  116. _mav_put_uint8_t(buf, 1, control_request);
  117. _mav_put_uint8_t(buf, 2, version);
  118. _mav_put_char_array(buf, 3, passkey, 25);
  119. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, 28);
  120. #else
  121. mavlink_change_operator_control_t packet;
  122. packet.target_system = target_system;
  123. packet.control_request = control_request;
  124. packet.version = version;
  125. memcpy(packet.passkey, passkey, sizeof(char)*25);
  126. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, 28);
  127. #endif
  128. }
  129. #endif
  130. // MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
  131. /**
  132. * @brief Get field target_system from change_operator_control message
  133. *
  134. * @return System the GCS requests control for
  135. */
  136. static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
  137. {
  138. return _MAV_RETURN_uint8_t(msg, 0);
  139. }
  140. /**
  141. * @brief Get field control_request from change_operator_control message
  142. *
  143. * @return 0: request control of this MAV, 1: Release control of this MAV
  144. */
  145. static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
  146. {
  147. return _MAV_RETURN_uint8_t(msg, 1);
  148. }
  149. /**
  150. * @brief Get field version from change_operator_control message
  151. *
  152. * @return 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
  153. */
  154. static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
  155. {
  156. return _MAV_RETURN_uint8_t(msg, 2);
  157. }
  158. /**
  159. * @brief Get field passkey from change_operator_control message
  160. *
  161. * @return Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
  162. */
  163. static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
  164. {
  165. return _MAV_RETURN_char_array(msg, passkey, 25, 3);
  166. }
  167. /**
  168. * @brief Decode a change_operator_control message into a struct
  169. *
  170. * @param msg The message to decode
  171. * @param change_operator_control C-struct to decode the message contents into
  172. */
  173. static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
  174. {
  175. #if MAVLINK_NEED_BYTE_SWAP
  176. change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
  177. change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
  178. change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
  179. mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
  180. #else
  181. memcpy(change_operator_control, _MAV_PAYLOAD(msg), 28);
  182. #endif
  183. }