NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_pattern_detected.h
Go to the documentation of this file.
1 // MESSAGE PATTERN_DETECTED PACKING
2 
3 #define MAVLINK_MSG_ID_PATTERN_DETECTED 190
4 
6 {
7  float confidence;
8  uint8_t type;
9  char file[100];
10  uint8_t detected;
12 
13 #define MAVLINK_MSG_ID_PATTERN_DETECTED_LEN 106
14 #define MAVLINK_MSG_ID_190_LEN 106
15 
16 #define MAVLINK_MSG_ID_PATTERN_DETECTED_CRC 90
17 #define MAVLINK_MSG_ID_190_CRC 90
18 
19 #define MAVLINK_MSG_PATTERN_DETECTED_FIELD_FILE_LEN 100
20 
21 #define MAVLINK_MESSAGE_INFO_PATTERN_DETECTED { \
22  "PATTERN_DETECTED", \
23  4, \
24  { { "confidence", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_pattern_detected_t, confidence) }, \
25  { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_pattern_detected_t, type) }, \
26  { "file", NULL, MAVLINK_TYPE_CHAR, 100, 5, offsetof(mavlink_pattern_detected_t, file) }, \
27  { "detected", NULL, MAVLINK_TYPE_UINT8_T, 0, 105, offsetof(mavlink_pattern_detected_t, detected) }, \
28  } \
29 }
30 
31 
44 static inline uint16_t mavlink_msg_pattern_detected_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45  uint8_t type, float confidence, const char *file, uint8_t detected)
46 {
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
49  _mav_put_float(buf, 0, confidence);
50  _mav_put_uint8_t(buf, 4, type);
51  _mav_put_uint8_t(buf, 105, detected);
52  _mav_put_char_array(buf, 5, file, 100);
54 #else
56  packet.confidence = confidence;
57  packet.type = type;
58  packet.detected = detected;
59  mav_array_memcpy(packet.file, file, sizeof(char)*100);
61 #endif
62 
64 #if MAVLINK_CRC_EXTRA
66 #else
67  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
68 #endif
69 }
70 
83 static inline uint16_t mavlink_msg_pattern_detected_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
84  mavlink_message_t* msg,
85  uint8_t type,float confidence,const char *file,uint8_t detected)
86 {
87 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89  _mav_put_float(buf, 0, confidence);
90  _mav_put_uint8_t(buf, 4, type);
91  _mav_put_uint8_t(buf, 105, detected);
92  _mav_put_char_array(buf, 5, file, 100);
94 #else
96  packet.confidence = confidence;
97  packet.type = type;
98  packet.detected = detected;
99  mav_array_memcpy(packet.file, file, sizeof(char)*100);
101 #endif
102 
103  msg->msgid = MAVLINK_MSG_ID_PATTERN_DETECTED;
104 #if MAVLINK_CRC_EXTRA
106 #else
107  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
108 #endif
109 }
110 
119 static inline uint16_t mavlink_msg_pattern_detected_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_pattern_detected_t* pattern_detected)
120 {
121  return mavlink_msg_pattern_detected_pack(system_id, component_id, msg, pattern_detected->type, pattern_detected->confidence, pattern_detected->file, pattern_detected->detected);
122 }
123 
133 static inline uint16_t mavlink_msg_pattern_detected_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_pattern_detected_t* pattern_detected)
134 {
135  return mavlink_msg_pattern_detected_pack_chan(system_id, component_id, chan, msg, pattern_detected->type, pattern_detected->confidence, pattern_detected->file, pattern_detected->detected);
136 }
137 
147 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
148 
149 static inline void mavlink_msg_pattern_detected_send(mavlink_channel_t chan, uint8_t type, float confidence, const char *file, uint8_t detected)
150 {
151 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
153  _mav_put_float(buf, 0, confidence);
154  _mav_put_uint8_t(buf, 4, type);
155  _mav_put_uint8_t(buf, 105, detected);
156  _mav_put_char_array(buf, 5, file, 100);
157 #if MAVLINK_CRC_EXTRA
159 #else
160  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, buf, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
161 #endif
162 #else
164  packet.confidence = confidence;
165  packet.type = type;
166  packet.detected = detected;
167  mav_array_memcpy(packet.file, file, sizeof(char)*100);
168 #if MAVLINK_CRC_EXTRA
169  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, (const char *)&packet, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN, MAVLINK_MSG_ID_PATTERN_DETECTED_CRC);
170 #else
171  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, (const char *)&packet, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
172 #endif
173 #endif
174 }
175 
176 #if MAVLINK_MSG_ID_PATTERN_DETECTED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
177 /*
178  This varient of _send() can be used to save stack space by re-using
179  memory from the receive buffer. The caller provides a
180  mavlink_message_t which is the size of a full mavlink message. This
181  is usually the receive buffer for the channel, and allows a reply to an
182  incoming message with minimum stack space usage.
183  */
184 static inline void mavlink_msg_pattern_detected_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, float confidence, const char *file, uint8_t detected)
185 {
186 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
187  char *buf = (char *)msgbuf;
188  _mav_put_float(buf, 0, confidence);
189  _mav_put_uint8_t(buf, 4, type);
190  _mav_put_uint8_t(buf, 105, detected);
191  _mav_put_char_array(buf, 5, file, 100);
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, buf, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
196 #endif
197 #else
199  packet->confidence = confidence;
200  packet->type = type;
201  packet->detected = detected;
202  mav_array_memcpy(packet->file, file, sizeof(char)*100);
203 #if MAVLINK_CRC_EXTRA
204  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, (const char *)packet, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN, MAVLINK_MSG_ID_PATTERN_DETECTED_CRC);
205 #else
206  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PATTERN_DETECTED, (const char *)packet, MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
207 #endif
208 #endif
209 }
210 #endif
211 
212 #endif
213 
214 // MESSAGE PATTERN_DETECTED UNPACKING
215 
216 
222 static inline uint8_t mavlink_msg_pattern_detected_get_type(const mavlink_message_t* msg)
223 {
224  return _MAV_RETURN_uint8_t(msg, 4);
225 }
226 
232 static inline float mavlink_msg_pattern_detected_get_confidence(const mavlink_message_t* msg)
233 {
234  return _MAV_RETURN_float(msg, 0);
235 }
236 
242 static inline uint16_t mavlink_msg_pattern_detected_get_file(const mavlink_message_t* msg, char *file)
243 {
244  return _MAV_RETURN_char_array(msg, file, 100, 5);
245 }
246 
252 static inline uint8_t mavlink_msg_pattern_detected_get_detected(const mavlink_message_t* msg)
253 {
254  return _MAV_RETURN_uint8_t(msg, 105);
255 }
256 
263 static inline void mavlink_msg_pattern_detected_decode(const mavlink_message_t* msg, mavlink_pattern_detected_t* pattern_detected)
264 {
265 #if MAVLINK_NEED_BYTE_SWAP
266  pattern_detected->confidence = mavlink_msg_pattern_detected_get_confidence(msg);
267  pattern_detected->type = mavlink_msg_pattern_detected_get_type(msg);
268  mavlink_msg_pattern_detected_get_file(msg, pattern_detected->file);
269  pattern_detected->detected = mavlink_msg_pattern_detected_get_detected(msg);
270 #else
271  memcpy(pattern_detected, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_PATTERN_DETECTED_LEN);
272 #endif
273 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
uint8_t type
Definition: fat_standard.h:67
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134