Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_camera_trigger.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE CAMERA_TRIGGER PACKING
3
4#define MAVLINK_MSG_ID_CAMERA_TRIGGER 112
5
6
8 uint64_t time_usec; /*< [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 uint32_t seq; /*< Image frame sequence*/
10} mavlink_camera_trigger_t;
11
12#define MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN 12
13#define MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN 12
14#define MAVLINK_MSG_ID_112_LEN 12
15#define MAVLINK_MSG_ID_112_MIN_LEN 12
16
17#define MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC 174
18#define MAVLINK_MSG_ID_112_CRC 174
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER {
24 112,
25 "CAMERA_TRIGGER",
26 2,
27 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_trigger_t, time_usec) },
28 { "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_trigger_t, seq) },
29 } \
30}
31#else
32#define MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER {
33 "CAMERA_TRIGGER",
34 2,
35 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_trigger_t, time_usec) },
36 { "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_trigger_t, seq) },
37 } \
38}
39#endif
40
41/**
42 * @brief Pack a camera_trigger message
43 * @param system_id ID of this system
44 * @param component_id ID of this component (e.g. 200 for IMU)
45 * @param msg The MAVLink message to compress the data into
46 *
47 * @param time_usec [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
48 * @param seq Image frame sequence
49 * @return length of the message in bytes (excluding serial stream start sign)
50 */
51static inline uint16_t mavlink_msg_camera_trigger_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
52 uint64_t time_usec, uint32_t seq)
53{
54#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
56 _mav_put_uint64_t(buf, 0, time_usec);
57 _mav_put_uint32_t(buf, 8, seq);
58
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
60#else
61 mavlink_camera_trigger_t packet;
62 packet.time_usec = time_usec;
63 packet.seq = seq;
64
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
66#endif
67
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
70}
71
72/**
73 * @brief Pack a camera_trigger message
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param status MAVLink status structure
77 * @param msg The MAVLink message to compress the data into
78 *
79 * @param time_usec [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
80 * @param seq Image frame sequence
81 * @return length of the message in bytes (excluding serial stream start sign)
82 */
83static inline uint16_t mavlink_msg_camera_trigger_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
84 uint64_t time_usec, uint32_t seq)
85{
86#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
88 _mav_put_uint64_t(buf, 0, time_usec);
89 _mav_put_uint32_t(buf, 8, seq);
90
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
92#else
93 mavlink_camera_trigger_t packet;
94 packet.time_usec = time_usec;
95 packet.seq = seq;
96
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
98#endif
99
101#if MAVLINK_CRC_EXTRA
102 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
103#else
104 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
105#endif
106}
107
108/**
109 * @brief Pack a camera_trigger message on a channel
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param chan The MAVLink channel this message will be sent over
113 * @param msg The MAVLink message to compress the data into
114 * @param time_usec [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
115 * @param seq Image frame sequence
116 * @return length of the message in bytes (excluding serial stream start sign)
117 */
118static inline uint16_t mavlink_msg_camera_trigger_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
119 mavlink_message_t* msg,
120 uint64_t time_usec,uint32_t seq)
121{
122#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
124 _mav_put_uint64_t(buf, 0, time_usec);
125 _mav_put_uint32_t(buf, 8, seq);
126
127 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
128#else
129 mavlink_camera_trigger_t packet;
130 packet.time_usec = time_usec;
131 packet.seq = seq;
132
133 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
134#endif
135
137 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
138}
139
140/**
141 * @brief Encode a camera_trigger struct
142 *
143 * @param system_id ID of this system
144 * @param component_id ID of this component (e.g. 200 for IMU)
145 * @param msg The MAVLink message to compress the data into
146 * @param camera_trigger C-struct to read the message contents from
147 */
148static inline uint16_t mavlink_msg_camera_trigger_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger)
149{
150 return mavlink_msg_camera_trigger_pack(system_id, component_id, msg, camera_trigger->time_usec, camera_trigger->seq);
151}
152
153/**
154 * @brief Encode a camera_trigger struct on a channel
155 *
156 * @param system_id ID of this system
157 * @param component_id ID of this component (e.g. 200 for IMU)
158 * @param chan The MAVLink channel this message will be sent over
159 * @param msg The MAVLink message to compress the data into
160 * @param camera_trigger C-struct to read the message contents from
161 */
162static inline uint16_t mavlink_msg_camera_trigger_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger)
163{
164 return mavlink_msg_camera_trigger_pack_chan(system_id, component_id, chan, msg, camera_trigger->time_usec, camera_trigger->seq);
165}
166
167/**
168 * @brief Encode a camera_trigger struct with provided status structure
169 *
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param status MAVLink status structure
173 * @param msg The MAVLink message to compress the data into
174 * @param camera_trigger C-struct to read the message contents from
175 */
176static inline uint16_t mavlink_msg_camera_trigger_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_trigger_t* camera_trigger)
177{
178 return mavlink_msg_camera_trigger_pack_status(system_id, component_id, _status, msg, camera_trigger->time_usec, camera_trigger->seq);
179}
180
181/**
182 * @brief Send a camera_trigger message
183 * @param chan MAVLink channel to send the message
184 *
185 * @param time_usec [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
186 * @param seq Image frame sequence
187 */
188#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189
190static inline void mavlink_msg_camera_trigger_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
194 _mav_put_uint64_t(buf, 0, time_usec);
195 _mav_put_uint32_t(buf, 8, seq);
196
197 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
198#else
199 mavlink_camera_trigger_t packet;
200 packet.time_usec = time_usec;
201 packet.seq = seq;
202
203 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
204#endif
205}
206
207/**
208 * @brief Send a camera_trigger message
209 * @param chan MAVLink channel to send the message
210 * @param struct The MAVLink struct to serialize
211 */
212static inline void mavlink_msg_camera_trigger_send_struct(mavlink_channel_t chan, const mavlink_camera_trigger_t* camera_trigger)
213{
214#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
215 mavlink_msg_camera_trigger_send(chan, camera_trigger->time_usec, camera_trigger->seq);
216#else
217 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)camera_trigger, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
218#endif
219}
220
221#if MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
222/*
223 This variant of _send() can be used to save stack space by reusing
224 memory from the receive buffer. The caller provides a
225 mavlink_message_t which is the size of a full mavlink message. This
226 is usually the receive buffer for the channel, and allows a reply to an
227 incoming message with minimum stack space usage.
228 */
229static inline void mavlink_msg_camera_trigger_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
230{
231#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
232 char *buf = (char *)msgbuf;
233 _mav_put_uint64_t(buf, 0, time_usec);
234 _mav_put_uint32_t(buf, 8, seq);
235
236 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
237#else
238 mavlink_camera_trigger_t *packet = (mavlink_camera_trigger_t *)msgbuf;
239 packet->time_usec = time_usec;
240 packet->seq = seq;
241
242 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_TRIGGER, (const char *)packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN, MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC);
243#endif
244}
245#endif
246
247#endif
248
249// MESSAGE CAMERA_TRIGGER UNPACKING
250
251
252/**
253 * @brief Get field time_usec from camera_trigger message
254 *
255 * @return [us] Timestamp for image frame (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
256 */
257static inline uint64_t mavlink_msg_camera_trigger_get_time_usec(const mavlink_message_t* msg)
258{
259 return _MAV_RETURN_uint64_t(msg, 0);
260}
261
262/**
263 * @brief Get field seq from camera_trigger message
264 *
265 * @return Image frame sequence
266 */
267static inline uint32_t mavlink_msg_camera_trigger_get_seq(const mavlink_message_t* msg)
268{
269 return _MAV_RETURN_uint32_t(msg, 8);
270}
271
272/**
273 * @brief Decode a camera_trigger message into a struct
274 *
275 * @param msg The message to decode
276 * @param camera_trigger C-struct to decode the message contents into
277 */
278static inline void mavlink_msg_camera_trigger_decode(const mavlink_message_t* msg, mavlink_camera_trigger_t* camera_trigger)
279{
280#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
281 camera_trigger->time_usec = mavlink_msg_camera_trigger_get_time_usec(msg);
282 camera_trigger->seq = mavlink_msg_camera_trigger_get_seq(msg);
283#else
284 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN;
285 memset(camera_trigger, 0, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
286 memcpy(camera_trigger, _MAV_PAYLOAD(msg), len);
287#endif
288}