Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
mavlink_msg_request_data_stream.h
00001 // MESSAGE REQUEST_DATA_STREAM PACKING 00002 00003 #define MAVLINK_MSG_ID_REQUEST_DATA_STREAM 66 00004 00005 typedef struct __mavlink_request_data_stream_t 00006 { 00007 uint8_t target_system; ///< The target requested to send the message stream. 00008 uint8_t target_component; ///< The target requested to send the message stream. 00009 uint8_t req_stream_id; ///< The ID of the requested message type 00010 uint16_t req_message_rate; ///< Update rate in Hertz 00011 uint8_t start_stop; ///< 1 to start sending, 0 to stop sending. 00012 00013 } mavlink_request_data_stream_t; 00014 00015 00016 00017 /** 00018 * @brief Pack a request_data_stream message 00019 * @param system_id ID of this system 00020 * @param component_id ID of this component (e.g. 200 for IMU) 00021 * @param msg The MAVLink message to compress the data into 00022 * 00023 * @param target_system The target requested to send the message stream. 00024 * @param target_component The target requested to send the message stream. 00025 * @param req_stream_id The ID of the requested message type 00026 * @param req_message_rate Update rate in Hertz 00027 * @param start_stop 1 to start sending, 0 to stop sending. 00028 * @return length of the message in bytes (excluding serial stream start sign) 00029 */ 00030 static inline uint16_t mavlink_msg_request_data_stream_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t req_stream_id, uint16_t req_message_rate, uint8_t start_stop) 00031 { 00032 uint16_t i = 0; 00033 msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; 00034 00035 i += put_uint8_t_by_index(target_system, i, msg->payload); // The target requested to send the message stream. 00036 i += put_uint8_t_by_index(target_component, i, msg->payload); // The target requested to send the message stream. 00037 i += put_uint8_t_by_index(req_stream_id, i, msg->payload); // The ID of the requested message type 00038 i += put_uint16_t_by_index(req_message_rate, i, msg->payload); // Update rate in Hertz 00039 i += put_uint8_t_by_index(start_stop, i, msg->payload); // 1 to start sending, 0 to stop sending. 00040 00041 return mavlink_finalize_message(msg, system_id, component_id, i); 00042 } 00043 00044 /** 00045 * @brief Pack a request_data_stream message 00046 * @param system_id ID of this system 00047 * @param component_id ID of this component (e.g. 200 for IMU) 00048 * @param chan The MAVLink channel this message was sent over 00049 * @param msg The MAVLink message to compress the data into 00050 * @param target_system The target requested to send the message stream. 00051 * @param target_component The target requested to send the message stream. 00052 * @param req_stream_id The ID of the requested message type 00053 * @param req_message_rate Update rate in Hertz 00054 * @param start_stop 1 to start sending, 0 to stop sending. 00055 * @return length of the message in bytes (excluding serial stream start sign) 00056 */ 00057 static inline uint16_t mavlink_msg_request_data_stream_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, uint8_t req_stream_id, uint16_t req_message_rate, uint8_t start_stop) 00058 { 00059 uint16_t i = 0; 00060 msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM; 00061 00062 i += put_uint8_t_by_index(target_system, i, msg->payload); // The target requested to send the message stream. 00063 i += put_uint8_t_by_index(target_component, i, msg->payload); // The target requested to send the message stream. 00064 i += put_uint8_t_by_index(req_stream_id, i, msg->payload); // The ID of the requested message type 00065 i += put_uint16_t_by_index(req_message_rate, i, msg->payload); // Update rate in Hertz 00066 i += put_uint8_t_by_index(start_stop, i, msg->payload); // 1 to start sending, 0 to stop sending. 00067 00068 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00069 } 00070 00071 /** 00072 * @brief Encode a request_data_stream struct into a message 00073 * 00074 * @param system_id ID of this system 00075 * @param component_id ID of this component (e.g. 200 for IMU) 00076 * @param msg The MAVLink message to compress the data into 00077 * @param request_data_stream C-struct to read the message contents from 00078 */ 00079 static inline uint16_t mavlink_msg_request_data_stream_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_request_data_stream_t* request_data_stream) 00080 { 00081 return mavlink_msg_request_data_stream_pack(system_id, component_id, msg, request_data_stream->target_system, request_data_stream->target_component, request_data_stream->req_stream_id, request_data_stream->req_message_rate, request_data_stream->start_stop); 00082 } 00083 00084 /** 00085 * @brief Send a request_data_stream message 00086 * @param chan MAVLink channel to send the message 00087 * 00088 * @param target_system The target requested to send the message stream. 00089 * @param target_component The target requested to send the message stream. 00090 * @param req_stream_id The ID of the requested message type 00091 * @param req_message_rate Update rate in Hertz 00092 * @param start_stop 1 to start sending, 0 to stop sending. 00093 */ 00094 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00095 00096 static inline void mavlink_msg_request_data_stream_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t req_stream_id, uint16_t req_message_rate, uint8_t start_stop) 00097 { 00098 mavlink_message_t msg; 00099 mavlink_msg_request_data_stream_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, req_stream_id, req_message_rate, start_stop); 00100 mavlink_send_uart(chan, &msg); 00101 } 00102 00103 #endif 00104 // MESSAGE REQUEST_DATA_STREAM UNPACKING 00105 00106 /** 00107 * @brief Get field target_system from request_data_stream message 00108 * 00109 * @return The target requested to send the message stream. 00110 */ 00111 static inline uint8_t mavlink_msg_request_data_stream_get_target_system(const mavlink_message_t* msg) 00112 { 00113 return (uint8_t)(msg->payload)[0]; 00114 } 00115 00116 /** 00117 * @brief Get field target_component from request_data_stream message 00118 * 00119 * @return The target requested to send the message stream. 00120 */ 00121 static inline uint8_t mavlink_msg_request_data_stream_get_target_component(const mavlink_message_t* msg) 00122 { 00123 return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; 00124 } 00125 00126 /** 00127 * @brief Get field req_stream_id from request_data_stream message 00128 * 00129 * @return The ID of the requested message type 00130 */ 00131 static inline uint8_t mavlink_msg_request_data_stream_get_req_stream_id(const mavlink_message_t* msg) 00132 { 00133 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t))[0]; 00134 } 00135 00136 /** 00137 * @brief Get field req_message_rate from request_data_stream message 00138 * 00139 * @return Update rate in Hertz 00140 */ 00141 static inline uint16_t mavlink_msg_request_data_stream_get_req_message_rate(const mavlink_message_t* msg) 00142 { 00143 generic_16bit r; 00144 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[0]; 00145 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t))[1]; 00146 return (uint16_t)r.s; 00147 } 00148 00149 /** 00150 * @brief Get field start_stop from request_data_stream message 00151 * 00152 * @return 1 to start sending, 0 to stop sending. 00153 */ 00154 static inline uint8_t mavlink_msg_request_data_stream_get_start_stop(const mavlink_message_t* msg) 00155 { 00156 return (uint8_t)(msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint8_t)+sizeof(uint16_t))[0]; 00157 } 00158 00159 /** 00160 * @brief Decode a request_data_stream message into a struct 00161 * 00162 * @param msg The message to decode 00163 * @param request_data_stream C-struct to decode the message contents into 00164 */ 00165 static inline void mavlink_msg_request_data_stream_decode(const mavlink_message_t* msg, mavlink_request_data_stream_t* request_data_stream) 00166 { 00167 request_data_stream->target_system = mavlink_msg_request_data_stream_get_target_system(msg); 00168 request_data_stream->target_component = mavlink_msg_request_data_stream_get_target_component(msg); 00169 request_data_stream->req_stream_id = mavlink_msg_request_data_stream_get_req_stream_id(msg); 00170 request_data_stream->req_message_rate = mavlink_msg_request_data_stream_get_req_message_rate(msg); 00171 request_data_stream->start_stop = mavlink_msg_request_data_stream_get_start_stop(msg); 00172 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2