Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
MAVlink/include/pixhawk/mavlink_msg_watchdog_process_info.h@0:826c6171fc1b, 2012-06-20 (annotated)
- Committer:
- shimniok
- Date:
- Wed Jun 20 14:57:48 2012 +0000
- Revision:
- 0:826c6171fc1b
Updated documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:826c6171fc1b | 1 | // MESSAGE WATCHDOG_PROCESS_INFO PACKING |
shimniok | 0:826c6171fc1b | 2 | |
shimniok | 0:826c6171fc1b | 3 | #define MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO 151 |
shimniok | 0:826c6171fc1b | 4 | |
shimniok | 0:826c6171fc1b | 5 | typedef struct __mavlink_watchdog_process_info_t |
shimniok | 0:826c6171fc1b | 6 | { |
shimniok | 0:826c6171fc1b | 7 | uint16_t watchdog_id; ///< Watchdog ID |
shimniok | 0:826c6171fc1b | 8 | uint16_t process_id; ///< Process ID |
shimniok | 0:826c6171fc1b | 9 | int8_t name[100]; ///< Process name |
shimniok | 0:826c6171fc1b | 10 | int8_t arguments[147]; ///< Process arguments |
shimniok | 0:826c6171fc1b | 11 | int32_t timeout; ///< Timeout (seconds) |
shimniok | 0:826c6171fc1b | 12 | |
shimniok | 0:826c6171fc1b | 13 | } mavlink_watchdog_process_info_t; |
shimniok | 0:826c6171fc1b | 14 | |
shimniok | 0:826c6171fc1b | 15 | #define MAVLINK_MSG_WATCHDOG_PROCESS_INFO_FIELD_NAME_LEN 100 |
shimniok | 0:826c6171fc1b | 16 | #define MAVLINK_MSG_WATCHDOG_PROCESS_INFO_FIELD_ARGUMENTS_LEN 147 |
shimniok | 0:826c6171fc1b | 17 | |
shimniok | 0:826c6171fc1b | 18 | |
shimniok | 0:826c6171fc1b | 19 | /** |
shimniok | 0:826c6171fc1b | 20 | * @brief Pack a watchdog_process_info message |
shimniok | 0:826c6171fc1b | 21 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 22 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 23 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 24 | * |
shimniok | 0:826c6171fc1b | 25 | * @param watchdog_id Watchdog ID |
shimniok | 0:826c6171fc1b | 26 | * @param process_id Process ID |
shimniok | 0:826c6171fc1b | 27 | * @param name Process name |
shimniok | 0:826c6171fc1b | 28 | * @param arguments Process arguments |
shimniok | 0:826c6171fc1b | 29 | * @param timeout Timeout (seconds) |
shimniok | 0:826c6171fc1b | 30 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 31 | */ |
shimniok | 0:826c6171fc1b | 32 | static inline uint16_t mavlink_msg_watchdog_process_info_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint16_t watchdog_id, uint16_t process_id, const int8_t* name, const int8_t* arguments, int32_t timeout) |
shimniok | 0:826c6171fc1b | 33 | { |
shimniok | 0:826c6171fc1b | 34 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 35 | msg->msgid = MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO; |
shimniok | 0:826c6171fc1b | 36 | |
shimniok | 0:826c6171fc1b | 37 | i += put_uint16_t_by_index(watchdog_id, i, msg->payload); // Watchdog ID |
shimniok | 0:826c6171fc1b | 38 | i += put_uint16_t_by_index(process_id, i, msg->payload); // Process ID |
shimniok | 0:826c6171fc1b | 39 | i += put_array_by_index(name, 100, i, msg->payload); // Process name |
shimniok | 0:826c6171fc1b | 40 | i += put_array_by_index(arguments, 147, i, msg->payload); // Process arguments |
shimniok | 0:826c6171fc1b | 41 | i += put_int32_t_by_index(timeout, i, msg->payload); // Timeout (seconds) |
shimniok | 0:826c6171fc1b | 42 | |
shimniok | 0:826c6171fc1b | 43 | return mavlink_finalize_message(msg, system_id, component_id, i); |
shimniok | 0:826c6171fc1b | 44 | } |
shimniok | 0:826c6171fc1b | 45 | |
shimniok | 0:826c6171fc1b | 46 | /** |
shimniok | 0:826c6171fc1b | 47 | * @brief Pack a watchdog_process_info message |
shimniok | 0:826c6171fc1b | 48 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 49 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 50 | * @param chan The MAVLink channel this message was sent over |
shimniok | 0:826c6171fc1b | 51 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 52 | * @param watchdog_id Watchdog ID |
shimniok | 0:826c6171fc1b | 53 | * @param process_id Process ID |
shimniok | 0:826c6171fc1b | 54 | * @param name Process name |
shimniok | 0:826c6171fc1b | 55 | * @param arguments Process arguments |
shimniok | 0:826c6171fc1b | 56 | * @param timeout Timeout (seconds) |
shimniok | 0:826c6171fc1b | 57 | * @return length of the message in bytes (excluding serial stream start sign) |
shimniok | 0:826c6171fc1b | 58 | */ |
shimniok | 0:826c6171fc1b | 59 | static inline uint16_t mavlink_msg_watchdog_process_info_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint16_t watchdog_id, uint16_t process_id, const int8_t* name, const int8_t* arguments, int32_t timeout) |
shimniok | 0:826c6171fc1b | 60 | { |
shimniok | 0:826c6171fc1b | 61 | uint16_t i = 0; |
shimniok | 0:826c6171fc1b | 62 | msg->msgid = MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO; |
shimniok | 0:826c6171fc1b | 63 | |
shimniok | 0:826c6171fc1b | 64 | i += put_uint16_t_by_index(watchdog_id, i, msg->payload); // Watchdog ID |
shimniok | 0:826c6171fc1b | 65 | i += put_uint16_t_by_index(process_id, i, msg->payload); // Process ID |
shimniok | 0:826c6171fc1b | 66 | i += put_array_by_index(name, 100, i, msg->payload); // Process name |
shimniok | 0:826c6171fc1b | 67 | i += put_array_by_index(arguments, 147, i, msg->payload); // Process arguments |
shimniok | 0:826c6171fc1b | 68 | i += put_int32_t_by_index(timeout, i, msg->payload); // Timeout (seconds) |
shimniok | 0:826c6171fc1b | 69 | |
shimniok | 0:826c6171fc1b | 70 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); |
shimniok | 0:826c6171fc1b | 71 | } |
shimniok | 0:826c6171fc1b | 72 | |
shimniok | 0:826c6171fc1b | 73 | /** |
shimniok | 0:826c6171fc1b | 74 | * @brief Encode a watchdog_process_info struct into a message |
shimniok | 0:826c6171fc1b | 75 | * |
shimniok | 0:826c6171fc1b | 76 | * @param system_id ID of this system |
shimniok | 0:826c6171fc1b | 77 | * @param component_id ID of this component (e.g. 200 for IMU) |
shimniok | 0:826c6171fc1b | 78 | * @param msg The MAVLink message to compress the data into |
shimniok | 0:826c6171fc1b | 79 | * @param watchdog_process_info C-struct to read the message contents from |
shimniok | 0:826c6171fc1b | 80 | */ |
shimniok | 0:826c6171fc1b | 81 | static inline uint16_t mavlink_msg_watchdog_process_info_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_watchdog_process_info_t* watchdog_process_info) |
shimniok | 0:826c6171fc1b | 82 | { |
shimniok | 0:826c6171fc1b | 83 | return mavlink_msg_watchdog_process_info_pack(system_id, component_id, msg, watchdog_process_info->watchdog_id, watchdog_process_info->process_id, watchdog_process_info->name, watchdog_process_info->arguments, watchdog_process_info->timeout); |
shimniok | 0:826c6171fc1b | 84 | } |
shimniok | 0:826c6171fc1b | 85 | |
shimniok | 0:826c6171fc1b | 86 | /** |
shimniok | 0:826c6171fc1b | 87 | * @brief Send a watchdog_process_info message |
shimniok | 0:826c6171fc1b | 88 | * @param chan MAVLink channel to send the message |
shimniok | 0:826c6171fc1b | 89 | * |
shimniok | 0:826c6171fc1b | 90 | * @param watchdog_id Watchdog ID |
shimniok | 0:826c6171fc1b | 91 | * @param process_id Process ID |
shimniok | 0:826c6171fc1b | 92 | * @param name Process name |
shimniok | 0:826c6171fc1b | 93 | * @param arguments Process arguments |
shimniok | 0:826c6171fc1b | 94 | * @param timeout Timeout (seconds) |
shimniok | 0:826c6171fc1b | 95 | */ |
shimniok | 0:826c6171fc1b | 96 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
shimniok | 0:826c6171fc1b | 97 | |
shimniok | 0:826c6171fc1b | 98 | static inline void mavlink_msg_watchdog_process_info_send(mavlink_channel_t chan, uint16_t watchdog_id, uint16_t process_id, const int8_t* name, const int8_t* arguments, int32_t timeout) |
shimniok | 0:826c6171fc1b | 99 | { |
shimniok | 0:826c6171fc1b | 100 | mavlink_message_t msg; |
shimniok | 0:826c6171fc1b | 101 | mavlink_msg_watchdog_process_info_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, watchdog_id, process_id, name, arguments, timeout); |
shimniok | 0:826c6171fc1b | 102 | mavlink_send_uart(chan, &msg); |
shimniok | 0:826c6171fc1b | 103 | } |
shimniok | 0:826c6171fc1b | 104 | |
shimniok | 0:826c6171fc1b | 105 | #endif |
shimniok | 0:826c6171fc1b | 106 | // MESSAGE WATCHDOG_PROCESS_INFO UNPACKING |
shimniok | 0:826c6171fc1b | 107 | |
shimniok | 0:826c6171fc1b | 108 | /** |
shimniok | 0:826c6171fc1b | 109 | * @brief Get field watchdog_id from watchdog_process_info message |
shimniok | 0:826c6171fc1b | 110 | * |
shimniok | 0:826c6171fc1b | 111 | * @return Watchdog ID |
shimniok | 0:826c6171fc1b | 112 | */ |
shimniok | 0:826c6171fc1b | 113 | static inline uint16_t mavlink_msg_watchdog_process_info_get_watchdog_id(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 114 | { |
shimniok | 0:826c6171fc1b | 115 | generic_16bit r; |
shimniok | 0:826c6171fc1b | 116 | r.b[1] = (msg->payload)[0]; |
shimniok | 0:826c6171fc1b | 117 | r.b[0] = (msg->payload)[1]; |
shimniok | 0:826c6171fc1b | 118 | return (uint16_t)r.s; |
shimniok | 0:826c6171fc1b | 119 | } |
shimniok | 0:826c6171fc1b | 120 | |
shimniok | 0:826c6171fc1b | 121 | /** |
shimniok | 0:826c6171fc1b | 122 | * @brief Get field process_id from watchdog_process_info message |
shimniok | 0:826c6171fc1b | 123 | * |
shimniok | 0:826c6171fc1b | 124 | * @return Process ID |
shimniok | 0:826c6171fc1b | 125 | */ |
shimniok | 0:826c6171fc1b | 126 | static inline uint16_t mavlink_msg_watchdog_process_info_get_process_id(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 127 | { |
shimniok | 0:826c6171fc1b | 128 | generic_16bit r; |
shimniok | 0:826c6171fc1b | 129 | r.b[1] = (msg->payload+sizeof(uint16_t))[0]; |
shimniok | 0:826c6171fc1b | 130 | r.b[0] = (msg->payload+sizeof(uint16_t))[1]; |
shimniok | 0:826c6171fc1b | 131 | return (uint16_t)r.s; |
shimniok | 0:826c6171fc1b | 132 | } |
shimniok | 0:826c6171fc1b | 133 | |
shimniok | 0:826c6171fc1b | 134 | /** |
shimniok | 0:826c6171fc1b | 135 | * @brief Get field name from watchdog_process_info message |
shimniok | 0:826c6171fc1b | 136 | * |
shimniok | 0:826c6171fc1b | 137 | * @return Process name |
shimniok | 0:826c6171fc1b | 138 | */ |
shimniok | 0:826c6171fc1b | 139 | static inline uint16_t mavlink_msg_watchdog_process_info_get_name(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 140 | { |
shimniok | 0:826c6171fc1b | 141 | |
shimniok | 0:826c6171fc1b | 142 | memcpy(r_data, msg->payload+sizeof(uint16_t)+sizeof(uint16_t), 100); |
shimniok | 0:826c6171fc1b | 143 | return 100; |
shimniok | 0:826c6171fc1b | 144 | } |
shimniok | 0:826c6171fc1b | 145 | |
shimniok | 0:826c6171fc1b | 146 | /** |
shimniok | 0:826c6171fc1b | 147 | * @brief Get field arguments from watchdog_process_info message |
shimniok | 0:826c6171fc1b | 148 | * |
shimniok | 0:826c6171fc1b | 149 | * @return Process arguments |
shimniok | 0:826c6171fc1b | 150 | */ |
shimniok | 0:826c6171fc1b | 151 | static inline uint16_t mavlink_msg_watchdog_process_info_get_arguments(const mavlink_message_t* msg, int8_t* r_data) |
shimniok | 0:826c6171fc1b | 152 | { |
shimniok | 0:826c6171fc1b | 153 | |
shimniok | 0:826c6171fc1b | 154 | memcpy(r_data, msg->payload+sizeof(uint16_t)+sizeof(uint16_t)+100, 147); |
shimniok | 0:826c6171fc1b | 155 | return 147; |
shimniok | 0:826c6171fc1b | 156 | } |
shimniok | 0:826c6171fc1b | 157 | |
shimniok | 0:826c6171fc1b | 158 | /** |
shimniok | 0:826c6171fc1b | 159 | * @brief Get field timeout from watchdog_process_info message |
shimniok | 0:826c6171fc1b | 160 | * |
shimniok | 0:826c6171fc1b | 161 | * @return Timeout (seconds) |
shimniok | 0:826c6171fc1b | 162 | */ |
shimniok | 0:826c6171fc1b | 163 | static inline int32_t mavlink_msg_watchdog_process_info_get_timeout(const mavlink_message_t* msg) |
shimniok | 0:826c6171fc1b | 164 | { |
shimniok | 0:826c6171fc1b | 165 | generic_32bit r; |
shimniok | 0:826c6171fc1b | 166 | r.b[3] = (msg->payload+sizeof(uint16_t)+sizeof(uint16_t)+100+147)[0]; |
shimniok | 0:826c6171fc1b | 167 | r.b[2] = (msg->payload+sizeof(uint16_t)+sizeof(uint16_t)+100+147)[1]; |
shimniok | 0:826c6171fc1b | 168 | r.b[1] = (msg->payload+sizeof(uint16_t)+sizeof(uint16_t)+100+147)[2]; |
shimniok | 0:826c6171fc1b | 169 | r.b[0] = (msg->payload+sizeof(uint16_t)+sizeof(uint16_t)+100+147)[3]; |
shimniok | 0:826c6171fc1b | 170 | return (int32_t)r.i; |
shimniok | 0:826c6171fc1b | 171 | } |
shimniok | 0:826c6171fc1b | 172 | |
shimniok | 0:826c6171fc1b | 173 | /** |
shimniok | 0:826c6171fc1b | 174 | * @brief Decode a watchdog_process_info message into a struct |
shimniok | 0:826c6171fc1b | 175 | * |
shimniok | 0:826c6171fc1b | 176 | * @param msg The message to decode |
shimniok | 0:826c6171fc1b | 177 | * @param watchdog_process_info C-struct to decode the message contents into |
shimniok | 0:826c6171fc1b | 178 | */ |
shimniok | 0:826c6171fc1b | 179 | static inline void mavlink_msg_watchdog_process_info_decode(const mavlink_message_t* msg, mavlink_watchdog_process_info_t* watchdog_process_info) |
shimniok | 0:826c6171fc1b | 180 | { |
shimniok | 0:826c6171fc1b | 181 | watchdog_process_info->watchdog_id = mavlink_msg_watchdog_process_info_get_watchdog_id(msg); |
shimniok | 0:826c6171fc1b | 182 | watchdog_process_info->process_id = mavlink_msg_watchdog_process_info_get_process_id(msg); |
shimniok | 0:826c6171fc1b | 183 | mavlink_msg_watchdog_process_info_get_name(msg, watchdog_process_info->name); |
shimniok | 0:826c6171fc1b | 184 | mavlink_msg_watchdog_process_info_get_arguments(msg, watchdog_process_info->arguments); |
shimniok | 0:826c6171fc1b | 185 | watchdog_process_info->timeout = mavlink_msg_watchdog_process_info_get_timeout(msg); |
shimniok | 0:826c6171fc1b | 186 | } |