before merging master
[inav.git] / lib / main / MAVLink / common / mavlink_msg_ais_vessel.h
blobe97fe42bcddad53852b9537282926ae90c105439
1 #pragma once
2 // MESSAGE AIS_VESSEL PACKING
4 #define MAVLINK_MSG_ID_AIS_VESSEL 301
7 typedef struct __mavlink_ais_vessel_t {
8 uint32_t MMSI; /*< Mobile Marine Service Identifier, 9 decimal digits*/
9 int32_t lat; /*< [degE7] Latitude*/
10 int32_t lon; /*< [degE7] Longitude*/
11 uint16_t COG; /*< [cdeg] Course over ground*/
12 uint16_t heading; /*< [cdeg] True heading*/
13 uint16_t velocity; /*< [cm/s] Speed over ground*/
14 uint16_t dimension_bow; /*< [m] Distance from lat/lon location to bow*/
15 uint16_t dimension_stern; /*< [m] Distance from lat/lon location to stern*/
16 uint16_t tslc; /*< [s] Time since last communication in seconds*/
17 uint16_t flags; /*< Bitmask to indicate various statuses including valid data fields*/
18 int8_t turn_rate; /*< [cdeg/s] Turn rate*/
19 uint8_t navigational_status; /*< Navigational status*/
20 uint8_t type; /*< Type of vessels*/
21 uint8_t dimension_port; /*< [m] Distance from lat/lon location to port side*/
22 uint8_t dimension_starboard; /*< [m] Distance from lat/lon location to starboard side*/
23 char callsign[7]; /*< The vessel callsign*/
24 char name[20]; /*< The vessel name*/
25 } mavlink_ais_vessel_t;
27 #define MAVLINK_MSG_ID_AIS_VESSEL_LEN 58
28 #define MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN 58
29 #define MAVLINK_MSG_ID_301_LEN 58
30 #define MAVLINK_MSG_ID_301_MIN_LEN 58
32 #define MAVLINK_MSG_ID_AIS_VESSEL_CRC 243
33 #define MAVLINK_MSG_ID_301_CRC 243
35 #define MAVLINK_MSG_AIS_VESSEL_FIELD_CALLSIGN_LEN 7
36 #define MAVLINK_MSG_AIS_VESSEL_FIELD_NAME_LEN 20
38 #if MAVLINK_COMMAND_24BIT
39 #define MAVLINK_MESSAGE_INFO_AIS_VESSEL { \
40 301, \
41 "AIS_VESSEL", \
42 17, \
43 { { "MMSI", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_ais_vessel_t, MMSI) }, \
44 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_ais_vessel_t, lat) }, \
45 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_ais_vessel_t, lon) }, \
46 { "COG", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_ais_vessel_t, COG) }, \
47 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_ais_vessel_t, heading) }, \
48 { "velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_ais_vessel_t, velocity) }, \
49 { "turn_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 26, offsetof(mavlink_ais_vessel_t, turn_rate) }, \
50 { "navigational_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_ais_vessel_t, navigational_status) }, \
51 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_ais_vessel_t, type) }, \
52 { "dimension_bow", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_ais_vessel_t, dimension_bow) }, \
53 { "dimension_stern", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_ais_vessel_t, dimension_stern) }, \
54 { "dimension_port", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_ais_vessel_t, dimension_port) }, \
55 { "dimension_starboard", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_ais_vessel_t, dimension_starboard) }, \
56 { "callsign", NULL, MAVLINK_TYPE_CHAR, 7, 31, offsetof(mavlink_ais_vessel_t, callsign) }, \
57 { "name", NULL, MAVLINK_TYPE_CHAR, 20, 38, offsetof(mavlink_ais_vessel_t, name) }, \
58 { "tslc", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_ais_vessel_t, tslc) }, \
59 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_ais_vessel_t, flags) }, \
60 } \
62 #else
63 #define MAVLINK_MESSAGE_INFO_AIS_VESSEL { \
64 "AIS_VESSEL", \
65 17, \
66 { { "MMSI", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_ais_vessel_t, MMSI) }, \
67 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_ais_vessel_t, lat) }, \
68 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_ais_vessel_t, lon) }, \
69 { "COG", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_ais_vessel_t, COG) }, \
70 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_ais_vessel_t, heading) }, \
71 { "velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_ais_vessel_t, velocity) }, \
72 { "turn_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 26, offsetof(mavlink_ais_vessel_t, turn_rate) }, \
73 { "navigational_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_ais_vessel_t, navigational_status) }, \
74 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_ais_vessel_t, type) }, \
75 { "dimension_bow", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_ais_vessel_t, dimension_bow) }, \
76 { "dimension_stern", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_ais_vessel_t, dimension_stern) }, \
77 { "dimension_port", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_ais_vessel_t, dimension_port) }, \
78 { "dimension_starboard", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_ais_vessel_t, dimension_starboard) }, \
79 { "callsign", NULL, MAVLINK_TYPE_CHAR, 7, 31, offsetof(mavlink_ais_vessel_t, callsign) }, \
80 { "name", NULL, MAVLINK_TYPE_CHAR, 20, 38, offsetof(mavlink_ais_vessel_t, name) }, \
81 { "tslc", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_ais_vessel_t, tslc) }, \
82 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_ais_vessel_t, flags) }, \
83 } \
85 #endif
87 /**
88 * @brief Pack a ais_vessel message
89 * @param system_id ID of this system
90 * @param component_id ID of this component (e.g. 200 for IMU)
91 * @param msg The MAVLink message to compress the data into
93 * @param MMSI Mobile Marine Service Identifier, 9 decimal digits
94 * @param lat [degE7] Latitude
95 * @param lon [degE7] Longitude
96 * @param COG [cdeg] Course over ground
97 * @param heading [cdeg] True heading
98 * @param velocity [cm/s] Speed over ground
99 * @param turn_rate [cdeg/s] Turn rate
100 * @param navigational_status Navigational status
101 * @param type Type of vessels
102 * @param dimension_bow [m] Distance from lat/lon location to bow
103 * @param dimension_stern [m] Distance from lat/lon location to stern
104 * @param dimension_port [m] Distance from lat/lon location to port side
105 * @param dimension_starboard [m] Distance from lat/lon location to starboard side
106 * @param callsign The vessel callsign
107 * @param name The vessel name
108 * @param tslc [s] Time since last communication in seconds
109 * @param flags Bitmask to indicate various statuses including valid data fields
110 * @return length of the message in bytes (excluding serial stream start sign)
112 static inline uint16_t mavlink_msg_ais_vessel_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
113 uint32_t MMSI, int32_t lat, int32_t lon, uint16_t COG, uint16_t heading, uint16_t velocity, int8_t turn_rate, uint8_t navigational_status, uint8_t type, uint16_t dimension_bow, uint16_t dimension_stern, uint8_t dimension_port, uint8_t dimension_starboard, const char *callsign, const char *name, uint16_t tslc, uint16_t flags)
115 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
116 char buf[MAVLINK_MSG_ID_AIS_VESSEL_LEN];
117 _mav_put_uint32_t(buf, 0, MMSI);
118 _mav_put_int32_t(buf, 4, lat);
119 _mav_put_int32_t(buf, 8, lon);
120 _mav_put_uint16_t(buf, 12, COG);
121 _mav_put_uint16_t(buf, 14, heading);
122 _mav_put_uint16_t(buf, 16, velocity);
123 _mav_put_uint16_t(buf, 18, dimension_bow);
124 _mav_put_uint16_t(buf, 20, dimension_stern);
125 _mav_put_uint16_t(buf, 22, tslc);
126 _mav_put_uint16_t(buf, 24, flags);
127 _mav_put_int8_t(buf, 26, turn_rate);
128 _mav_put_uint8_t(buf, 27, navigational_status);
129 _mav_put_uint8_t(buf, 28, type);
130 _mav_put_uint8_t(buf, 29, dimension_port);
131 _mav_put_uint8_t(buf, 30, dimension_starboard);
132 _mav_put_char_array(buf, 31, callsign, 7);
133 _mav_put_char_array(buf, 38, name, 20);
134 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIS_VESSEL_LEN);
135 #else
136 mavlink_ais_vessel_t packet;
137 packet.MMSI = MMSI;
138 packet.lat = lat;
139 packet.lon = lon;
140 packet.COG = COG;
141 packet.heading = heading;
142 packet.velocity = velocity;
143 packet.dimension_bow = dimension_bow;
144 packet.dimension_stern = dimension_stern;
145 packet.tslc = tslc;
146 packet.flags = flags;
147 packet.turn_rate = turn_rate;
148 packet.navigational_status = navigational_status;
149 packet.type = type;
150 packet.dimension_port = dimension_port;
151 packet.dimension_starboard = dimension_starboard;
152 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*7);
153 mav_array_memcpy(packet.name, name, sizeof(char)*20);
154 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIS_VESSEL_LEN);
155 #endif
157 msg->msgid = MAVLINK_MSG_ID_AIS_VESSEL;
158 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
162 * @brief Pack a ais_vessel message on a channel
163 * @param system_id ID of this system
164 * @param component_id ID of this component (e.g. 200 for IMU)
165 * @param chan The MAVLink channel this message will be sent over
166 * @param msg The MAVLink message to compress the data into
167 * @param MMSI Mobile Marine Service Identifier, 9 decimal digits
168 * @param lat [degE7] Latitude
169 * @param lon [degE7] Longitude
170 * @param COG [cdeg] Course over ground
171 * @param heading [cdeg] True heading
172 * @param velocity [cm/s] Speed over ground
173 * @param turn_rate [cdeg/s] Turn rate
174 * @param navigational_status Navigational status
175 * @param type Type of vessels
176 * @param dimension_bow [m] Distance from lat/lon location to bow
177 * @param dimension_stern [m] Distance from lat/lon location to stern
178 * @param dimension_port [m] Distance from lat/lon location to port side
179 * @param dimension_starboard [m] Distance from lat/lon location to starboard side
180 * @param callsign The vessel callsign
181 * @param name The vessel name
182 * @param tslc [s] Time since last communication in seconds
183 * @param flags Bitmask to indicate various statuses including valid data fields
184 * @return length of the message in bytes (excluding serial stream start sign)
186 static inline uint16_t mavlink_msg_ais_vessel_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
187 mavlink_message_t* msg,
188 uint32_t MMSI,int32_t lat,int32_t lon,uint16_t COG,uint16_t heading,uint16_t velocity,int8_t turn_rate,uint8_t navigational_status,uint8_t type,uint16_t dimension_bow,uint16_t dimension_stern,uint8_t dimension_port,uint8_t dimension_starboard,const char *callsign,const char *name,uint16_t tslc,uint16_t flags)
190 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
191 char buf[MAVLINK_MSG_ID_AIS_VESSEL_LEN];
192 _mav_put_uint32_t(buf, 0, MMSI);
193 _mav_put_int32_t(buf, 4, lat);
194 _mav_put_int32_t(buf, 8, lon);
195 _mav_put_uint16_t(buf, 12, COG);
196 _mav_put_uint16_t(buf, 14, heading);
197 _mav_put_uint16_t(buf, 16, velocity);
198 _mav_put_uint16_t(buf, 18, dimension_bow);
199 _mav_put_uint16_t(buf, 20, dimension_stern);
200 _mav_put_uint16_t(buf, 22, tslc);
201 _mav_put_uint16_t(buf, 24, flags);
202 _mav_put_int8_t(buf, 26, turn_rate);
203 _mav_put_uint8_t(buf, 27, navigational_status);
204 _mav_put_uint8_t(buf, 28, type);
205 _mav_put_uint8_t(buf, 29, dimension_port);
206 _mav_put_uint8_t(buf, 30, dimension_starboard);
207 _mav_put_char_array(buf, 31, callsign, 7);
208 _mav_put_char_array(buf, 38, name, 20);
209 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIS_VESSEL_LEN);
210 #else
211 mavlink_ais_vessel_t packet;
212 packet.MMSI = MMSI;
213 packet.lat = lat;
214 packet.lon = lon;
215 packet.COG = COG;
216 packet.heading = heading;
217 packet.velocity = velocity;
218 packet.dimension_bow = dimension_bow;
219 packet.dimension_stern = dimension_stern;
220 packet.tslc = tslc;
221 packet.flags = flags;
222 packet.turn_rate = turn_rate;
223 packet.navigational_status = navigational_status;
224 packet.type = type;
225 packet.dimension_port = dimension_port;
226 packet.dimension_starboard = dimension_starboard;
227 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*7);
228 mav_array_memcpy(packet.name, name, sizeof(char)*20);
229 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIS_VESSEL_LEN);
230 #endif
232 msg->msgid = MAVLINK_MSG_ID_AIS_VESSEL;
233 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
237 * @brief Encode a ais_vessel struct
239 * @param system_id ID of this system
240 * @param component_id ID of this component (e.g. 200 for IMU)
241 * @param msg The MAVLink message to compress the data into
242 * @param ais_vessel C-struct to read the message contents from
244 static inline uint16_t mavlink_msg_ais_vessel_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ais_vessel_t* ais_vessel)
246 return mavlink_msg_ais_vessel_pack(system_id, component_id, msg, ais_vessel->MMSI, ais_vessel->lat, ais_vessel->lon, ais_vessel->COG, ais_vessel->heading, ais_vessel->velocity, ais_vessel->turn_rate, ais_vessel->navigational_status, ais_vessel->type, ais_vessel->dimension_bow, ais_vessel->dimension_stern, ais_vessel->dimension_port, ais_vessel->dimension_starboard, ais_vessel->callsign, ais_vessel->name, ais_vessel->tslc, ais_vessel->flags);
250 * @brief Encode a ais_vessel struct on a channel
252 * @param system_id ID of this system
253 * @param component_id ID of this component (e.g. 200 for IMU)
254 * @param chan The MAVLink channel this message will be sent over
255 * @param msg The MAVLink message to compress the data into
256 * @param ais_vessel C-struct to read the message contents from
258 static inline uint16_t mavlink_msg_ais_vessel_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ais_vessel_t* ais_vessel)
260 return mavlink_msg_ais_vessel_pack_chan(system_id, component_id, chan, msg, ais_vessel->MMSI, ais_vessel->lat, ais_vessel->lon, ais_vessel->COG, ais_vessel->heading, ais_vessel->velocity, ais_vessel->turn_rate, ais_vessel->navigational_status, ais_vessel->type, ais_vessel->dimension_bow, ais_vessel->dimension_stern, ais_vessel->dimension_port, ais_vessel->dimension_starboard, ais_vessel->callsign, ais_vessel->name, ais_vessel->tslc, ais_vessel->flags);
264 * @brief Send a ais_vessel message
265 * @param chan MAVLink channel to send the message
267 * @param MMSI Mobile Marine Service Identifier, 9 decimal digits
268 * @param lat [degE7] Latitude
269 * @param lon [degE7] Longitude
270 * @param COG [cdeg] Course over ground
271 * @param heading [cdeg] True heading
272 * @param velocity [cm/s] Speed over ground
273 * @param turn_rate [cdeg/s] Turn rate
274 * @param navigational_status Navigational status
275 * @param type Type of vessels
276 * @param dimension_bow [m] Distance from lat/lon location to bow
277 * @param dimension_stern [m] Distance from lat/lon location to stern
278 * @param dimension_port [m] Distance from lat/lon location to port side
279 * @param dimension_starboard [m] Distance from lat/lon location to starboard side
280 * @param callsign The vessel callsign
281 * @param name The vessel name
282 * @param tslc [s] Time since last communication in seconds
283 * @param flags Bitmask to indicate various statuses including valid data fields
285 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
287 static inline void mavlink_msg_ais_vessel_send(mavlink_channel_t chan, uint32_t MMSI, int32_t lat, int32_t lon, uint16_t COG, uint16_t heading, uint16_t velocity, int8_t turn_rate, uint8_t navigational_status, uint8_t type, uint16_t dimension_bow, uint16_t dimension_stern, uint8_t dimension_port, uint8_t dimension_starboard, const char *callsign, const char *name, uint16_t tslc, uint16_t flags)
289 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 char buf[MAVLINK_MSG_ID_AIS_VESSEL_LEN];
291 _mav_put_uint32_t(buf, 0, MMSI);
292 _mav_put_int32_t(buf, 4, lat);
293 _mav_put_int32_t(buf, 8, lon);
294 _mav_put_uint16_t(buf, 12, COG);
295 _mav_put_uint16_t(buf, 14, heading);
296 _mav_put_uint16_t(buf, 16, velocity);
297 _mav_put_uint16_t(buf, 18, dimension_bow);
298 _mav_put_uint16_t(buf, 20, dimension_stern);
299 _mav_put_uint16_t(buf, 22, tslc);
300 _mav_put_uint16_t(buf, 24, flags);
301 _mav_put_int8_t(buf, 26, turn_rate);
302 _mav_put_uint8_t(buf, 27, navigational_status);
303 _mav_put_uint8_t(buf, 28, type);
304 _mav_put_uint8_t(buf, 29, dimension_port);
305 _mav_put_uint8_t(buf, 30, dimension_starboard);
306 _mav_put_char_array(buf, 31, callsign, 7);
307 _mav_put_char_array(buf, 38, name, 20);
308 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, buf, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
309 #else
310 mavlink_ais_vessel_t packet;
311 packet.MMSI = MMSI;
312 packet.lat = lat;
313 packet.lon = lon;
314 packet.COG = COG;
315 packet.heading = heading;
316 packet.velocity = velocity;
317 packet.dimension_bow = dimension_bow;
318 packet.dimension_stern = dimension_stern;
319 packet.tslc = tslc;
320 packet.flags = flags;
321 packet.turn_rate = turn_rate;
322 packet.navigational_status = navigational_status;
323 packet.type = type;
324 packet.dimension_port = dimension_port;
325 packet.dimension_starboard = dimension_starboard;
326 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*7);
327 mav_array_memcpy(packet.name, name, sizeof(char)*20);
328 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, (const char *)&packet, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
329 #endif
333 * @brief Send a ais_vessel message
334 * @param chan MAVLink channel to send the message
335 * @param struct The MAVLink struct to serialize
337 static inline void mavlink_msg_ais_vessel_send_struct(mavlink_channel_t chan, const mavlink_ais_vessel_t* ais_vessel)
339 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
340 mavlink_msg_ais_vessel_send(chan, ais_vessel->MMSI, ais_vessel->lat, ais_vessel->lon, ais_vessel->COG, ais_vessel->heading, ais_vessel->velocity, ais_vessel->turn_rate, ais_vessel->navigational_status, ais_vessel->type, ais_vessel->dimension_bow, ais_vessel->dimension_stern, ais_vessel->dimension_port, ais_vessel->dimension_starboard, ais_vessel->callsign, ais_vessel->name, ais_vessel->tslc, ais_vessel->flags);
341 #else
342 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, (const char *)ais_vessel, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
343 #endif
346 #if MAVLINK_MSG_ID_AIS_VESSEL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
348 This varient of _send() can be used to save stack space by re-using
349 memory from the receive buffer. The caller provides a
350 mavlink_message_t which is the size of a full mavlink message. This
351 is usually the receive buffer for the channel, and allows a reply to an
352 incoming message with minimum stack space usage.
354 static inline void mavlink_msg_ais_vessel_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t MMSI, int32_t lat, int32_t lon, uint16_t COG, uint16_t heading, uint16_t velocity, int8_t turn_rate, uint8_t navigational_status, uint8_t type, uint16_t dimension_bow, uint16_t dimension_stern, uint8_t dimension_port, uint8_t dimension_starboard, const char *callsign, const char *name, uint16_t tslc, uint16_t flags)
356 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
357 char *buf = (char *)msgbuf;
358 _mav_put_uint32_t(buf, 0, MMSI);
359 _mav_put_int32_t(buf, 4, lat);
360 _mav_put_int32_t(buf, 8, lon);
361 _mav_put_uint16_t(buf, 12, COG);
362 _mav_put_uint16_t(buf, 14, heading);
363 _mav_put_uint16_t(buf, 16, velocity);
364 _mav_put_uint16_t(buf, 18, dimension_bow);
365 _mav_put_uint16_t(buf, 20, dimension_stern);
366 _mav_put_uint16_t(buf, 22, tslc);
367 _mav_put_uint16_t(buf, 24, flags);
368 _mav_put_int8_t(buf, 26, turn_rate);
369 _mav_put_uint8_t(buf, 27, navigational_status);
370 _mav_put_uint8_t(buf, 28, type);
371 _mav_put_uint8_t(buf, 29, dimension_port);
372 _mav_put_uint8_t(buf, 30, dimension_starboard);
373 _mav_put_char_array(buf, 31, callsign, 7);
374 _mav_put_char_array(buf, 38, name, 20);
375 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, buf, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
376 #else
377 mavlink_ais_vessel_t *packet = (mavlink_ais_vessel_t *)msgbuf;
378 packet->MMSI = MMSI;
379 packet->lat = lat;
380 packet->lon = lon;
381 packet->COG = COG;
382 packet->heading = heading;
383 packet->velocity = velocity;
384 packet->dimension_bow = dimension_bow;
385 packet->dimension_stern = dimension_stern;
386 packet->tslc = tslc;
387 packet->flags = flags;
388 packet->turn_rate = turn_rate;
389 packet->navigational_status = navigational_status;
390 packet->type = type;
391 packet->dimension_port = dimension_port;
392 packet->dimension_starboard = dimension_starboard;
393 mav_array_memcpy(packet->callsign, callsign, sizeof(char)*7);
394 mav_array_memcpy(packet->name, name, sizeof(char)*20);
395 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIS_VESSEL, (const char *)packet, MAVLINK_MSG_ID_AIS_VESSEL_MIN_LEN, MAVLINK_MSG_ID_AIS_VESSEL_LEN, MAVLINK_MSG_ID_AIS_VESSEL_CRC);
396 #endif
398 #endif
400 #endif
402 // MESSAGE AIS_VESSEL UNPACKING
406 * @brief Get field MMSI from ais_vessel message
408 * @return Mobile Marine Service Identifier, 9 decimal digits
410 static inline uint32_t mavlink_msg_ais_vessel_get_MMSI(const mavlink_message_t* msg)
412 return _MAV_RETURN_uint32_t(msg, 0);
416 * @brief Get field lat from ais_vessel message
418 * @return [degE7] Latitude
420 static inline int32_t mavlink_msg_ais_vessel_get_lat(const mavlink_message_t* msg)
422 return _MAV_RETURN_int32_t(msg, 4);
426 * @brief Get field lon from ais_vessel message
428 * @return [degE7] Longitude
430 static inline int32_t mavlink_msg_ais_vessel_get_lon(const mavlink_message_t* msg)
432 return _MAV_RETURN_int32_t(msg, 8);
436 * @brief Get field COG from ais_vessel message
438 * @return [cdeg] Course over ground
440 static inline uint16_t mavlink_msg_ais_vessel_get_COG(const mavlink_message_t* msg)
442 return _MAV_RETURN_uint16_t(msg, 12);
446 * @brief Get field heading from ais_vessel message
448 * @return [cdeg] True heading
450 static inline uint16_t mavlink_msg_ais_vessel_get_heading(const mavlink_message_t* msg)
452 return _MAV_RETURN_uint16_t(msg, 14);
456 * @brief Get field velocity from ais_vessel message
458 * @return [cm/s] Speed over ground
460 static inline uint16_t mavlink_msg_ais_vessel_get_velocity(const mavlink_message_t* msg)
462 return _MAV_RETURN_uint16_t(msg, 16);
466 * @brief Get field turn_rate from ais_vessel message
468 * @return [cdeg/s] Turn rate
470 static inline int8_t mavlink_msg_ais_vessel_get_turn_rate(const mavlink_message_t* msg)
472 return _MAV_RETURN_int8_t(msg, 26);
476 * @brief Get field navigational_status from ais_vessel message
478 * @return Navigational status
480 static inline uint8_t mavlink_msg_ais_vessel_get_navigational_status(const mavlink_message_t* msg)
482 return _MAV_RETURN_uint8_t(msg, 27);
486 * @brief Get field type from ais_vessel message
488 * @return Type of vessels
490 static inline uint8_t mavlink_msg_ais_vessel_get_type(const mavlink_message_t* msg)
492 return _MAV_RETURN_uint8_t(msg, 28);
496 * @brief Get field dimension_bow from ais_vessel message
498 * @return [m] Distance from lat/lon location to bow
500 static inline uint16_t mavlink_msg_ais_vessel_get_dimension_bow(const mavlink_message_t* msg)
502 return _MAV_RETURN_uint16_t(msg, 18);
506 * @brief Get field dimension_stern from ais_vessel message
508 * @return [m] Distance from lat/lon location to stern
510 static inline uint16_t mavlink_msg_ais_vessel_get_dimension_stern(const mavlink_message_t* msg)
512 return _MAV_RETURN_uint16_t(msg, 20);
516 * @brief Get field dimension_port from ais_vessel message
518 * @return [m] Distance from lat/lon location to port side
520 static inline uint8_t mavlink_msg_ais_vessel_get_dimension_port(const mavlink_message_t* msg)
522 return _MAV_RETURN_uint8_t(msg, 29);
526 * @brief Get field dimension_starboard from ais_vessel message
528 * @return [m] Distance from lat/lon location to starboard side
530 static inline uint8_t mavlink_msg_ais_vessel_get_dimension_starboard(const mavlink_message_t* msg)
532 return _MAV_RETURN_uint8_t(msg, 30);
536 * @brief Get field callsign from ais_vessel message
538 * @return The vessel callsign
540 static inline uint16_t mavlink_msg_ais_vessel_get_callsign(const mavlink_message_t* msg, char *callsign)
542 return _MAV_RETURN_char_array(msg, callsign, 7, 31);
546 * @brief Get field name from ais_vessel message
548 * @return The vessel name
550 static inline uint16_t mavlink_msg_ais_vessel_get_name(const mavlink_message_t* msg, char *name)
552 return _MAV_RETURN_char_array(msg, name, 20, 38);
556 * @brief Get field tslc from ais_vessel message
558 * @return [s] Time since last communication in seconds
560 static inline uint16_t mavlink_msg_ais_vessel_get_tslc(const mavlink_message_t* msg)
562 return _MAV_RETURN_uint16_t(msg, 22);
566 * @brief Get field flags from ais_vessel message
568 * @return Bitmask to indicate various statuses including valid data fields
570 static inline uint16_t mavlink_msg_ais_vessel_get_flags(const mavlink_message_t* msg)
572 return _MAV_RETURN_uint16_t(msg, 24);
576 * @brief Decode a ais_vessel message into a struct
578 * @param msg The message to decode
579 * @param ais_vessel C-struct to decode the message contents into
581 static inline void mavlink_msg_ais_vessel_decode(const mavlink_message_t* msg, mavlink_ais_vessel_t* ais_vessel)
583 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
584 ais_vessel->MMSI = mavlink_msg_ais_vessel_get_MMSI(msg);
585 ais_vessel->lat = mavlink_msg_ais_vessel_get_lat(msg);
586 ais_vessel->lon = mavlink_msg_ais_vessel_get_lon(msg);
587 ais_vessel->COG = mavlink_msg_ais_vessel_get_COG(msg);
588 ais_vessel->heading = mavlink_msg_ais_vessel_get_heading(msg);
589 ais_vessel->velocity = mavlink_msg_ais_vessel_get_velocity(msg);
590 ais_vessel->dimension_bow = mavlink_msg_ais_vessel_get_dimension_bow(msg);
591 ais_vessel->dimension_stern = mavlink_msg_ais_vessel_get_dimension_stern(msg);
592 ais_vessel->tslc = mavlink_msg_ais_vessel_get_tslc(msg);
593 ais_vessel->flags = mavlink_msg_ais_vessel_get_flags(msg);
594 ais_vessel->turn_rate = mavlink_msg_ais_vessel_get_turn_rate(msg);
595 ais_vessel->navigational_status = mavlink_msg_ais_vessel_get_navigational_status(msg);
596 ais_vessel->type = mavlink_msg_ais_vessel_get_type(msg);
597 ais_vessel->dimension_port = mavlink_msg_ais_vessel_get_dimension_port(msg);
598 ais_vessel->dimension_starboard = mavlink_msg_ais_vessel_get_dimension_starboard(msg);
599 mavlink_msg_ais_vessel_get_callsign(msg, ais_vessel->callsign);
600 mavlink_msg_ais_vessel_get_name(msg, ais_vessel->name);
601 #else
602 uint8_t len = msg->len < MAVLINK_MSG_ID_AIS_VESSEL_LEN? msg->len : MAVLINK_MSG_ID_AIS_VESSEL_LEN;
603 memset(ais_vessel, 0, MAVLINK_MSG_ID_AIS_VESSEL_LEN);
604 memcpy(ais_vessel, _MAV_PAYLOAD(msg), len);
605 #endif