source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_gps_status.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 16.4 KB
Line 
1// MESSAGE GPS_STATUS PACKING
2
3#define MAVLINK_MSG_ID_GPS_STATUS 25
4
5typedef struct MAVLINK_PACKED __mavlink_gps_status_t
6{
7 uint8_t satellites_visible; /*< Number of satellites visible*/
8 uint8_t satellite_prn[20]; /*< Global satellite ID*/
9 uint8_t satellite_used[20]; /*< 0: Satellite not used, 1: used for localization*/
10 uint8_t satellite_elevation[20]; /*< Elevation (0: right on top of receiver, 90: on the horizon) of satellite*/
11 uint8_t satellite_azimuth[20]; /*< Direction of satellite, 0: 0 deg, 255: 360 deg.*/
12 uint8_t satellite_snr[20]; /*< Signal to noise ratio of satellite*/
13} mavlink_gps_status_t;
14
15#define MAVLINK_MSG_ID_GPS_STATUS_LEN 101
16#define MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN 101
17#define MAVLINK_MSG_ID_25_LEN 101
18#define MAVLINK_MSG_ID_25_MIN_LEN 101
19
20#define MAVLINK_MSG_ID_GPS_STATUS_CRC 23
21#define MAVLINK_MSG_ID_25_CRC 23
22
23#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20
24#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20
25#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20
26#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20
27#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_GPS_STATUS { \
31 25, \
32 "GPS_STATUS", \
33 6, \
34 { { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \
35 { "satellite_prn", NULL, MAVLINK_TYPE_UINT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \
36 { "satellite_used", NULL, MAVLINK_TYPE_UINT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \
37 { "satellite_elevation", NULL, MAVLINK_TYPE_UINT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \
38 { "satellite_azimuth", NULL, MAVLINK_TYPE_UINT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \
39 { "satellite_snr", NULL, MAVLINK_TYPE_UINT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \
40 } \
41}
42#else
43#define MAVLINK_MESSAGE_INFO_GPS_STATUS { \
44 "GPS_STATUS", \
45 6, \
46 { { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \
47 { "satellite_prn", NULL, MAVLINK_TYPE_UINT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \
48 { "satellite_used", NULL, MAVLINK_TYPE_UINT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \
49 { "satellite_elevation", NULL, MAVLINK_TYPE_UINT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \
50 { "satellite_azimuth", NULL, MAVLINK_TYPE_UINT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \
51 { "satellite_snr", NULL, MAVLINK_TYPE_UINT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \
52 } \
53}
54#endif
55
56/**
57 * @brief Pack a gps_status message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
61 *
62 * @param satellites_visible Number of satellites visible
63 * @param satellite_prn Global satellite ID
64 * @param satellite_used 0: Satellite not used, 1: used for localization
65 * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
66 * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
67 * @param satellite_snr Signal to noise ratio of satellite
68 * @return length of the message in bytes (excluding serial stream start sign)
69 */
70static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
71 uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
72{
73#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
74 char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
75 _mav_put_uint8_t(buf, 0, satellites_visible);
76 _mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
77 _mav_put_uint8_t_array(buf, 21, satellite_used, 20);
78 _mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
79 _mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
80 _mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
81 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
82#else
83 mavlink_gps_status_t packet;
84 packet.satellites_visible = satellites_visible;
85 mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
86 mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
87 mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
88 mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
89 mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
90 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
91#endif
92
93 msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
94 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
95}
96
97/**
98 * @brief Pack a gps_status message on a channel
99 * @param system_id ID of this system
100 * @param component_id ID of this component (e.g. 200 for IMU)
101 * @param chan The MAVLink channel this message will be sent over
102 * @param msg The MAVLink message to compress the data into
103 * @param satellites_visible Number of satellites visible
104 * @param satellite_prn Global satellite ID
105 * @param satellite_used 0: Satellite not used, 1: used for localization
106 * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
107 * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
108 * @param satellite_snr Signal to noise ratio of satellite
109 * @return length of the message in bytes (excluding serial stream start sign)
110 */
111static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
112 mavlink_message_t* msg,
113 uint8_t satellites_visible,const uint8_t *satellite_prn,const uint8_t *satellite_used,const uint8_t *satellite_elevation,const uint8_t *satellite_azimuth,const uint8_t *satellite_snr)
114{
115#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
116 char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
117 _mav_put_uint8_t(buf, 0, satellites_visible);
118 _mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
119 _mav_put_uint8_t_array(buf, 21, satellite_used, 20);
120 _mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
121 _mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
122 _mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_STATUS_LEN);
124#else
125 mavlink_gps_status_t packet;
126 packet.satellites_visible = satellites_visible;
127 mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
128 mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
129 mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
130 mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
131 mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
132 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_STATUS_LEN);
133#endif
134
135 msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
136 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
137}
138
139/**
140 * @brief Encode a gps_status struct
141 *
142 * @param system_id ID of this system
143 * @param component_id ID of this component (e.g. 200 for IMU)
144 * @param msg The MAVLink message to compress the data into
145 * @param gps_status C-struct to read the message contents from
146 */
147static inline uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status)
148{
149 return mavlink_msg_gps_status_pack(system_id, component_id, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
150}
151
152/**
153 * @brief Encode a gps_status struct on a channel
154 *
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param chan The MAVLink channel this message will be sent over
158 * @param msg The MAVLink message to compress the data into
159 * @param gps_status C-struct to read the message contents from
160 */
161static inline uint16_t mavlink_msg_gps_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status)
162{
163 return mavlink_msg_gps_status_pack_chan(system_id, component_id, chan, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
164}
165
166/**
167 * @brief Send a gps_status message
168 * @param chan MAVLink channel to send the message
169 *
170 * @param satellites_visible Number of satellites visible
171 * @param satellite_prn Global satellite ID
172 * @param satellite_used 0: Satellite not used, 1: used for localization
173 * @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
174 * @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
175 * @param satellite_snr Signal to noise ratio of satellite
176 */
177#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
178
179static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char buf[MAVLINK_MSG_ID_GPS_STATUS_LEN];
183 _mav_put_uint8_t(buf, 0, satellites_visible);
184 _mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
185 _mav_put_uint8_t_array(buf, 21, satellite_used, 20);
186 _mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
187 _mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
188 _mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
189 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
190#else
191 mavlink_gps_status_t packet;
192 packet.satellites_visible = satellites_visible;
193 mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20);
194 mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20);
195 mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
196 mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
197 mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20);
198 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
199#endif
200}
201
202/**
203 * @brief Send a gps_status message
204 * @param chan MAVLink channel to send the message
205 * @param struct The MAVLink struct to serialize
206 */
207static inline void mavlink_msg_gps_status_send_struct(mavlink_channel_t chan, const mavlink_gps_status_t* gps_status)
208{
209#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210 mavlink_msg_gps_status_send(chan, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
211#else
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)gps_status, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
213#endif
214}
215
216#if MAVLINK_MSG_ID_GPS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
217/*
218 This varient of _send() can be used to save stack space by re-using
219 memory from the receive buffer. The caller provides a
220 mavlink_message_t which is the size of a full mavlink message. This
221 is usually the receive buffer for the channel, and allows a reply to an
222 incoming message with minimum stack space usage.
223 */
224static inline void mavlink_msg_gps_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr)
225{
226#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
227 char *buf = (char *)msgbuf;
228 _mav_put_uint8_t(buf, 0, satellites_visible);
229 _mav_put_uint8_t_array(buf, 1, satellite_prn, 20);
230 _mav_put_uint8_t_array(buf, 21, satellite_used, 20);
231 _mav_put_uint8_t_array(buf, 41, satellite_elevation, 20);
232 _mav_put_uint8_t_array(buf, 61, satellite_azimuth, 20);
233 _mav_put_uint8_t_array(buf, 81, satellite_snr, 20);
234 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
235#else
236 mavlink_gps_status_t *packet = (mavlink_gps_status_t *)msgbuf;
237 packet->satellites_visible = satellites_visible;
238 mav_array_memcpy(packet->satellite_prn, satellite_prn, sizeof(uint8_t)*20);
239 mav_array_memcpy(packet->satellite_used, satellite_used, sizeof(uint8_t)*20);
240 mav_array_memcpy(packet->satellite_elevation, satellite_elevation, sizeof(uint8_t)*20);
241 mav_array_memcpy(packet->satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20);
242 mav_array_memcpy(packet->satellite_snr, satellite_snr, sizeof(uint8_t)*20);
243 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)packet, MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN, MAVLINK_MSG_ID_GPS_STATUS_LEN, MAVLINK_MSG_ID_GPS_STATUS_CRC);
244#endif
245}
246#endif
247
248#endif
249
250// MESSAGE GPS_STATUS UNPACKING
251
252
253/**
254 * @brief Get field satellites_visible from gps_status message
255 *
256 * @return Number of satellites visible
257 */
258static inline uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg)
259{
260 return _MAV_RETURN_uint8_t(msg, 0);
261}
262
263/**
264 * @brief Get field satellite_prn from gps_status message
265 *
266 * @return Global satellite ID
267 */
268static inline uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, uint8_t *satellite_prn)
269{
270 return _MAV_RETURN_uint8_t_array(msg, satellite_prn, 20, 1);
271}
272
273/**
274 * @brief Get field satellite_used from gps_status message
275 *
276 * @return 0: Satellite not used, 1: used for localization
277 */
278static inline uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, uint8_t *satellite_used)
279{
280 return _MAV_RETURN_uint8_t_array(msg, satellite_used, 20, 21);
281}
282
283/**
284 * @brief Get field satellite_elevation from gps_status message
285 *
286 * @return Elevation (0: right on top of receiver, 90: on the horizon) of satellite
287 */
288static inline uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, uint8_t *satellite_elevation)
289{
290 return _MAV_RETURN_uint8_t_array(msg, satellite_elevation, 20, 41);
291}
292
293/**
294 * @brief Get field satellite_azimuth from gps_status message
295 *
296 * @return Direction of satellite, 0: 0 deg, 255: 360 deg.
297 */
298static inline uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, uint8_t *satellite_azimuth)
299{
300 return _MAV_RETURN_uint8_t_array(msg, satellite_azimuth, 20, 61);
301}
302
303/**
304 * @brief Get field satellite_snr from gps_status message
305 *
306 * @return Signal to noise ratio of satellite
307 */
308static inline uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, uint8_t *satellite_snr)
309{
310 return _MAV_RETURN_uint8_t_array(msg, satellite_snr, 20, 81);
311}
312
313/**
314 * @brief Decode a gps_status message into a struct
315 *
316 * @param msg The message to decode
317 * @param gps_status C-struct to decode the message contents into
318 */
319static inline void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status)
320{
321#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
322 gps_status->satellites_visible = mavlink_msg_gps_status_get_satellites_visible(msg);
323 mavlink_msg_gps_status_get_satellite_prn(msg, gps_status->satellite_prn);
324 mavlink_msg_gps_status_get_satellite_used(msg, gps_status->satellite_used);
325 mavlink_msg_gps_status_get_satellite_elevation(msg, gps_status->satellite_elevation);
326 mavlink_msg_gps_status_get_satellite_azimuth(msg, gps_status->satellite_azimuth);
327 mavlink_msg_gps_status_get_satellite_snr(msg, gps_status->satellite_snr);
328#else
329 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GPS_STATUS_LEN;
330 memset(gps_status, 0, MAVLINK_MSG_ID_GPS_STATUS_LEN);
331 memcpy(gps_status, _MAV_PAYLOAD(msg), len);
332#endif
333}
Note: See TracBrowser for help on using the repository browser.