NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_status_gps.h
Go to the documentation of this file.
1 // MESSAGE STATUS_GPS PACKING
2 
3 #define MAVLINK_MSG_ID_STATUS_GPS 194
4 
5 typedef struct __mavlink_status_gps_t
6 {
7  float magVar;
8  uint16_t csFails;
9  uint8_t gpsQuality;
10  uint8_t msgsType;
11  uint8_t posStatus;
12  int8_t magDir;
13  uint8_t modeInd;
15 
16 #define MAVLINK_MSG_ID_STATUS_GPS_LEN 11
17 #define MAVLINK_MSG_ID_194_LEN 11
18 
19 #define MAVLINK_MSG_ID_STATUS_GPS_CRC 51
20 #define MAVLINK_MSG_ID_194_CRC 51
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_STATUS_GPS { \
25  "STATUS_GPS", \
26  7, \
27  { { "magVar", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_status_gps_t, magVar) }, \
28  { "csFails", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_status_gps_t, csFails) }, \
29  { "gpsQuality", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_status_gps_t, gpsQuality) }, \
30  { "msgsType", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_status_gps_t, msgsType) }, \
31  { "posStatus", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_status_gps_t, posStatus) }, \
32  { "magDir", NULL, MAVLINK_TYPE_INT8_T, 0, 9, offsetof(mavlink_status_gps_t, magDir) }, \
33  { "modeInd", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_status_gps_t, modeInd) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_status_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint16_t csFails, uint8_t gpsQuality, uint8_t msgsType, uint8_t posStatus, float magVar, int8_t magDir, uint8_t modeInd)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_float(buf, 0, magVar);
59  _mav_put_uint16_t(buf, 4, csFails);
60  _mav_put_uint8_t(buf, 6, gpsQuality);
61  _mav_put_uint8_t(buf, 7, msgsType);
62  _mav_put_uint8_t(buf, 8, posStatus);
63  _mav_put_int8_t(buf, 9, magDir);
64  _mav_put_uint8_t(buf, 10, modeInd);
65 
67 #else
68  mavlink_status_gps_t packet;
69  packet.magVar = magVar;
70  packet.csFails = csFails;
71  packet.gpsQuality = gpsQuality;
72  packet.msgsType = msgsType;
73  packet.posStatus = posStatus;
74  packet.magDir = magDir;
75  packet.modeInd = modeInd;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_STATUS_GPS;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUS_GPS_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_status_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint16_t csFails,uint8_t gpsQuality,uint8_t msgsType,uint8_t posStatus,float magVar,int8_t magDir,uint8_t modeInd)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_float(buf, 0, magVar);
110  _mav_put_uint16_t(buf, 4, csFails);
111  _mav_put_uint8_t(buf, 6, gpsQuality);
112  _mav_put_uint8_t(buf, 7, msgsType);
113  _mav_put_uint8_t(buf, 8, posStatus);
114  _mav_put_int8_t(buf, 9, magDir);
115  _mav_put_uint8_t(buf, 10, modeInd);
116 
118 #else
119  mavlink_status_gps_t packet;
120  packet.magVar = magVar;
121  packet.csFails = csFails;
122  packet.gpsQuality = gpsQuality;
123  packet.msgsType = msgsType;
124  packet.posStatus = posStatus;
125  packet.magDir = magDir;
126  packet.modeInd = modeInd;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_STATUS_GPS;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUS_GPS_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_status_gps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_status_gps_t* status_gps)
148 {
149  return mavlink_msg_status_gps_pack(system_id, component_id, msg, status_gps->csFails, status_gps->gpsQuality, status_gps->msgsType, status_gps->posStatus, status_gps->magVar, status_gps->magDir, status_gps->modeInd);
150 }
151 
161 static inline uint16_t mavlink_msg_status_gps_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_status_gps_t* status_gps)
162 {
163  return mavlink_msg_status_gps_pack_chan(system_id, component_id, chan, msg, status_gps->csFails, status_gps->gpsQuality, status_gps->msgsType, status_gps->posStatus, status_gps->magVar, status_gps->magDir, status_gps->modeInd);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_status_gps_send(mavlink_channel_t chan, uint16_t csFails, uint8_t gpsQuality, uint8_t msgsType, uint8_t posStatus, float magVar, int8_t magDir, uint8_t modeInd)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_float(buf, 0, magVar);
185  _mav_put_uint16_t(buf, 4, csFails);
186  _mav_put_uint8_t(buf, 6, gpsQuality);
187  _mav_put_uint8_t(buf, 7, msgsType);
188  _mav_put_uint8_t(buf, 8, posStatus);
189  _mav_put_int8_t(buf, 9, magDir);
190  _mav_put_uint8_t(buf, 10, modeInd);
191 
192 #if MAVLINK_CRC_EXTRA
193  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, buf, MAVLINK_MSG_ID_STATUS_GPS_LEN, MAVLINK_MSG_ID_STATUS_GPS_CRC);
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, buf, MAVLINK_MSG_ID_STATUS_GPS_LEN);
196 #endif
197 #else
198  mavlink_status_gps_t packet;
199  packet.magVar = magVar;
200  packet.csFails = csFails;
201  packet.gpsQuality = gpsQuality;
202  packet.msgsType = msgsType;
203  packet.posStatus = posStatus;
204  packet.magDir = magDir;
205  packet.modeInd = modeInd;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, (const char *)&packet, MAVLINK_MSG_ID_STATUS_GPS_LEN, MAVLINK_MSG_ID_STATUS_GPS_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, (const char *)&packet, MAVLINK_MSG_ID_STATUS_GPS_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_STATUS_GPS_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_status_gps_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t csFails, uint8_t gpsQuality, uint8_t msgsType, uint8_t posStatus, float magVar, int8_t magDir, uint8_t modeInd)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_float(buf, 0, magVar);
228  _mav_put_uint16_t(buf, 4, csFails);
229  _mav_put_uint8_t(buf, 6, gpsQuality);
230  _mav_put_uint8_t(buf, 7, msgsType);
231  _mav_put_uint8_t(buf, 8, posStatus);
232  _mav_put_int8_t(buf, 9, magDir);
233  _mav_put_uint8_t(buf, 10, modeInd);
234 
235 #if MAVLINK_CRC_EXTRA
236  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, buf, MAVLINK_MSG_ID_STATUS_GPS_LEN, MAVLINK_MSG_ID_STATUS_GPS_CRC);
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, buf, MAVLINK_MSG_ID_STATUS_GPS_LEN);
239 #endif
240 #else
241  mavlink_status_gps_t *packet = (mavlink_status_gps_t *)msgbuf;
242  packet->magVar = magVar;
243  packet->csFails = csFails;
244  packet->gpsQuality = gpsQuality;
245  packet->msgsType = msgsType;
246  packet->posStatus = posStatus;
247  packet->magDir = magDir;
248  packet->modeInd = modeInd;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, (const char *)packet, MAVLINK_MSG_ID_STATUS_GPS_LEN, MAVLINK_MSG_ID_STATUS_GPS_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUS_GPS, (const char *)packet, MAVLINK_MSG_ID_STATUS_GPS_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE STATUS_GPS UNPACKING
262 
263 
269 static inline uint16_t mavlink_msg_status_gps_get_csFails(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint16_t(msg, 4);
272 }
273 
279 static inline uint8_t mavlink_msg_status_gps_get_gpsQuality(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_uint8_t(msg, 6);
282 }
283 
289 static inline uint8_t mavlink_msg_status_gps_get_msgsType(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_uint8_t(msg, 7);
292 }
293 
299 static inline uint8_t mavlink_msg_status_gps_get_posStatus(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_uint8_t(msg, 8);
302 }
303 
309 static inline float mavlink_msg_status_gps_get_magVar(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_float(msg, 0);
312 }
313 
319 static inline int8_t mavlink_msg_status_gps_get_magDir(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_int8_t(msg, 9);
322 }
323 
329 static inline uint8_t mavlink_msg_status_gps_get_modeInd(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_uint8_t(msg, 10);
332 }
333 
340 static inline void mavlink_msg_status_gps_decode(const mavlink_message_t* msg, mavlink_status_gps_t* status_gps)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  status_gps->magVar = mavlink_msg_status_gps_get_magVar(msg);
344  status_gps->csFails = mavlink_msg_status_gps_get_csFails(msg);
345  status_gps->gpsQuality = mavlink_msg_status_gps_get_gpsQuality(msg);
346  status_gps->msgsType = mavlink_msg_status_gps_get_msgsType(msg);
347  status_gps->posStatus = mavlink_msg_status_gps_get_posStatus(msg);
348  status_gps->magDir = mavlink_msg_status_gps_get_magDir(msg);
349  status_gps->modeInd = mavlink_msg_status_gps_get_modeInd(msg);
350 #else
351  memcpy(status_gps, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_STATUS_GPS_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_RETURN_int8_t(msg, wire_offset)
Definition: protocol.h:237
#define _mav_put_int8_t(buf, wire_offset, b)
Definition: protocol.h:135
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139