Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE SET_GPS_GLOBAL_ORIGIN PACKING
2
 
3
#define MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN 48
4
 
5
typedef struct __mavlink_set_gps_global_origin_t
6
{
7
 int32_t latitude; ///< global position * 1E7
8
 int32_t longitude; ///< global position * 1E7
9
 int32_t altitude; ///< global position * 1000
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_48_LEN 13
15
 
16
 
17
 
18
#define MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN { \
19
        "SET_GPS_GLOBAL_ORIGIN", \
20
        4, \
21
        {  { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_gps_global_origin_t, latitude) }, \
22
         { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_gps_global_origin_t, longitude) }, \
23
         { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_gps_global_origin_t, altitude) }, \
24
         { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_set_gps_global_origin_t, target_system) }, \
25
         } \
26
}
27
 
28
 
29
/**
30
 * @brief Pack a set_gps_global_origin message
31
 * @param system_id ID of this system
32
 * @param component_id ID of this component (e.g. 200 for IMU)
33
 * @param msg The MAVLink message to compress the data into
34
 *
35
 * @param target_system System ID
36
 * @param latitude global position * 1E7
37
 * @param longitude global position * 1E7
38
 * @param altitude global position * 1000
39
 * @return length of the message in bytes (excluding serial stream start sign)
40
 */
41
static inline uint16_t mavlink_msg_set_gps_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
42
                                                       uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude)
43
{
44
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
45
        char buf[13];
46
        _mav_put_int32_t(buf, 0, latitude);
47
        _mav_put_int32_t(buf, 4, longitude);
48
        _mav_put_int32_t(buf, 8, altitude);
49
        _mav_put_uint8_t(buf, 12, target_system);
50
 
51
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 13);
52
#else
53
        mavlink_set_gps_global_origin_t packet;
54
        packet.latitude = latitude;
55
        packet.longitude = longitude;
56
        packet.altitude = altitude;
57
        packet.target_system = target_system;
58
 
59
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 13);
60
#endif
61
 
62
        msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
63
        return mavlink_finalize_message(msg, system_id, component_id, 13, 41);
64
}
65
 
66
/**
67
 * @brief Pack a set_gps_global_origin message on a channel
68
 * @param system_id ID of this system
69
 * @param component_id ID of this component (e.g. 200 for IMU)
70
 * @param chan The MAVLink channel this message was sent over
71
 * @param msg The MAVLink message to compress the data into
72
 * @param target_system System ID
73
 * @param latitude global position * 1E7
74
 * @param longitude global position * 1E7
75
 * @param altitude global position * 1000
76
 * @return length of the message in bytes (excluding serial stream start sign)
77
 */
78
static inline uint16_t mavlink_msg_set_gps_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
79
                                                           mavlink_message_t* msg,
80
                                                           uint8_t target_system,int32_t latitude,int32_t longitude,int32_t altitude)
81
{
82
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83
        char buf[13];
84
        _mav_put_int32_t(buf, 0, latitude);
85
        _mav_put_int32_t(buf, 4, longitude);
86
        _mav_put_int32_t(buf, 8, altitude);
87
        _mav_put_uint8_t(buf, 12, target_system);
88
 
89
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 13);
90
#else
91
        mavlink_set_gps_global_origin_t packet;
92
        packet.latitude = latitude;
93
        packet.longitude = longitude;
94
        packet.altitude = altitude;
95
        packet.target_system = target_system;
96
 
97
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 13);
98
#endif
99
 
100
        msg->msgid = MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN;
101
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 13, 41);
102
}
103
 
104
/**
105
 * @brief Encode a set_gps_global_origin struct into a message
106
 *
107
 * @param system_id ID of this system
108
 * @param component_id ID of this component (e.g. 200 for IMU)
109
 * @param msg The MAVLink message to compress the data into
110
 * @param set_gps_global_origin C-struct to read the message contents from
111
 */
112
static 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)
113
{
114
        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);
115
}
116
 
117
/**
118
 * @brief Send a set_gps_global_origin message
119
 * @param chan MAVLink channel to send the message
120
 *
121
 * @param target_system System ID
122
 * @param latitude global position * 1E7
123
 * @param longitude global position * 1E7
124
 * @param altitude global position * 1000
125
 */
126
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
127
 
128
static 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)
129
{
130
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
131
        char buf[13];
132
        _mav_put_int32_t(buf, 0, latitude);
133
        _mav_put_int32_t(buf, 4, longitude);
134
        _mav_put_int32_t(buf, 8, altitude);
135
        _mav_put_uint8_t(buf, 12, target_system);
136
 
137
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, buf, 13, 41);
138
#else
139
        mavlink_set_gps_global_origin_t packet;
140
        packet.latitude = latitude;
141
        packet.longitude = longitude;
142
        packet.altitude = altitude;
143
        packet.target_system = target_system;
144
 
145
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN, (const char *)&packet, 13, 41);
146
#endif
147
}
148
 
149
#endif
150
 
151
// MESSAGE SET_GPS_GLOBAL_ORIGIN UNPACKING
152
 
153
 
154
/**
155
 * @brief Get field target_system from set_gps_global_origin message
156
 *
157
 * @return System ID
158
 */
159
static inline uint8_t mavlink_msg_set_gps_global_origin_get_target_system(const mavlink_message_t* msg)
160
{
161
        return _MAV_RETURN_uint8_t(msg,  12);
162
}
163
 
164
/**
165
 * @brief Get field latitude from set_gps_global_origin message
166
 *
167
 * @return global position * 1E7
168
 */
169
static inline int32_t mavlink_msg_set_gps_global_origin_get_latitude(const mavlink_message_t* msg)
170
{
171
        return _MAV_RETURN_int32_t(msg,  0);
172
}
173
 
174
/**
175
 * @brief Get field longitude from set_gps_global_origin message
176
 *
177
 * @return global position * 1E7
178
 */
179
static inline int32_t mavlink_msg_set_gps_global_origin_get_longitude(const mavlink_message_t* msg)
180
{
181
        return _MAV_RETURN_int32_t(msg,  4);
182
}
183
 
184
/**
185
 * @brief Get field altitude from set_gps_global_origin message
186
 *
187
 * @return global position * 1000
188
 */
189
static inline int32_t mavlink_msg_set_gps_global_origin_get_altitude(const mavlink_message_t* msg)
190
{
191
        return _MAV_RETURN_int32_t(msg,  8);
192
}
193
 
194
/**
195
 * @brief Decode a set_gps_global_origin message into a struct
196
 *
197
 * @param msg The message to decode
198
 * @param set_gps_global_origin C-struct to decode the message contents into
199
 */
200
static inline void mavlink_msg_set_gps_global_origin_decode(const mavlink_message_t* msg, mavlink_set_gps_global_origin_t* set_gps_global_origin)
201
{
202
#if MAVLINK_NEED_BYTE_SWAP
203
        set_gps_global_origin->latitude = mavlink_msg_set_gps_global_origin_get_latitude(msg);
204
        set_gps_global_origin->longitude = mavlink_msg_set_gps_global_origin_get_longitude(msg);
205
        set_gps_global_origin->altitude = mavlink_msg_set_gps_global_origin_get_altitude(msg);
206
        set_gps_global_origin->target_system = mavlink_msg_set_gps_global_origin_get_target_system(msg);
207
#else
208
        memcpy(set_gps_global_origin, _MAV_PAYLOAD(msg), 13);
209
#endif
210
}