1 | // MESSAGE GPS_INJECT_DATA PACKING
|
---|
2 |
|
---|
3 | #define MAVLINK_MSG_ID_GPS_INJECT_DATA 123
|
---|
4 |
|
---|
5 | typedef struct MAVLINK_PACKED __mavlink_gps_inject_data_t
|
---|
6 | {
|
---|
7 | uint8_t target_system; /*< System ID*/
|
---|
8 | uint8_t target_component; /*< Component ID*/
|
---|
9 | uint8_t len; /*< data length*/
|
---|
10 | uint8_t data[110]; /*< raw data (110 is enough for 12 satellites of RTCMv2)*/
|
---|
11 | } mavlink_gps_inject_data_t;
|
---|
12 |
|
---|
13 | #define MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN 113
|
---|
14 | #define MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN 113
|
---|
15 | #define MAVLINK_MSG_ID_123_LEN 113
|
---|
16 | #define MAVLINK_MSG_ID_123_MIN_LEN 113
|
---|
17 |
|
---|
18 | #define MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC 250
|
---|
19 | #define MAVLINK_MSG_ID_123_CRC 250
|
---|
20 |
|
---|
21 | #define MAVLINK_MSG_GPS_INJECT_DATA_FIELD_DATA_LEN 110
|
---|
22 |
|
---|
23 | #if MAVLINK_COMMAND_24BIT
|
---|
24 | #define MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA { \
|
---|
25 | 123, \
|
---|
26 | "GPS_INJECT_DATA", \
|
---|
27 | 4, \
|
---|
28 | { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_inject_data_t, target_system) }, \
|
---|
29 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_inject_data_t, target_component) }, \
|
---|
30 | { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gps_inject_data_t, len) }, \
|
---|
31 | { "data", NULL, MAVLINK_TYPE_UINT8_T, 110, 3, offsetof(mavlink_gps_inject_data_t, data) }, \
|
---|
32 | } \
|
---|
33 | }
|
---|
34 | #else
|
---|
35 | #define MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA { \
|
---|
36 | "GPS_INJECT_DATA", \
|
---|
37 | 4, \
|
---|
38 | { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_inject_data_t, target_system) }, \
|
---|
39 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_inject_data_t, target_component) }, \
|
---|
40 | { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gps_inject_data_t, len) }, \
|
---|
41 | { "data", NULL, MAVLINK_TYPE_UINT8_T, 110, 3, offsetof(mavlink_gps_inject_data_t, data) }, \
|
---|
42 | } \
|
---|
43 | }
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * @brief Pack a gps_inject_data message
|
---|
48 | * @param system_id ID of this system
|
---|
49 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
50 | * @param msg The MAVLink message to compress the data into
|
---|
51 | *
|
---|
52 | * @param target_system System ID
|
---|
53 | * @param target_component Component ID
|
---|
54 | * @param len data length
|
---|
55 | * @param data raw data (110 is enough for 12 satellites of RTCMv2)
|
---|
56 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
57 | */
|
---|
58 | static inline uint16_t mavlink_msg_gps_inject_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
59 | uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
|
---|
60 | {
|
---|
61 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
62 | char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
|
---|
63 | _mav_put_uint8_t(buf, 0, target_system);
|
---|
64 | _mav_put_uint8_t(buf, 1, target_component);
|
---|
65 | _mav_put_uint8_t(buf, 2, len);
|
---|
66 | _mav_put_uint8_t_array(buf, 3, data, 110);
|
---|
67 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
|
---|
68 | #else
|
---|
69 | mavlink_gps_inject_data_t packet;
|
---|
70 | packet.target_system = target_system;
|
---|
71 | packet.target_component = target_component;
|
---|
72 | packet.len = len;
|
---|
73 | mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
|
---|
74 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | msg->msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA;
|
---|
78 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * @brief Pack a gps_inject_data message on a channel
|
---|
83 | * @param system_id ID of this system
|
---|
84 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
85 | * @param chan The MAVLink channel this message will be sent over
|
---|
86 | * @param msg The MAVLink message to compress the data into
|
---|
87 | * @param target_system System ID
|
---|
88 | * @param target_component Component ID
|
---|
89 | * @param len data length
|
---|
90 | * @param data raw data (110 is enough for 12 satellites of RTCMv2)
|
---|
91 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
92 | */
|
---|
93 | static inline uint16_t mavlink_msg_gps_inject_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
94 | mavlink_message_t* msg,
|
---|
95 | uint8_t target_system,uint8_t target_component,uint8_t len,const uint8_t *data)
|
---|
96 | {
|
---|
97 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
98 | char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
|
---|
99 | _mav_put_uint8_t(buf, 0, target_system);
|
---|
100 | _mav_put_uint8_t(buf, 1, target_component);
|
---|
101 | _mav_put_uint8_t(buf, 2, len);
|
---|
102 | _mav_put_uint8_t_array(buf, 3, data, 110);
|
---|
103 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
|
---|
104 | #else
|
---|
105 | mavlink_gps_inject_data_t packet;
|
---|
106 | packet.target_system = target_system;
|
---|
107 | packet.target_component = target_component;
|
---|
108 | packet.len = len;
|
---|
109 | mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
|
---|
110 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | msg->msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA;
|
---|
114 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
115 | }
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * @brief Encode a gps_inject_data struct
|
---|
119 | *
|
---|
120 | * @param system_id ID of this system
|
---|
121 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
122 | * @param msg The MAVLink message to compress the data into
|
---|
123 | * @param gps_inject_data C-struct to read the message contents from
|
---|
124 | */
|
---|
125 | static inline uint16_t mavlink_msg_gps_inject_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_inject_data_t* gps_inject_data)
|
---|
126 | {
|
---|
127 | return mavlink_msg_gps_inject_data_pack(system_id, component_id, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data);
|
---|
128 | }
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * @brief Encode a gps_inject_data struct on a channel
|
---|
132 | *
|
---|
133 | * @param system_id ID of this system
|
---|
134 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
135 | * @param chan The MAVLink channel this message will be sent over
|
---|
136 | * @param msg The MAVLink message to compress the data into
|
---|
137 | * @param gps_inject_data C-struct to read the message contents from
|
---|
138 | */
|
---|
139 | static inline uint16_t mavlink_msg_gps_inject_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_inject_data_t* gps_inject_data)
|
---|
140 | {
|
---|
141 | return mavlink_msg_gps_inject_data_pack_chan(system_id, component_id, chan, msg, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data);
|
---|
142 | }
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * @brief Send a gps_inject_data message
|
---|
146 | * @param chan MAVLink channel to send the message
|
---|
147 | *
|
---|
148 | * @param target_system System ID
|
---|
149 | * @param target_component Component ID
|
---|
150 | * @param len data length
|
---|
151 | * @param data raw data (110 is enough for 12 satellites of RTCMv2)
|
---|
152 | */
|
---|
153 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
154 |
|
---|
155 | static inline void mavlink_msg_gps_inject_data_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
|
---|
156 | {
|
---|
157 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
158 | char buf[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN];
|
---|
159 | _mav_put_uint8_t(buf, 0, target_system);
|
---|
160 | _mav_put_uint8_t(buf, 1, target_component);
|
---|
161 | _mav_put_uint8_t(buf, 2, len);
|
---|
162 | _mav_put_uint8_t_array(buf, 3, data, 110);
|
---|
163 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
164 | #else
|
---|
165 | mavlink_gps_inject_data_t packet;
|
---|
166 | packet.target_system = target_system;
|
---|
167 | packet.target_component = target_component;
|
---|
168 | packet.len = len;
|
---|
169 | mav_array_memcpy(packet.data, data, sizeof(uint8_t)*110);
|
---|
170 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)&packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
171 | #endif
|
---|
172 | }
|
---|
173 |
|
---|
174 | /**
|
---|
175 | * @brief Send a gps_inject_data message
|
---|
176 | * @param chan MAVLink channel to send the message
|
---|
177 | * @param struct The MAVLink struct to serialize
|
---|
178 | */
|
---|
179 | static inline void mavlink_msg_gps_inject_data_send_struct(mavlink_channel_t chan, const mavlink_gps_inject_data_t* gps_inject_data)
|
---|
180 | {
|
---|
181 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
182 | mavlink_msg_gps_inject_data_send(chan, gps_inject_data->target_system, gps_inject_data->target_component, gps_inject_data->len, gps_inject_data->data);
|
---|
183 | #else
|
---|
184 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)gps_inject_data, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
185 | #endif
|
---|
186 | }
|
---|
187 |
|
---|
188 | #if MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
189 | /*
|
---|
190 | This varient of _send() can be used to save stack space by re-using
|
---|
191 | memory from the receive buffer. The caller provides a
|
---|
192 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
193 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
194 | incoming message with minimum stack space usage.
|
---|
195 | */
|
---|
196 | static inline void mavlink_msg_gps_inject_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t len, const uint8_t *data)
|
---|
197 | {
|
---|
198 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
199 | char *buf = (char *)msgbuf;
|
---|
200 | _mav_put_uint8_t(buf, 0, target_system);
|
---|
201 | _mav_put_uint8_t(buf, 1, target_component);
|
---|
202 | _mav_put_uint8_t(buf, 2, len);
|
---|
203 | _mav_put_uint8_t_array(buf, 3, data, 110);
|
---|
204 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, buf, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
205 | #else
|
---|
206 | mavlink_gps_inject_data_t *packet = (mavlink_gps_inject_data_t *)msgbuf;
|
---|
207 | packet->target_system = target_system;
|
---|
208 | packet->target_component = target_component;
|
---|
209 | packet->len = len;
|
---|
210 | mav_array_memcpy(packet->data, data, sizeof(uint8_t)*110);
|
---|
211 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_INJECT_DATA, (const char *)packet, MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN, MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC);
|
---|
212 | #endif
|
---|
213 | }
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #endif
|
---|
217 |
|
---|
218 | // MESSAGE GPS_INJECT_DATA UNPACKING
|
---|
219 |
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * @brief Get field target_system from gps_inject_data message
|
---|
223 | *
|
---|
224 | * @return System ID
|
---|
225 | */
|
---|
226 | static inline uint8_t mavlink_msg_gps_inject_data_get_target_system(const mavlink_message_t* msg)
|
---|
227 | {
|
---|
228 | return _MAV_RETURN_uint8_t(msg, 0);
|
---|
229 | }
|
---|
230 |
|
---|
231 | /**
|
---|
232 | * @brief Get field target_component from gps_inject_data message
|
---|
233 | *
|
---|
234 | * @return Component ID
|
---|
235 | */
|
---|
236 | static inline uint8_t mavlink_msg_gps_inject_data_get_target_component(const mavlink_message_t* msg)
|
---|
237 | {
|
---|
238 | return _MAV_RETURN_uint8_t(msg, 1);
|
---|
239 | }
|
---|
240 |
|
---|
241 | /**
|
---|
242 | * @brief Get field len from gps_inject_data message
|
---|
243 | *
|
---|
244 | * @return data length
|
---|
245 | */
|
---|
246 | static inline uint8_t mavlink_msg_gps_inject_data_get_len(const mavlink_message_t* msg)
|
---|
247 | {
|
---|
248 | return _MAV_RETURN_uint8_t(msg, 2);
|
---|
249 | }
|
---|
250 |
|
---|
251 | /**
|
---|
252 | * @brief Get field data from gps_inject_data message
|
---|
253 | *
|
---|
254 | * @return raw data (110 is enough for 12 satellites of RTCMv2)
|
---|
255 | */
|
---|
256 | static inline uint16_t mavlink_msg_gps_inject_data_get_data(const mavlink_message_t* msg, uint8_t *data)
|
---|
257 | {
|
---|
258 | return _MAV_RETURN_uint8_t_array(msg, data, 110, 3);
|
---|
259 | }
|
---|
260 |
|
---|
261 | /**
|
---|
262 | * @brief Decode a gps_inject_data message into a struct
|
---|
263 | *
|
---|
264 | * @param msg The message to decode
|
---|
265 | * @param gps_inject_data C-struct to decode the message contents into
|
---|
266 | */
|
---|
267 | static inline void mavlink_msg_gps_inject_data_decode(const mavlink_message_t* msg, mavlink_gps_inject_data_t* gps_inject_data)
|
---|
268 | {
|
---|
269 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
270 | gps_inject_data->target_system = mavlink_msg_gps_inject_data_get_target_system(msg);
|
---|
271 | gps_inject_data->target_component = mavlink_msg_gps_inject_data_get_target_component(msg);
|
---|
272 | gps_inject_data->len = mavlink_msg_gps_inject_data_get_len(msg);
|
---|
273 | mavlink_msg_gps_inject_data_get_data(msg, gps_inject_data->data);
|
---|
274 | #else
|
---|
275 | uint8_t len = msg->len < MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN? msg->len : MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN;
|
---|
276 | memset(gps_inject_data, 0, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN);
|
---|
277 | memcpy(gps_inject_data, _MAV_PAYLOAD(msg), len);
|
---|
278 | #endif
|
---|
279 | }
|
---|