MAV'RIC
mavlink_msg_global_position_setpoint_int.h
1 // MESSAGE GLOBAL_POSITION_SETPOINT_INT PACKING
2 
3 #define MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT 155
4 
6 {
7  int32_t latitude;
8  int32_t longitude;
9  int32_t altitude;
10  int16_t yaw;
11  uint8_t coordinate_frame;
13 
14 #define MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN 15
15 #define MAVLINK_MSG_ID_155_LEN 15
16 
17 #define MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC 141
18 #define MAVLINK_MSG_ID_155_CRC 141
19 
20 
21 
22 #define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT { \
23  "GLOBAL_POSITION_SETPOINT_INT", \
24  5, \
25  { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_global_position_setpoint_int_t, latitude) }, \
26  { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_setpoint_int_t, longitude) }, \
27  { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_setpoint_int_t, altitude) }, \
28  { "yaw", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_global_position_setpoint_int_t, yaw) }, \
29  { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_global_position_setpoint_int_t, coordinate_frame) }, \
30  } \
31 }
32 
33 
47 static inline uint16_t mavlink_msg_global_position_setpoint_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48  uint8_t coordinate_frame, int32_t latitude, int32_t longitude, int32_t altitude, int16_t yaw)
49 {
50 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
51  char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN];
52  _mav_put_int32_t(buf, 0, latitude);
53  _mav_put_int32_t(buf, 4, longitude);
54  _mav_put_int32_t(buf, 8, altitude);
55  _mav_put_int16_t(buf, 12, yaw);
56  _mav_put_uint8_t(buf, 14, coordinate_frame);
57 
58  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
59 #else
61  packet.latitude = latitude;
62  packet.longitude = longitude;
63  packet.altitude = altitude;
64  packet.yaw = yaw;
65  packet.coordinate_frame = coordinate_frame;
66 
67  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
68 #endif
69 
70  msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT;
71 #if MAVLINK_CRC_EXTRA
72  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
73 #else
74  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
75 #endif
76 }
77 
91 static inline uint16_t mavlink_msg_global_position_setpoint_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
92  mavlink_message_t* msg,
93  uint8_t coordinate_frame,int32_t latitude,int32_t longitude,int32_t altitude,int16_t yaw)
94 {
95 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
96  char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN];
97  _mav_put_int32_t(buf, 0, latitude);
98  _mav_put_int32_t(buf, 4, longitude);
99  _mav_put_int32_t(buf, 8, altitude);
100  _mav_put_int16_t(buf, 12, yaw);
101  _mav_put_uint8_t(buf, 14, coordinate_frame);
102 
103  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
104 #else
106  packet.latitude = latitude;
107  packet.longitude = longitude;
108  packet.altitude = altitude;
109  packet.yaw = yaw;
110  packet.coordinate_frame = coordinate_frame;
111 
112  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
113 #endif
114 
115  msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT;
116 #if MAVLINK_CRC_EXTRA
117  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
118 #else
119  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
120 #endif
121 }
122 
131 static inline uint16_t mavlink_msg_global_position_setpoint_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_setpoint_int_t* global_position_setpoint_int)
132 {
133  return mavlink_msg_global_position_setpoint_int_pack(system_id, component_id, msg, global_position_setpoint_int->coordinate_frame, global_position_setpoint_int->latitude, global_position_setpoint_int->longitude, global_position_setpoint_int->altitude, global_position_setpoint_int->yaw);
134 }
135 
145 static inline uint16_t mavlink_msg_global_position_setpoint_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_global_position_setpoint_int_t* global_position_setpoint_int)
146 {
147  return mavlink_msg_global_position_setpoint_int_pack_chan(system_id, component_id, chan, msg, global_position_setpoint_int->coordinate_frame, global_position_setpoint_int->latitude, global_position_setpoint_int->longitude, global_position_setpoint_int->altitude, global_position_setpoint_int->yaw);
148 }
149 
160 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
161 
162 static inline void mavlink_msg_global_position_setpoint_int_send(mavlink_channel_t chan, uint8_t coordinate_frame, int32_t latitude, int32_t longitude, int32_t altitude, int16_t yaw)
163 {
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165  char buf[MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN];
166  _mav_put_int32_t(buf, 0, latitude);
167  _mav_put_int32_t(buf, 4, longitude);
168  _mav_put_int32_t(buf, 8, altitude);
169  _mav_put_int16_t(buf, 12, yaw);
170  _mav_put_uint8_t(buf, 14, coordinate_frame);
171 
172 #if MAVLINK_CRC_EXTRA
173  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
174 #else
175  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
176 #endif
177 #else
179  packet.latitude = latitude;
180  packet.longitude = longitude;
181  packet.altitude = altitude;
182  packet.yaw = yaw;
183  packet.coordinate_frame = coordinate_frame;
184 
185 #if MAVLINK_CRC_EXTRA
186  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
187 #else
188  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, (const char *)&packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
189 #endif
190 #endif
191 }
192 
193 #if MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
194 /*
195  This varient of _send() can be used to save stack space by re-using
196  memory from the receive buffer. The caller provides a
197  mavlink_message_t which is the size of a full mavlink message. This
198  is usually the receive buffer for the channel, and allows a reply to an
199  incoming message with minimum stack space usage.
200  */
201 static inline void mavlink_msg_global_position_setpoint_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t coordinate_frame, int32_t latitude, int32_t longitude, int32_t altitude, int16_t yaw)
202 {
203 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
204  char *buf = (char *)msgbuf;
205  _mav_put_int32_t(buf, 0, latitude);
206  _mav_put_int32_t(buf, 4, longitude);
207  _mav_put_int32_t(buf, 8, altitude);
208  _mav_put_int16_t(buf, 12, yaw);
209  _mav_put_uint8_t(buf, 14, coordinate_frame);
210 
211 #if MAVLINK_CRC_EXTRA
212  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
213 #else
214  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, buf, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
215 #endif
216 #else
218  packet->latitude = latitude;
219  packet->longitude = longitude;
220  packet->altitude = altitude;
221  packet->yaw = yaw;
222  packet->coordinate_frame = coordinate_frame;
223 
224 #if MAVLINK_CRC_EXTRA
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_CRC);
226 #else
227  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT, (const char *)packet, MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
228 #endif
229 #endif
230 }
231 #endif
232 
233 #endif
234 
235 // MESSAGE GLOBAL_POSITION_SETPOINT_INT UNPACKING
236 
237 
243 static inline uint8_t mavlink_msg_global_position_setpoint_int_get_coordinate_frame(const mavlink_message_t* msg)
244 {
245  return _MAV_RETURN_uint8_t(msg, 14);
246 }
247 
253 static inline int32_t mavlink_msg_global_position_setpoint_int_get_latitude(const mavlink_message_t* msg)
254 {
255  return _MAV_RETURN_int32_t(msg, 0);
256 }
257 
263 static inline int32_t mavlink_msg_global_position_setpoint_int_get_longitude(const mavlink_message_t* msg)
264 {
265  return _MAV_RETURN_int32_t(msg, 4);
266 }
267 
273 static inline int32_t mavlink_msg_global_position_setpoint_int_get_altitude(const mavlink_message_t* msg)
274 {
275  return _MAV_RETURN_int32_t(msg, 8);
276 }
277 
283 static inline int16_t mavlink_msg_global_position_setpoint_int_get_yaw(const mavlink_message_t* msg)
284 {
285  return _MAV_RETURN_int16_t(msg, 12);
286 }
287 
294 static inline void mavlink_msg_global_position_setpoint_int_decode(const mavlink_message_t* msg, mavlink_global_position_setpoint_int_t* global_position_setpoint_int)
295 {
296 #if MAVLINK_NEED_BYTE_SWAP
297  global_position_setpoint_int->latitude = mavlink_msg_global_position_setpoint_int_get_latitude(msg);
298  global_position_setpoint_int->longitude = mavlink_msg_global_position_setpoint_int_get_longitude(msg);
299  global_position_setpoint_int->altitude = mavlink_msg_global_position_setpoint_int_get_altitude(msg);
300  global_position_setpoint_int->yaw = mavlink_msg_global_position_setpoint_int_get_yaw(msg);
301  global_position_setpoint_int->coordinate_frame = mavlink_msg_global_position_setpoint_int_get_coordinate_frame(msg);
302 #else
303  memcpy(global_position_setpoint_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_GLOBAL_POSITION_SETPOINT_INT_LEN);
304 #endif
305 }