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