2 // MESSAGE GPS_GLOBAL_ORIGIN PACKING
4 #define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN 49
7 typedef struct __mavlink_gps_global_origin_t
{
8 int32_t latitude
; /*< Latitude (WGS84), in degrees * 1E7*/
9 int32_t longitude
; /*< Longitude (WGS84), in degrees * 1E7*/
10 int32_t altitude
; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
11 }) mavlink_gps_global_origin_t
;
13 #define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN 12
14 #define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN 12
15 #define MAVLINK_MSG_ID_49_LEN 12
16 #define MAVLINK_MSG_ID_49_MIN_LEN 12
18 #define MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC 39
19 #define MAVLINK_MSG_ID_49_CRC 39
23 #if MAVLINK_COMMAND_24BIT
24 #define MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN { \
26 "GPS_GLOBAL_ORIGIN", \
28 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_gps_global_origin_t, latitude) }, \
29 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_gps_global_origin_t, longitude) }, \
30 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_global_origin_t, altitude) }, \
34 #define MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN { \
35 "GPS_GLOBAL_ORIGIN", \
37 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_gps_global_origin_t, latitude) }, \
38 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_gps_global_origin_t, longitude) }, \
39 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_global_origin_t, altitude) }, \
45 * @brief Pack a gps_global_origin message
46 * @param system_id ID of this system
47 * @param component_id ID of this component (e.g. 200 for IMU)
48 * @param msg The MAVLink message to compress the data into
50 * @param latitude Latitude (WGS84), in degrees * 1E7
51 * @param longitude Longitude (WGS84), in degrees * 1E7
52 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
53 * @return length of the message in bytes (excluding serial stream start sign)
55 static inline uint16_t mavlink_msg_gps_global_origin_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
56 int32_t latitude
, int32_t longitude
, int32_t altitude
)
58 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
59 char buf
[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
];
60 _mav_put_int32_t(buf
, 0, latitude
);
61 _mav_put_int32_t(buf
, 4, longitude
);
62 _mav_put_int32_t(buf
, 8, altitude
);
64 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
);
66 mavlink_gps_global_origin_t packet
;
67 packet
.latitude
= latitude
;
68 packet
.longitude
= longitude
;
69 packet
.altitude
= altitude
;
71 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
);
74 msg
->msgid
= MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
;
75 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
79 * @brief Pack a gps_global_origin message on a channel
80 * @param system_id ID of this system
81 * @param component_id ID of this component (e.g. 200 for IMU)
82 * @param chan The MAVLink channel this message will be sent over
83 * @param msg The MAVLink message to compress the data into
84 * @param latitude Latitude (WGS84), in degrees * 1E7
85 * @param longitude Longitude (WGS84), in degrees * 1E7
86 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
87 * @return length of the message in bytes (excluding serial stream start sign)
89 static inline uint16_t mavlink_msg_gps_global_origin_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
90 mavlink_message_t
* msg
,
91 int32_t latitude
,int32_t longitude
,int32_t altitude
)
93 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
94 char buf
[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
];
95 _mav_put_int32_t(buf
, 0, latitude
);
96 _mav_put_int32_t(buf
, 4, longitude
);
97 _mav_put_int32_t(buf
, 8, altitude
);
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
);
101 mavlink_gps_global_origin_t packet
;
102 packet
.latitude
= latitude
;
103 packet
.longitude
= longitude
;
104 packet
.altitude
= altitude
;
106 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
);
109 msg
->msgid
= MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
;
110 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
114 * @brief Encode a gps_global_origin struct
116 * @param system_id ID of this system
117 * @param component_id ID of this component (e.g. 200 for IMU)
118 * @param msg The MAVLink message to compress the data into
119 * @param gps_global_origin C-struct to read the message contents from
121 static inline uint16_t mavlink_msg_gps_global_origin_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_gps_global_origin_t
* gps_global_origin
)
123 return mavlink_msg_gps_global_origin_pack(system_id
, component_id
, msg
, gps_global_origin
->latitude
, gps_global_origin
->longitude
, gps_global_origin
->altitude
);
127 * @brief Encode a gps_global_origin struct on a channel
129 * @param system_id ID of this system
130 * @param component_id ID of this component (e.g. 200 for IMU)
131 * @param chan The MAVLink channel this message will be sent over
132 * @param msg The MAVLink message to compress the data into
133 * @param gps_global_origin C-struct to read the message contents from
135 static inline uint16_t mavlink_msg_gps_global_origin_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_gps_global_origin_t
* gps_global_origin
)
137 return mavlink_msg_gps_global_origin_pack_chan(system_id
, component_id
, chan
, msg
, gps_global_origin
->latitude
, gps_global_origin
->longitude
, gps_global_origin
->altitude
);
141 * @brief Send a gps_global_origin message
142 * @param chan MAVLink channel to send the message
144 * @param latitude Latitude (WGS84), in degrees * 1E7
145 * @param longitude Longitude (WGS84), in degrees * 1E7
146 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
148 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
150 static inline void mavlink_msg_gps_global_origin_send(mavlink_channel_t chan
, int32_t latitude
, int32_t longitude
, int32_t altitude
)
152 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
153 char buf
[MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
];
154 _mav_put_int32_t(buf
, 0, latitude
);
155 _mav_put_int32_t(buf
, 4, longitude
);
156 _mav_put_int32_t(buf
, 8, altitude
);
158 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
, buf
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
160 mavlink_gps_global_origin_t packet
;
161 packet
.latitude
= latitude
;
162 packet
.longitude
= longitude
;
163 packet
.altitude
= altitude
;
165 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
, (const char *)&packet
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
170 * @brief Send a gps_global_origin message
171 * @param chan MAVLink channel to send the message
172 * @param struct The MAVLink struct to serialize
174 static inline void mavlink_msg_gps_global_origin_send_struct(mavlink_channel_t chan
, const mavlink_gps_global_origin_t
* gps_global_origin
)
176 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
177 mavlink_msg_gps_global_origin_send(chan
, gps_global_origin
->latitude
, gps_global_origin
->longitude
, gps_global_origin
->altitude
);
179 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
, (const char *)gps_global_origin
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
183 #if MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN <= MAVLINK_MAX_PAYLOAD_LEN
185 This varient of _send() can be used to save stack space by re-using
186 memory from the receive buffer. The caller provides a
187 mavlink_message_t which is the size of a full mavlink message. This
188 is usually the receive buffer for the channel, and allows a reply to an
189 incoming message with minimum stack space usage.
191 static inline void mavlink_msg_gps_global_origin_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, int32_t latitude
, int32_t longitude
, int32_t altitude
)
193 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
194 char *buf
= (char *)msgbuf
;
195 _mav_put_int32_t(buf
, 0, latitude
);
196 _mav_put_int32_t(buf
, 4, longitude
);
197 _mav_put_int32_t(buf
, 8, altitude
);
199 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
, buf
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
201 mavlink_gps_global_origin_t
*packet
= (mavlink_gps_global_origin_t
*)msgbuf
;
202 packet
->latitude
= latitude
;
203 packet
->longitude
= longitude
;
204 packet
->altitude
= altitude
;
206 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN
, (const char *)packet
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_CRC
);
213 // MESSAGE GPS_GLOBAL_ORIGIN UNPACKING
217 * @brief Get field latitude from gps_global_origin message
219 * @return Latitude (WGS84), in degrees * 1E7
221 static inline int32_t mavlink_msg_gps_global_origin_get_latitude(const mavlink_message_t
* msg
)
223 return _MAV_RETURN_int32_t(msg
, 0);
227 * @brief Get field longitude from gps_global_origin message
229 * @return Longitude (WGS84), in degrees * 1E7
231 static inline int32_t mavlink_msg_gps_global_origin_get_longitude(const mavlink_message_t
* msg
)
233 return _MAV_RETURN_int32_t(msg
, 4);
237 * @brief Get field altitude from gps_global_origin message
239 * @return Altitude (AMSL), in meters * 1000 (positive for up)
241 static inline int32_t mavlink_msg_gps_global_origin_get_altitude(const mavlink_message_t
* msg
)
243 return _MAV_RETURN_int32_t(msg
, 8);
247 * @brief Decode a gps_global_origin message into a struct
249 * @param msg The message to decode
250 * @param gps_global_origin C-struct to decode the message contents into
252 static inline void mavlink_msg_gps_global_origin_decode(const mavlink_message_t
* msg
, mavlink_gps_global_origin_t
* gps_global_origin
)
254 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
255 gps_global_origin
->latitude
= mavlink_msg_gps_global_origin_get_latitude(msg
);
256 gps_global_origin
->longitude
= mavlink_msg_gps_global_origin_get_longitude(msg
);
257 gps_global_origin
->altitude
= mavlink_msg_gps_global_origin_get_altitude(msg
);
259 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
? msg
->len
: MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
;
260 memset(gps_global_origin
, 0, MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_LEN
);
261 memcpy(gps_global_origin
, _MAV_PAYLOAD(msg
), len
);