2 // MESSAGE GPS_INJECT_DATA PACKING
4 #define MAVLINK_MSG_ID_GPS_INJECT_DATA 123
7 typedef struct __mavlink_gps_inject_data_t
{
8 uint8_t target_system
; /*< System ID*/
9 uint8_t target_component
; /*< Component ID*/
10 uint8_t len
; /*< [bytes] Data length*/
11 uint8_t data
[110]; /*< Raw data (110 is enough for 12 satellites of RTCMv2)*/
12 } mavlink_gps_inject_data_t
;
14 #define MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN 113
15 #define MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN 113
16 #define MAVLINK_MSG_ID_123_LEN 113
17 #define MAVLINK_MSG_ID_123_MIN_LEN 113
19 #define MAVLINK_MSG_ID_GPS_INJECT_DATA_CRC 250
20 #define MAVLINK_MSG_ID_123_CRC 250
22 #define MAVLINK_MSG_GPS_INJECT_DATA_FIELD_DATA_LEN 110
24 #if MAVLINK_COMMAND_24BIT
25 #define MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA { \
29 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_inject_data_t, target_system) }, \
30 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_inject_data_t, target_component) }, \
31 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gps_inject_data_t, len) }, \
32 { "data", NULL, MAVLINK_TYPE_UINT8_T, 110, 3, offsetof(mavlink_gps_inject_data_t, data) }, \
36 #define MAVLINK_MESSAGE_INFO_GPS_INJECT_DATA { \
39 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_inject_data_t, target_system) }, \
40 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_inject_data_t, target_component) }, \
41 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_gps_inject_data_t, len) }, \
42 { "data", NULL, MAVLINK_TYPE_UINT8_T, 110, 3, offsetof(mavlink_gps_inject_data_t, data) }, \
48 * @brief Pack a gps_inject_data message
49 * @param system_id ID of this system
50 * @param component_id ID of this component (e.g. 200 for IMU)
51 * @param msg The MAVLink message to compress the data into
53 * @param target_system System ID
54 * @param target_component Component ID
55 * @param len [bytes] Data length
56 * @param data Raw data (110 is enough for 12 satellites of RTCMv2)
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_gps_inject_data_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
60 uint8_t target_system
, uint8_t target_component
, uint8_t len
, const uint8_t *data
)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf
[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
];
64 _mav_put_uint8_t(buf
, 0, target_system
);
65 _mav_put_uint8_t(buf
, 1, target_component
);
66 _mav_put_uint8_t(buf
, 2, len
);
67 _mav_put_uint8_t_array(buf
, 3, data
, 110);
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
);
70 mavlink_gps_inject_data_t packet
;
71 packet
.target_system
= target_system
;
72 packet
.target_component
= target_component
;
74 mav_array_memcpy(packet
.data
, data
, sizeof(uint8_t)*110);
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
);
78 msg
->msgid
= MAVLINK_MSG_ID_GPS_INJECT_DATA
;
79 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
);
83 * @brief Pack a gps_inject_data message on a channel
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param chan The MAVLink channel this message will be sent over
87 * @param msg The MAVLink message to compress the data into
88 * @param target_system System ID
89 * @param target_component Component ID
90 * @param len [bytes] Data length
91 * @param data Raw data (110 is enough for 12 satellites of RTCMv2)
92 * @return length of the message in bytes (excluding serial stream start sign)
94 static inline uint16_t mavlink_msg_gps_inject_data_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
95 mavlink_message_t
* msg
,
96 uint8_t target_system
,uint8_t target_component
,uint8_t len
,const uint8_t *data
)
98 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf
[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
];
100 _mav_put_uint8_t(buf
, 0, target_system
);
101 _mav_put_uint8_t(buf
, 1, target_component
);
102 _mav_put_uint8_t(buf
, 2, len
);
103 _mav_put_uint8_t_array(buf
, 3, data
, 110);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
);
106 mavlink_gps_inject_data_t packet
;
107 packet
.target_system
= target_system
;
108 packet
.target_component
= target_component
;
110 mav_array_memcpy(packet
.data
, data
, sizeof(uint8_t)*110);
111 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
);
114 msg
->msgid
= MAVLINK_MSG_ID_GPS_INJECT_DATA
;
115 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
);
119 * @brief Encode a gps_inject_data struct
121 * @param system_id ID of this system
122 * @param component_id ID of this component (e.g. 200 for IMU)
123 * @param msg The MAVLink message to compress the data into
124 * @param gps_inject_data C-struct to read the message contents from
126 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
)
128 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
);
132 * @brief Encode a gps_inject_data struct on a channel
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param chan The MAVLink channel this message will be sent over
137 * @param msg The MAVLink message to compress the data into
138 * @param gps_inject_data C-struct to read the message contents from
140 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
)
142 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
);
146 * @brief Send a gps_inject_data message
147 * @param chan MAVLink channel to send the message
149 * @param target_system System ID
150 * @param target_component Component ID
151 * @param len [bytes] Data length
152 * @param data Raw data (110 is enough for 12 satellites of RTCMv2)
154 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
156 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
)
158 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
159 char buf
[MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
];
160 _mav_put_uint8_t(buf
, 0, target_system
);
161 _mav_put_uint8_t(buf
, 1, target_component
);
162 _mav_put_uint8_t(buf
, 2, len
);
163 _mav_put_uint8_t_array(buf
, 3, data
, 110);
164 _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
);
166 mavlink_gps_inject_data_t packet
;
167 packet
.target_system
= target_system
;
168 packet
.target_component
= target_component
;
170 mav_array_memcpy(packet
.data
, data
, sizeof(uint8_t)*110);
171 _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
);
176 * @brief Send a gps_inject_data message
177 * @param chan MAVLink channel to send the message
178 * @param struct The MAVLink struct to serialize
180 static inline void mavlink_msg_gps_inject_data_send_struct(mavlink_channel_t chan
, const mavlink_gps_inject_data_t
* gps_inject_data
)
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 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
);
185 _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
);
189 #if MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
191 This varient of _send() can be used to save stack space by re-using
192 memory from the receive buffer. The caller provides a
193 mavlink_message_t which is the size of a full mavlink message. This
194 is usually the receive buffer for the channel, and allows a reply to an
195 incoming message with minimum stack space usage.
197 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
)
199 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 char *buf
= (char *)msgbuf
;
201 _mav_put_uint8_t(buf
, 0, target_system
);
202 _mav_put_uint8_t(buf
, 1, target_component
);
203 _mav_put_uint8_t(buf
, 2, len
);
204 _mav_put_uint8_t_array(buf
, 3, data
, 110);
205 _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
);
207 mavlink_gps_inject_data_t
*packet
= (mavlink_gps_inject_data_t
*)msgbuf
;
208 packet
->target_system
= target_system
;
209 packet
->target_component
= target_component
;
211 mav_array_memcpy(packet
->data
, data
, sizeof(uint8_t)*110);
212 _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
);
219 // MESSAGE GPS_INJECT_DATA UNPACKING
223 * @brief Get field target_system from gps_inject_data message
227 static inline uint8_t mavlink_msg_gps_inject_data_get_target_system(const mavlink_message_t
* msg
)
229 return _MAV_RETURN_uint8_t(msg
, 0);
233 * @brief Get field target_component from gps_inject_data message
235 * @return Component ID
237 static inline uint8_t mavlink_msg_gps_inject_data_get_target_component(const mavlink_message_t
* msg
)
239 return _MAV_RETURN_uint8_t(msg
, 1);
243 * @brief Get field len from gps_inject_data message
245 * @return [bytes] Data length
247 static inline uint8_t mavlink_msg_gps_inject_data_get_len(const mavlink_message_t
* msg
)
249 return _MAV_RETURN_uint8_t(msg
, 2);
253 * @brief Get field data from gps_inject_data message
255 * @return Raw data (110 is enough for 12 satellites of RTCMv2)
257 static inline uint16_t mavlink_msg_gps_inject_data_get_data(const mavlink_message_t
* msg
, uint8_t *data
)
259 return _MAV_RETURN_uint8_t_array(msg
, data
, 110, 3);
263 * @brief Decode a gps_inject_data message into a struct
265 * @param msg The message to decode
266 * @param gps_inject_data C-struct to decode the message contents into
268 static inline void mavlink_msg_gps_inject_data_decode(const mavlink_message_t
* msg
, mavlink_gps_inject_data_t
* gps_inject_data
)
270 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
271 gps_inject_data
->target_system
= mavlink_msg_gps_inject_data_get_target_system(msg
);
272 gps_inject_data
->target_component
= mavlink_msg_gps_inject_data_get_target_component(msg
);
273 gps_inject_data
->len
= mavlink_msg_gps_inject_data_get_len(msg
);
274 mavlink_msg_gps_inject_data_get_data(msg
, gps_inject_data
->data
);
276 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
? msg
->len
: MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
;
277 memset(gps_inject_data
, 0, MAVLINK_MSG_ID_GPS_INJECT_DATA_LEN
);
278 memcpy(gps_inject_data
, _MAV_PAYLOAD(msg
), len
);