NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_novatel_diag.h
Go to the documentation of this file.
1 // MESSAGE NOVATEL_DIAG PACKING
2 
3 #define MAVLINK_MSG_ID_NOVATEL_DIAG 195
4 
6 {
7  uint32_t receiverStatus;
8  float posSolAge;
9  uint16_t csFails;
10  uint8_t timeStatus;
11  uint8_t solStatus;
12  uint8_t posType;
13  uint8_t velType;
15 
16 #define MAVLINK_MSG_ID_NOVATEL_DIAG_LEN 14
17 #define MAVLINK_MSG_ID_195_LEN 14
18 
19 #define MAVLINK_MSG_ID_NOVATEL_DIAG_CRC 59
20 #define MAVLINK_MSG_ID_195_CRC 59
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_NOVATEL_DIAG { \
25  "NOVATEL_DIAG", \
26  7, \
27  { { "receiverStatus", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_novatel_diag_t, receiverStatus) }, \
28  { "posSolAge", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_novatel_diag_t, posSolAge) }, \
29  { "csFails", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_novatel_diag_t, csFails) }, \
30  { "timeStatus", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_novatel_diag_t, timeStatus) }, \
31  { "solStatus", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_novatel_diag_t, solStatus) }, \
32  { "posType", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_novatel_diag_t, posType) }, \
33  { "velType", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_novatel_diag_t, velType) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_novatel_diag_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint8_t timeStatus, uint32_t receiverStatus, uint8_t solStatus, uint8_t posType, uint8_t velType, float posSolAge, uint16_t csFails)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_uint32_t(buf, 0, receiverStatus);
59  _mav_put_float(buf, 4, posSolAge);
60  _mav_put_uint16_t(buf, 8, csFails);
61  _mav_put_uint8_t(buf, 10, timeStatus);
62  _mav_put_uint8_t(buf, 11, solStatus);
63  _mav_put_uint8_t(buf, 12, posType);
64  _mav_put_uint8_t(buf, 13, velType);
65 
67 #else
69  packet.receiverStatus = receiverStatus;
70  packet.posSolAge = posSolAge;
71  packet.csFails = csFails;
72  packet.timeStatus = timeStatus;
73  packet.solStatus = solStatus;
74  packet.posType = posType;
75  packet.velType = velType;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_NOVATEL_DIAG;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_novatel_diag_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint8_t timeStatus,uint32_t receiverStatus,uint8_t solStatus,uint8_t posType,uint8_t velType,float posSolAge,uint16_t csFails)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_uint32_t(buf, 0, receiverStatus);
110  _mav_put_float(buf, 4, posSolAge);
111  _mav_put_uint16_t(buf, 8, csFails);
112  _mav_put_uint8_t(buf, 10, timeStatus);
113  _mav_put_uint8_t(buf, 11, solStatus);
114  _mav_put_uint8_t(buf, 12, posType);
115  _mav_put_uint8_t(buf, 13, velType);
116 
118 #else
119  mavlink_novatel_diag_t packet;
120  packet.receiverStatus = receiverStatus;
121  packet.posSolAge = posSolAge;
122  packet.csFails = csFails;
123  packet.timeStatus = timeStatus;
124  packet.solStatus = solStatus;
125  packet.posType = posType;
126  packet.velType = velType;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_NOVATEL_DIAG;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_novatel_diag_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_novatel_diag_t* novatel_diag)
148 {
149  return mavlink_msg_novatel_diag_pack(system_id, component_id, msg, novatel_diag->timeStatus, novatel_diag->receiverStatus, novatel_diag->solStatus, novatel_diag->posType, novatel_diag->velType, novatel_diag->posSolAge, novatel_diag->csFails);
150 }
151 
161 static inline uint16_t mavlink_msg_novatel_diag_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_novatel_diag_t* novatel_diag)
162 {
163  return mavlink_msg_novatel_diag_pack_chan(system_id, component_id, chan, msg, novatel_diag->timeStatus, novatel_diag->receiverStatus, novatel_diag->solStatus, novatel_diag->posType, novatel_diag->velType, novatel_diag->posSolAge, novatel_diag->csFails);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_novatel_diag_send(mavlink_channel_t chan, uint8_t timeStatus, uint32_t receiverStatus, uint8_t solStatus, uint8_t posType, uint8_t velType, float posSolAge, uint16_t csFails)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_uint32_t(buf, 0, receiverStatus);
185  _mav_put_float(buf, 4, posSolAge);
186  _mav_put_uint16_t(buf, 8, csFails);
187  _mav_put_uint8_t(buf, 10, timeStatus);
188  _mav_put_uint8_t(buf, 11, solStatus);
189  _mav_put_uint8_t(buf, 12, posType);
190  _mav_put_uint8_t(buf, 13, velType);
191 
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, buf, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
196 #endif
197 #else
198  mavlink_novatel_diag_t packet;
199  packet.receiverStatus = receiverStatus;
200  packet.posSolAge = posSolAge;
201  packet.csFails = csFails;
202  packet.timeStatus = timeStatus;
203  packet.solStatus = solStatus;
204  packet.posType = posType;
205  packet.velType = velType;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, (const char *)&packet, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN, MAVLINK_MSG_ID_NOVATEL_DIAG_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, (const char *)&packet, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_NOVATEL_DIAG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static inline void mavlink_msg_novatel_diag_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t timeStatus, uint32_t receiverStatus, uint8_t solStatus, uint8_t posType, uint8_t velType, float posSolAge, uint16_t csFails)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_uint32_t(buf, 0, receiverStatus);
228  _mav_put_float(buf, 4, posSolAge);
229  _mav_put_uint16_t(buf, 8, csFails);
230  _mav_put_uint8_t(buf, 10, timeStatus);
231  _mav_put_uint8_t(buf, 11, solStatus);
232  _mav_put_uint8_t(buf, 12, posType);
233  _mav_put_uint8_t(buf, 13, velType);
234 
235 #if MAVLINK_CRC_EXTRA
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, buf, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
239 #endif
240 #else
242  packet->receiverStatus = receiverStatus;
243  packet->posSolAge = posSolAge;
244  packet->csFails = csFails;
245  packet->timeStatus = timeStatus;
246  packet->solStatus = solStatus;
247  packet->posType = posType;
248  packet->velType = velType;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, (const char *)packet, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN, MAVLINK_MSG_ID_NOVATEL_DIAG_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NOVATEL_DIAG, (const char *)packet, MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE NOVATEL_DIAG UNPACKING
262 
263 
269 static inline uint8_t mavlink_msg_novatel_diag_get_timeStatus(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint8_t(msg, 10);
272 }
273 
279 static inline uint32_t mavlink_msg_novatel_diag_get_receiverStatus(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_uint32_t(msg, 0);
282 }
283 
289 static inline uint8_t mavlink_msg_novatel_diag_get_solStatus(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_uint8_t(msg, 11);
292 }
293 
299 static inline uint8_t mavlink_msg_novatel_diag_get_posType(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_uint8_t(msg, 12);
302 }
303 
309 static inline uint8_t mavlink_msg_novatel_diag_get_velType(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_uint8_t(msg, 13);
312 }
313 
319 static inline float mavlink_msg_novatel_diag_get_posSolAge(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_float(msg, 4);
322 }
323 
329 static inline uint16_t mavlink_msg_novatel_diag_get_csFails(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_uint16_t(msg, 8);
332 }
333 
340 static inline void mavlink_msg_novatel_diag_decode(const mavlink_message_t* msg, mavlink_novatel_diag_t* novatel_diag)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  novatel_diag->receiverStatus = mavlink_msg_novatel_diag_get_receiverStatus(msg);
344  novatel_diag->posSolAge = mavlink_msg_novatel_diag_get_posSolAge(msg);
345  novatel_diag->csFails = mavlink_msg_novatel_diag_get_csFails(msg);
346  novatel_diag->timeStatus = mavlink_msg_novatel_diag_get_timeStatus(msg);
347  novatel_diag->solStatus = mavlink_msg_novatel_diag_get_solStatus(msg);
348  novatel_diag->posType = mavlink_msg_novatel_diag_get_posType(msg);
349  novatel_diag->velType = mavlink_msg_novatel_diag_get_velType(msg);
350 #else
351  memcpy(novatel_diag, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_NOVATEL_DIAG_LEN);
352 #endif
353 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#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
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141