source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_gps_rtcm_data.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: 9.9 KB
Line 
1// MESSAGE GPS_RTCM_DATA PACKING
2
3#define MAVLINK_MSG_ID_GPS_RTCM_DATA 233
4
5typedef struct MAVLINK_PACKED __mavlink_gps_rtcm_data_t
6{
7 uint8_t flags; /*< LSB: 1 means message is fragmented*/
8 uint8_t len; /*< data length*/
9 uint8_t data[180]; /*< RTCM message (may be fragmented)*/
10} mavlink_gps_rtcm_data_t;
11
12#define MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN 182
13#define MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN 182
14#define MAVLINK_MSG_ID_233_LEN 182
15#define MAVLINK_MSG_ID_233_MIN_LEN 182
16
17#define MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC 35
18#define MAVLINK_MSG_ID_233_CRC 35
19
20#define MAVLINK_MSG_GPS_RTCM_DATA_FIELD_DATA_LEN 180
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA { \
24 233, \
25 "GPS_RTCM_DATA", \
26 3, \
27 { { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_rtcm_data_t, flags) }, \
28 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_rtcm_data_t, len) }, \
29 { "data", NULL, MAVLINK_TYPE_UINT8_T, 180, 2, offsetof(mavlink_gps_rtcm_data_t, data) }, \
30 } \
31}
32#else
33#define MAVLINK_MESSAGE_INFO_GPS_RTCM_DATA { \
34 "GPS_RTCM_DATA", \
35 3, \
36 { { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_rtcm_data_t, flags) }, \
37 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_rtcm_data_t, len) }, \
38 { "data", NULL, MAVLINK_TYPE_UINT8_T, 180, 2, offsetof(mavlink_gps_rtcm_data_t, data) }, \
39 } \
40}
41#endif
42
43/**
44 * @brief Pack a gps_rtcm_data message
45 * @param system_id ID of this system
46 * @param component_id ID of this component (e.g. 200 for IMU)
47 * @param msg The MAVLink message to compress the data into
48 *
49 * @param flags LSB: 1 means message is fragmented
50 * @param len data length
51 * @param data RTCM message (may be fragmented)
52 * @return length of the message in bytes (excluding serial stream start sign)
53 */
54static inline uint16_t mavlink_msg_gps_rtcm_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
55 uint8_t flags, uint8_t len, const uint8_t *data)
56{
57#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58 char buf[MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN];
59 _mav_put_uint8_t(buf, 0, flags);
60 _mav_put_uint8_t(buf, 1, len);
61 _mav_put_uint8_t_array(buf, 2, data, 180);
62 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN);
63#else
64 mavlink_gps_rtcm_data_t packet;
65 packet.flags = flags;
66 packet.len = len;
67 mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180);
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN);
69#endif
70
71 msg->msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA;
72 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
73}
74
75/**
76 * @brief Pack a gps_rtcm_data message on a channel
77 * @param system_id ID of this system
78 * @param component_id ID of this component (e.g. 200 for IMU)
79 * @param chan The MAVLink channel this message will be sent over
80 * @param msg The MAVLink message to compress the data into
81 * @param flags LSB: 1 means message is fragmented
82 * @param len data length
83 * @param data RTCM message (may be fragmented)
84 * @return length of the message in bytes (excluding serial stream start sign)
85 */
86static inline uint16_t mavlink_msg_gps_rtcm_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
87 mavlink_message_t* msg,
88 uint8_t flags,uint8_t len,const uint8_t *data)
89{
90#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91 char buf[MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN];
92 _mav_put_uint8_t(buf, 0, flags);
93 _mav_put_uint8_t(buf, 1, len);
94 _mav_put_uint8_t_array(buf, 2, data, 180);
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN);
96#else
97 mavlink_gps_rtcm_data_t packet;
98 packet.flags = flags;
99 packet.len = len;
100 mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180);
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN);
102#endif
103
104 msg->msgid = MAVLINK_MSG_ID_GPS_RTCM_DATA;
105 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
106}
107
108/**
109 * @brief Encode a gps_rtcm_data struct
110 *
111 * @param system_id ID of this system
112 * @param component_id ID of this component (e.g. 200 for IMU)
113 * @param msg The MAVLink message to compress the data into
114 * @param gps_rtcm_data C-struct to read the message contents from
115 */
116static inline uint16_t mavlink_msg_gps_rtcm_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_rtcm_data_t* gps_rtcm_data)
117{
118 return mavlink_msg_gps_rtcm_data_pack(system_id, component_id, msg, gps_rtcm_data->flags, gps_rtcm_data->len, gps_rtcm_data->data);
119}
120
121/**
122 * @brief Encode a gps_rtcm_data struct on a channel
123 *
124 * @param system_id ID of this system
125 * @param component_id ID of this component (e.g. 200 for IMU)
126 * @param chan The MAVLink channel this message will be sent over
127 * @param msg The MAVLink message to compress the data into
128 * @param gps_rtcm_data C-struct to read the message contents from
129 */
130static inline uint16_t mavlink_msg_gps_rtcm_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_rtcm_data_t* gps_rtcm_data)
131{
132 return mavlink_msg_gps_rtcm_data_pack_chan(system_id, component_id, chan, msg, gps_rtcm_data->flags, gps_rtcm_data->len, gps_rtcm_data->data);
133}
134
135/**
136 * @brief Send a gps_rtcm_data message
137 * @param chan MAVLink channel to send the message
138 *
139 * @param flags LSB: 1 means message is fragmented
140 * @param len data length
141 * @param data RTCM message (may be fragmented)
142 */
143#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
144
145static inline void mavlink_msg_gps_rtcm_data_send(mavlink_channel_t chan, uint8_t flags, uint8_t len, const uint8_t *data)
146{
147#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
148 char buf[MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN];
149 _mav_put_uint8_t(buf, 0, flags);
150 _mav_put_uint8_t(buf, 1, len);
151 _mav_put_uint8_t_array(buf, 2, data, 180);
152 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, buf, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
153#else
154 mavlink_gps_rtcm_data_t packet;
155 packet.flags = flags;
156 packet.len = len;
157 mav_array_memcpy(packet.data, data, sizeof(uint8_t)*180);
158 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
159#endif
160}
161
162/**
163 * @brief Send a gps_rtcm_data message
164 * @param chan MAVLink channel to send the message
165 * @param struct The MAVLink struct to serialize
166 */
167static inline void mavlink_msg_gps_rtcm_data_send_struct(mavlink_channel_t chan, const mavlink_gps_rtcm_data_t* gps_rtcm_data)
168{
169#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
170 mavlink_msg_gps_rtcm_data_send(chan, gps_rtcm_data->flags, gps_rtcm_data->len, gps_rtcm_data->data);
171#else
172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, (const char *)gps_rtcm_data, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
173#endif
174}
175
176#if MAVLINK_MSG_ID_GPS_RTCM_DATA_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 */
184static inline void mavlink_msg_gps_rtcm_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t flags, uint8_t len, const uint8_t *data)
185{
186#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
187 char *buf = (char *)msgbuf;
188 _mav_put_uint8_t(buf, 0, flags);
189 _mav_put_uint8_t(buf, 1, len);
190 _mav_put_uint8_t_array(buf, 2, data, 180);
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, buf, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
192#else
193 mavlink_gps_rtcm_data_t *packet = (mavlink_gps_rtcm_data_t *)msgbuf;
194 packet->flags = flags;
195 packet->len = len;
196 mav_array_memcpy(packet->data, data, sizeof(uint8_t)*180);
197 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RTCM_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN, MAVLINK_MSG_ID_GPS_RTCM_DATA_CRC);
198#endif
199}
200#endif
201
202#endif
203
204// MESSAGE GPS_RTCM_DATA UNPACKING
205
206
207/**
208 * @brief Get field flags from gps_rtcm_data message
209 *
210 * @return LSB: 1 means message is fragmented
211 */
212static inline uint8_t mavlink_msg_gps_rtcm_data_get_flags(const mavlink_message_t* msg)
213{
214 return _MAV_RETURN_uint8_t(msg, 0);
215}
216
217/**
218 * @brief Get field len from gps_rtcm_data message
219 *
220 * @return data length
221 */
222static inline uint8_t mavlink_msg_gps_rtcm_data_get_len(const mavlink_message_t* msg)
223{
224 return _MAV_RETURN_uint8_t(msg, 1);
225}
226
227/**
228 * @brief Get field data from gps_rtcm_data message
229 *
230 * @return RTCM message (may be fragmented)
231 */
232static inline uint16_t mavlink_msg_gps_rtcm_data_get_data(const mavlink_message_t* msg, uint8_t *data)
233{
234 return _MAV_RETURN_uint8_t_array(msg, data, 180, 2);
235}
236
237/**
238 * @brief Decode a gps_rtcm_data message into a struct
239 *
240 * @param msg The message to decode
241 * @param gps_rtcm_data C-struct to decode the message contents into
242 */
243static inline void mavlink_msg_gps_rtcm_data_decode(const mavlink_message_t* msg, mavlink_gps_rtcm_data_t* gps_rtcm_data)
244{
245#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
246 gps_rtcm_data->flags = mavlink_msg_gps_rtcm_data_get_flags(msg);
247 gps_rtcm_data->len = mavlink_msg_gps_rtcm_data_get_len(msg);
248 mavlink_msg_gps_rtcm_data_get_data(msg, gps_rtcm_data->data);
249#else
250 uint8_t len = msg->len < MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN? msg->len : MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN;
251 memset(gps_rtcm_data, 0, MAVLINK_MSG_ID_GPS_RTCM_DATA_LEN);
252 memcpy(gps_rtcm_data, _MAV_PAYLOAD(msg), len);
253#endif
254}
Note: See TracBrowser for help on using the repository browser.