Merge pull request #10476 from radiolinkW/RADIOLINKF722
[inav.git] / lib / main / MAVLink / common / mavlink_msg_camera_trigger.h
blobee2ad8e9b087ebd627604eef57e839ff9eee143e
1 #pragma once
2 // MESSAGE CAMERA_TRIGGER PACKING
4 #define MAVLINK_MSG_ID_CAMERA_TRIGGER 112
7 typedef struct __mavlink_camera_trigger_t {
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;
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
17 #define MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC 174
18 #define MAVLINK_MSG_ID_112_CRC 174
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 } \
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 } \
39 #endif
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
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)
51 static 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)
54 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
56 _mav_put_uint64_t(buf, 0, time_usec);
57 _mav_put_uint32_t(buf, 8, seq);
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;
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
66 #endif
68 msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
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);
72 /**
73 * @brief Pack a camera_trigger message on a channel
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param chan The MAVLink channel this message will be sent over
77 * @param msg The MAVLink message to compress the data into
78 * @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.
79 * @param seq Image frame sequence
80 * @return length of the message in bytes (excluding serial stream start sign)
82 static inline uint16_t mavlink_msg_camera_trigger_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
83 mavlink_message_t* msg,
84 uint64_t time_usec,uint32_t seq)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
88 _mav_put_uint64_t(buf, 0, time_usec);
89 _mav_put_uint32_t(buf, 8, seq);
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;
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
98 #endif
100 msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
101 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);
105 * @brief Encode a camera_trigger struct
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 camera_trigger C-struct to read the message contents from
112 static 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)
114 return mavlink_msg_camera_trigger_pack(system_id, component_id, msg, camera_trigger->time_usec, camera_trigger->seq);
118 * @brief Encode a camera_trigger struct on a channel
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param chan The MAVLink channel this message will be sent over
123 * @param msg The MAVLink message to compress the data into
124 * @param camera_trigger C-struct to read the message contents from
126 static 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)
128 return mavlink_msg_camera_trigger_pack_chan(system_id, component_id, chan, msg, camera_trigger->time_usec, camera_trigger->seq);
132 * @brief Send a camera_trigger message
133 * @param chan MAVLink channel to send the message
135 * @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.
136 * @param seq Image frame sequence
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_camera_trigger_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
144 _mav_put_uint64_t(buf, 0, time_usec);
145 _mav_put_uint32_t(buf, 8, seq);
147 _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);
148 #else
149 mavlink_camera_trigger_t packet;
150 packet.time_usec = time_usec;
151 packet.seq = seq;
153 _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);
154 #endif
158 * @brief Send a camera_trigger message
159 * @param chan MAVLink channel to send the message
160 * @param struct The MAVLink struct to serialize
162 static inline void mavlink_msg_camera_trigger_send_struct(mavlink_channel_t chan, const mavlink_camera_trigger_t* camera_trigger)
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_camera_trigger_send(chan, camera_trigger->time_usec, camera_trigger->seq);
166 #else
167 _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);
168 #endif
171 #if MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
173 This varient of _send() can be used to save stack space by re-using
174 memory from the receive buffer. The caller provides a
175 mavlink_message_t which is the size of a full mavlink message. This
176 is usually the receive buffer for the channel, and allows a reply to an
177 incoming message with minimum stack space usage.
179 static inline void mavlink_msg_camera_trigger_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
181 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf = (char *)msgbuf;
183 _mav_put_uint64_t(buf, 0, time_usec);
184 _mav_put_uint32_t(buf, 8, seq);
186 _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);
187 #else
188 mavlink_camera_trigger_t *packet = (mavlink_camera_trigger_t *)msgbuf;
189 packet->time_usec = time_usec;
190 packet->seq = seq;
192 _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);
193 #endif
195 #endif
197 #endif
199 // MESSAGE CAMERA_TRIGGER UNPACKING
203 * @brief Get field time_usec from camera_trigger message
205 * @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.
207 static inline uint64_t mavlink_msg_camera_trigger_get_time_usec(const mavlink_message_t* msg)
209 return _MAV_RETURN_uint64_t(msg, 0);
213 * @brief Get field seq from camera_trigger message
215 * @return Image frame sequence
217 static inline uint32_t mavlink_msg_camera_trigger_get_seq(const mavlink_message_t* msg)
219 return _MAV_RETURN_uint32_t(msg, 8);
223 * @brief Decode a camera_trigger message into a struct
225 * @param msg The message to decode
226 * @param camera_trigger C-struct to decode the message contents into
228 static inline void mavlink_msg_camera_trigger_decode(const mavlink_message_t* msg, mavlink_camera_trigger_t* camera_trigger)
230 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 camera_trigger->time_usec = mavlink_msg_camera_trigger_get_time_usec(msg);
232 camera_trigger->seq = mavlink_msg_camera_trigger_get_seq(msg);
233 #else
234 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN;
235 memset(camera_trigger, 0, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
236 memcpy(camera_trigger, _MAV_PAYLOAD(msg), len);
237 #endif