Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
MAVlink/include/common/mavlink_msg_change_operator_control_ack.h@25:bb5356402687, 2018-11-30 (annotated)
- Committer:
- shimniok
- Date:
- Fri Nov 30 16:11:53 2018 +0000
- Revision:
- 25:bb5356402687
- Parent:
- 0:a6a169de725f
Initial publish of revised version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:a6a169de725f | 1 | // MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING |
shimniok | 0:a6a169de725f | 2 | |
shimniok | 0:a6a169de725f | 3 | #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6 |
shimniok | 0:a6a169de725f | 4 | |
shimniok | 0:a6a169de725f | 5 | typedef struct __mavlink_change_operator_control_ack_t |
shimniok | 0:a6a169de725f | 6 | { |
shimniok | 0:a6a169de725f | 7 | uint8_t gcs_system_id; ///< ID of the GCS this message |
shimniok | 0:a6a169de725f | 8 | uint8_t control_request; ///< 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 9 | uint8_t ack; ///< 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 10 | |
shimniok | 0:a6a169de725f | 11 | } mavlink_change_operator_control_ack_t; |
shimniok | 0:a6a169de725f | 12 | |
shimniok | 0:a6a169de725f | 13 | |
shimniok | 0:a6a169de725f | 14 | |
shimniok | 0:a6a169de725f | 15 | /** |
shimniok | 0:a6a169de725f | 16 | * @brief Pack a change_operator_control_ack message |
shimniok | 0:a6a169de725f | 17 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 18 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 19 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 20 | * |
shimniok | 0:a6a169de725f | 21 | * @param gcs_system_id ID of the GCS this message |
shimniok | 0:a6a169de725f | 22 | * @param control_request 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 23 | * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 24 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:a6a169de725f | 25 | */ |
shimniok | 0:a6a169de725f | 26 | static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack) |
shimniok | 0:a6a169de725f | 27 | { |
shimniok | 0:a6a169de725f | 28 | uint16_t i = 0; |
shimniok | 0:a6a169de725f | 29 | msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; |
shimniok | 0:a6a169de725f | 30 | |
shimniok | 0:a6a169de725f | 31 | i += put_uint8_t_by_index(gcs_system_id, i, msg->payload); // ID of the GCS this message |
shimniok | 0:a6a169de725f | 32 | i += put_uint8_t_by_index(control_request, i, msg->payload); // 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 33 | i += put_uint8_t_by_index(ack, i, msg->payload); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 34 | |
shimniok | 0:a6a169de725f | 35 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:a6a169de725f | 36 | } |
shimniok | 0:a6a169de725f | 37 | |
shimniok | 0:a6a169de725f | 38 | /** |
shimniok | 0:a6a169de725f | 39 | * @brief Pack a change_operator_control_ack message |
shimniok | 0:a6a169de725f | 40 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 41 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 42 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:a6a169de725f | 43 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 44 | * @param gcs_system_id ID of the GCS this message |
shimniok | 0:a6a169de725f | 45 | * @param control_request 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 46 | * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 47 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:a6a169de725f | 48 | */ |
shimniok | 0:a6a169de725f | 49 | static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack) |
shimniok | 0:a6a169de725f | 50 | { |
shimniok | 0:a6a169de725f | 51 | uint16_t i = 0; |
shimniok | 0:a6a169de725f | 52 | msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK; |
shimniok | 0:a6a169de725f | 53 | |
shimniok | 0:a6a169de725f | 54 | i += put_uint8_t_by_index(gcs_system_id, i, msg->payload); // ID of the GCS this message |
shimniok | 0:a6a169de725f | 55 | i += put_uint8_t_by_index(control_request, i, msg->payload); // 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 56 | i += put_uint8_t_by_index(ack, i, msg->payload); // 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 57 | |
shimniok | 0:a6a169de725f | 58 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:a6a169de725f | 59 | } |
shimniok | 0:a6a169de725f | 60 | |
shimniok | 0:a6a169de725f | 61 | /** |
shimniok | 0:a6a169de725f | 62 | * @brief Encode a change_operator_control_ack struct into a message |
shimniok | 0:a6a169de725f | 63 | * |
shimniok | 0:a6a169de725f | 64 | * @param system_id ID of this system |
shimniok | 0:a6a169de725f | 65 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:a6a169de725f | 66 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:a6a169de725f | 67 | * @param change_operator_control_ack C-struct to read the message contents from |
shimniok | 0:a6a169de725f | 68 | */ |
shimniok | 0:a6a169de725f | 69 | static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack) |
shimniok | 0:a6a169de725f | 70 | { |
shimniok | 0:a6a169de725f | 71 | return mavlink_msg_change_operator_control_ack_pack(system_id, component_id, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack); |
shimniok | 0:a6a169de725f | 72 | } |
shimniok | 0:a6a169de725f | 73 | |
shimniok | 0:a6a169de725f | 74 | /** |
shimniok | 0:a6a169de725f | 75 | * @brief Send a change_operator_control_ack message |
shimniok | 0:a6a169de725f | 76 | * @param chan MAVLink channel to send the message |
shimniok | 0:a6a169de725f | 77 | * |
shimniok | 0:a6a169de725f | 78 | * @param gcs_system_id ID of the GCS this message |
shimniok | 0:a6a169de725f | 79 | * @param control_request 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 80 | * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 81 | */ |
shimniok | 0:a6a169de725f | 82 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:a6a169de725f | 83 | |
shimniok | 0:a6a169de725f | 84 | static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack) |
shimniok | 0:a6a169de725f | 85 | { |
shimniok | 0:a6a169de725f | 86 | mavlink_message_t msg; |
shimniok | 0:a6a169de725f | 87 | mavlink_msg_change_operator_control_ack_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, gcs_system_id, control_request, ack); |
shimniok | 0:a6a169de725f | 88 | mavlink_send_uart(chan, &msg); |
shimniok | 0:a6a169de725f | 89 | } |
shimniok | 0:a6a169de725f | 90 | |
shimniok | 0:a6a169de725f | 91 | #endif |
shimniok | 0:a6a169de725f | 92 | // MESSAGE CHANGE_OPERATOR_CONTROL_ACK UNPACKING |
shimniok | 0:a6a169de725f | 93 | |
shimniok | 0:a6a169de725f | 94 | /** |
shimniok | 0:a6a169de725f | 95 | * @brief Get field gcs_system_id from change_operator_control_ack message |
shimniok | 0:a6a169de725f | 96 | * |
shimniok | 0:a6a169de725f | 97 | * @return ID of the GCS this message |
shimniok | 0:a6a169de725f | 98 | */ |
shimniok | 0:a6a169de725f | 99 | static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 100 | { |
shimniok | 0:a6a169de725f | 101 | return (uint8_t)(msg->payload)[0]; |
shimniok | 0:a6a169de725f | 102 | } |
shimniok | 0:a6a169de725f | 103 | |
shimniok | 0:a6a169de725f | 104 | /** |
shimniok | 0:a6a169de725f | 105 | * @brief Get field control_request from change_operator_control_ack message |
shimniok | 0:a6a169de725f | 106 | * |
shimniok | 0:a6a169de725f | 107 | * @return 0: request control of this MAV, 1: Release control of this MAV |
shimniok | 0:a6a169de725f | 108 | */ |
shimniok | 0:a6a169de725f | 109 | static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_request(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 110 | { |
shimniok | 0:a6a169de725f | 111 | return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; |
shimniok | 0:a6a169de725f | 112 | } |
shimniok | 0:a6a169de725f | 113 | |
shimniok | 0:a6a169de725f | 114 | /** |
shimniok | 0:a6a169de725f | 115 | * @brief Get field ack from change_operator_control_ack message |
shimniok | 0:a6a169de725f | 116 | * |
shimniok | 0:a6a169de725f | 117 | * @return 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control |
shimniok | 0:a6a169de725f | 118 | */ |
shimniok | 0:a6a169de725f | 119 | static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavlink_message_t* msg) |
shimniok | 0:a6a169de725f | 120 | { |
shimniok | 0:a6a169de725f | 121 | return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0]; |
shimniok | 0:a6a169de725f | 122 | } |
shimniok | 0:a6a169de725f | 123 | |
shimniok | 0:a6a169de725f | 124 | /** |
shimniok | 0:a6a169de725f | 125 | * @brief Decode a change_operator_control_ack message into a struct |
shimniok | 0:a6a169de725f | 126 | * |
shimniok | 0:a6a169de725f | 127 | * @param msg The message to decode |
shimniok | 0:a6a169de725f | 128 | * @param change_operator_control_ack C-struct to decode the message contents into |
shimniok | 0:a6a169de725f | 129 | */ |
shimniok | 0:a6a169de725f | 130 | static inline void mavlink_msg_change_operator_control_ack_decode(const mavlink_message_t* msg, mavlink_change_operator_control_ack_t* change_operator_control_ack) |
shimniok | 0:a6a169de725f | 131 | { |
shimniok | 0:a6a169de725f | 132 | change_operator_control_ack->gcs_system_id = mavlink_msg_change_operator_control_ack_get_gcs_system_id(msg); |
shimniok | 0:a6a169de725f | 133 | change_operator_control_ack->control_request = mavlink_msg_change_operator_control_ack_get_control_request(msg); |
shimniok | 0:a6a169de725f | 134 | change_operator_control_ack->ack = mavlink_msg_change_operator_control_ack_get_ack(msg); |
shimniok | 0:a6a169de725f | 135 | } |