source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_set_gps_global_origin.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: 12.4 KB
Line 
1// MESSAGE SET_GPS_GLOBAL_ORIGIN PACKING
2
3#define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN 48
4
5typedef struct MAVLINK_PACKED __mavlink_set_gps_global_origin_t
6{
7 int32_t latitude; /*< Latitude (WGS84), in degrees * 1E7*/
8 int32_t longitude; /*< Longitude (WGS84, in degrees * 1E7*/
9 int32_t altitude; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
10 uint8_t target_system; /*< System ID*/
11} mavlink_set_gps_global_origin_t;
12
13#define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN 13
14#define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN 13
15#define MAVLINK_MSG_ID_48_LEN 13
16#define MAVLINK_MSG_ID_48_MIN_LEN 13
17
18#define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC 41
19#define MAVLINK_MSG_ID_48_CRC 41
20
21
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN { \
25 48, \
26 "SET_GPS_GLOBAL_ORIGIN", \
27 4, \
28 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_gps_global_origin_t, latitude) }, \
29 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_gps_global_origin_t, longitude) }, \
30 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_gps_global_origin_t, altitude) }, \
31 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_gps_global_origin_t, target_system) }, \
32 } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN { \
36 "SET_GPS_GLOBAL_ORIGIN", \
37 4, \
38 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_gps_global_origin_t, latitude) }, \
39 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_gps_global_origin_t, longitude) }, \
40 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_gps_global_origin_t, altitude) }, \
41 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_gps_global_origin_t, target_system) }, \
42 } \
43}
44#endif
45
46/**
47 * @brief Pack a set_gps_global_origin 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 latitude Latitude (WGS84), in degrees * 1E7
54 * @param longitude Longitude (WGS84, in degrees * 1E7
55 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_set_gps_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59 uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
63 _mav_put_int32_t(buf, 0, latitude);
64 _mav_put_int32_t(buf, 4, longitude);
65 _mav_put_int32_t(buf, 8, altitude);
66 _mav_put_uint8_t(buf, 12, target_system);
67
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
69#else
70 mavlink_set_gps_global_origin_t packet;
71 packet.latitude = latitude;
72 packet.longitude = longitude;
73 packet.altitude = altitude;
74 packet.target_system = target_system;
75
76 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
77#endif
78
79 msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
80 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
81}
82
83/**
84 * @brief Pack a set_gps_global_origin message on a channel
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param chan The MAVLink channel this message will be sent over
88 * @param msg The MAVLink message to compress the data into
89 * @param target_system System ID
90 * @param latitude Latitude (WGS84), in degrees * 1E7
91 * @param longitude Longitude (WGS84, in degrees * 1E7
92 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_set_gps_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96 mavlink_message_t* msg,
97 uint8_t target_system,int32_t latitude,int32_t longitude,int32_t altitude)
98{
99#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
101 _mav_put_int32_t(buf, 0, latitude);
102 _mav_put_int32_t(buf, 4, longitude);
103 _mav_put_int32_t(buf, 8, altitude);
104 _mav_put_uint8_t(buf, 12, target_system);
105
106 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
107#else
108 mavlink_set_gps_global_origin_t packet;
109 packet.latitude = latitude;
110 packet.longitude = longitude;
111 packet.altitude = altitude;
112 packet.target_system = target_system;
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
115#endif
116
117 msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
118 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
119}
120
121/**
122 * @brief Encode a set_gps_global_origin struct
123 *
124 * @param system_id ID of this system
125 * @param component_id ID of this component (e.g. 200 for IMU)
126 * @param msg The MAVLink message to compress the data into
127 * @param set_gps_global_origin C-struct to read the message contents from
128 */
129static inline uint16_t mavlink_msg_set_gps_global_origin_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_gps_global_origin_t* set_gps_global_origin)
130{
131 return mavlink_msg_set_gps_global_origin_pack(system_id, component_id, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude);
132}
133
134/**
135 * @brief Encode a set_gps_global_origin struct on a channel
136 *
137 * @param system_id ID of this system
138 * @param component_id ID of this component (e.g. 200 for IMU)
139 * @param chan The MAVLink channel this message will be sent over
140 * @param msg The MAVLink message to compress the data into
141 * @param set_gps_global_origin C-struct to read the message contents from
142 */
143static inline uint16_t mavlink_msg_set_gps_global_origin_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_gps_global_origin_t* set_gps_global_origin)
144{
145 return mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, chan, msg, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude);
146}
147
148/**
149 * @brief Send a set_gps_global_origin message
150 * @param chan MAVLink channel to send the message
151 *
152 * @param target_system System ID
153 * @param latitude Latitude (WGS84), in degrees * 1E7
154 * @param longitude Longitude (WGS84, in degrees * 1E7
155 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
156 */
157#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
158
159static inline void mavlink_msg_set_gps_global_origin_send(mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
160{
161#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
162 char buf[MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN];
163 _mav_put_int32_t(buf, 0, latitude);
164 _mav_put_int32_t(buf, 4, longitude);
165 _mav_put_int32_t(buf, 8, altitude);
166 _mav_put_uint8_t(buf, 12, target_system);
167
168 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
169#else
170 mavlink_set_gps_global_origin_t packet;
171 packet.latitude = latitude;
172 packet.longitude = longitude;
173 packet.altitude = altitude;
174 packet.target_system = target_system;
175
176 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)&packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
177#endif
178}
179
180/**
181 * @brief Send a set_gps_global_origin message
182 * @param chan MAVLink channel to send the message
183 * @param struct The MAVLink struct to serialize
184 */
185static inline void mavlink_msg_set_gps_global_origin_send_struct(mavlink_channel_t chan, const mavlink_set_gps_global_origin_t* set_gps_global_origin)
186{
187#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
188 mavlink_msg_set_gps_global_origin_send(chan, set_gps_global_origin->target_system, set_gps_global_origin->latitude, set_gps_global_origin->longitude, set_gps_global_origin->altitude);
189#else
190 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)set_gps_global_origin, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
191#endif
192}
193
194#if MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN <= MAVLINK_MAX_PAYLOAD_LEN
195/*
196 This varient of _send() can be used to save stack space by re-using
197 memory from the receive buffer. The caller provides a
198 mavlink_message_t which is the size of a full mavlink message. This
199 is usually the receive buffer for the channel, and allows a reply to an
200 incoming message with minimum stack space usage.
201 */
202static inline void mavlink_msg_set_gps_global_origin_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
203{
204#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
205 char *buf = (char *)msgbuf;
206 _mav_put_int32_t(buf, 0, latitude);
207 _mav_put_int32_t(buf, 4, longitude);
208 _mav_put_int32_t(buf, 8, altitude);
209 _mav_put_uint8_t(buf, 12, target_system);
210
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
212#else
213 mavlink_set_gps_global_origin_t *packet = (mavlink_set_gps_global_origin_t *)msgbuf;
214 packet->latitude = latitude;
215 packet->longitude = longitude;
216 packet->altitude = altitude;
217 packet->target_system = target_system;
218
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)packet, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_CRC);
220#endif
221}
222#endif
223
224#endif
225
226// MESSAGE SET_GPS_GLOBAL_ORIGIN UNPACKING
227
228
229/**
230 * @brief Get field target_system from set_gps_global_origin message
231 *
232 * @return System ID
233 */
234static inline uint8_t mavlink_msg_set_gps_global_origin_get_target_system(const mavlink_message_t* msg)
235{
236 return _MAV_RETURN_uint8_t(msg, 12);
237}
238
239/**
240 * @brief Get field latitude from set_gps_global_origin message
241 *
242 * @return Latitude (WGS84), in degrees * 1E7
243 */
244static inline int32_t mavlink_msg_set_gps_global_origin_get_latitude(const mavlink_message_t* msg)
245{
246 return _MAV_RETURN_int32_t(msg, 0);
247}
248
249/**
250 * @brief Get field longitude from set_gps_global_origin message
251 *
252 * @return Longitude (WGS84, in degrees * 1E7
253 */
254static inline int32_t mavlink_msg_set_gps_global_origin_get_longitude(const mavlink_message_t* msg)
255{
256 return _MAV_RETURN_int32_t(msg, 4);
257}
258
259/**
260 * @brief Get field altitude from set_gps_global_origin message
261 *
262 * @return Altitude (AMSL), in meters * 1000 (positive for up)
263 */
264static inline int32_t mavlink_msg_set_gps_global_origin_get_altitude(const mavlink_message_t* msg)
265{
266 return _MAV_RETURN_int32_t(msg, 8);
267}
268
269/**
270 * @brief Decode a set_gps_global_origin message into a struct
271 *
272 * @param msg The message to decode
273 * @param set_gps_global_origin C-struct to decode the message contents into
274 */
275static inline void mavlink_msg_set_gps_global_origin_decode(const mavlink_message_t* msg, mavlink_set_gps_global_origin_t* set_gps_global_origin)
276{
277#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 set_gps_global_origin->latitude = mavlink_msg_set_gps_global_origin_get_latitude(msg);
279 set_gps_global_origin->longitude = mavlink_msg_set_gps_global_origin_get_longitude(msg);
280 set_gps_global_origin->altitude = mavlink_msg_set_gps_global_origin_get_altitude(msg);
281 set_gps_global_origin->target_system = mavlink_msg_set_gps_global_origin_get_target_system(msg);
282#else
283 uint8_t len = msg->len < MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN? msg->len : MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN;
284 memset(set_gps_global_origin, 0, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_LEN);
285 memcpy(set_gps_global_origin, _MAV_PAYLOAD(msg), len);
286#endif
287}
Note: See TracBrowser for help on using the repository browser.