[324] | 1 | // MESSAGE CAMERA_TRIGGER PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_CAMERA_TRIGGER 112
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_camera_trigger_t
|
---|
| 6 | {
|
---|
| 7 | uint64_t time_usec; /*< Timestamp for the image frame in microseconds*/
|
---|
| 8 | uint32_t seq; /*< Image frame sequence*/
|
---|
| 9 | } mavlink_camera_trigger_t;
|
---|
| 10 |
|
---|
| 11 | #define MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN 12
|
---|
| 12 | #define MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN 12
|
---|
| 13 | #define MAVLINK_MSG_ID_112_LEN 12
|
---|
| 14 | #define MAVLINK_MSG_ID_112_MIN_LEN 12
|
---|
| 15 |
|
---|
| 16 | #define MAVLINK_MSG_ID_CAMERA_TRIGGER_CRC 174
|
---|
| 17 | #define MAVLINK_MSG_ID_112_CRC 174
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | #if MAVLINK_COMMAND_24BIT
|
---|
| 22 | #define MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER { \
|
---|
| 23 | 112, \
|
---|
| 24 | "CAMERA_TRIGGER", \
|
---|
| 25 | 2, \
|
---|
| 26 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_trigger_t, time_usec) }, \
|
---|
| 27 | { "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_trigger_t, seq) }, \
|
---|
| 28 | } \
|
---|
| 29 | }
|
---|
| 30 | #else
|
---|
| 31 | #define MAVLINK_MESSAGE_INFO_CAMERA_TRIGGER { \
|
---|
| 32 | "CAMERA_TRIGGER", \
|
---|
| 33 | 2, \
|
---|
| 34 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_trigger_t, time_usec) }, \
|
---|
| 35 | { "seq", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_trigger_t, seq) }, \
|
---|
| 36 | } \
|
---|
| 37 | }
|
---|
| 38 | #endif
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
| 41 | * @brief Pack a camera_trigger message
|
---|
| 42 | * @param system_id ID of this system
|
---|
| 43 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 44 | * @param msg The MAVLink message to compress the data into
|
---|
| 45 | *
|
---|
| 46 | * @param time_usec Timestamp for the image frame in microseconds
|
---|
| 47 | * @param seq Image frame sequence
|
---|
| 48 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 49 | */
|
---|
| 50 | static inline uint16_t mavlink_msg_camera_trigger_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 51 | uint64_t time_usec, uint32_t seq)
|
---|
| 52 | {
|
---|
| 53 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 54 | char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
|
---|
| 55 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 56 | _mav_put_uint32_t(buf, 8, seq);
|
---|
| 57 |
|
---|
| 58 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
|
---|
| 59 | #else
|
---|
| 60 | mavlink_camera_trigger_t packet;
|
---|
| 61 | packet.time_usec = time_usec;
|
---|
| 62 | packet.seq = seq;
|
---|
| 63 |
|
---|
| 64 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|
| 67 | msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
|
---|
| 68 | 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);
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * @brief Pack a camera_trigger message on a channel
|
---|
| 73 | * @param system_id ID of this system
|
---|
| 74 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 75 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 76 | * @param msg The MAVLink message to compress the data into
|
---|
| 77 | * @param time_usec Timestamp for the image frame in microseconds
|
---|
| 78 | * @param seq Image frame sequence
|
---|
| 79 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 80 | */
|
---|
| 81 | static inline uint16_t mavlink_msg_camera_trigger_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 82 | mavlink_message_t* msg,
|
---|
| 83 | uint64_t time_usec,uint32_t seq)
|
---|
| 84 | {
|
---|
| 85 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 86 | char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
|
---|
| 87 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 88 | _mav_put_uint32_t(buf, 8, seq);
|
---|
| 89 |
|
---|
| 90 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
|
---|
| 91 | #else
|
---|
| 92 | mavlink_camera_trigger_t packet;
|
---|
| 93 | packet.time_usec = time_usec;
|
---|
| 94 | packet.seq = seq;
|
---|
| 95 |
|
---|
| 96 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
|
---|
| 97 | #endif
|
---|
| 98 |
|
---|
| 99 | msg->msgid = MAVLINK_MSG_ID_CAMERA_TRIGGER;
|
---|
| 100 | 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);
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /**
|
---|
| 104 | * @brief Encode a camera_trigger struct
|
---|
| 105 | *
|
---|
| 106 | * @param system_id ID of this system
|
---|
| 107 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 108 | * @param msg The MAVLink message to compress the data into
|
---|
| 109 | * @param camera_trigger C-struct to read the message contents from
|
---|
| 110 | */
|
---|
| 111 | 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)
|
---|
| 112 | {
|
---|
| 113 | return mavlink_msg_camera_trigger_pack(system_id, component_id, msg, camera_trigger->time_usec, camera_trigger->seq);
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | /**
|
---|
| 117 | * @brief Encode a camera_trigger struct on a channel
|
---|
| 118 | *
|
---|
| 119 | * @param system_id ID of this system
|
---|
| 120 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 121 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 122 | * @param msg The MAVLink message to compress the data into
|
---|
| 123 | * @param camera_trigger C-struct to read the message contents from
|
---|
| 124 | */
|
---|
| 125 | 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)
|
---|
| 126 | {
|
---|
| 127 | return mavlink_msg_camera_trigger_pack_chan(system_id, component_id, chan, msg, camera_trigger->time_usec, camera_trigger->seq);
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | /**
|
---|
| 131 | * @brief Send a camera_trigger message
|
---|
| 132 | * @param chan MAVLink channel to send the message
|
---|
| 133 | *
|
---|
| 134 | * @param time_usec Timestamp for the image frame in microseconds
|
---|
| 135 | * @param seq Image frame sequence
|
---|
| 136 | */
|
---|
| 137 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 138 |
|
---|
| 139 | static inline void mavlink_msg_camera_trigger_send(mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
|
---|
| 140 | {
|
---|
| 141 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 142 | char buf[MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN];
|
---|
| 143 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 144 | _mav_put_uint32_t(buf, 8, seq);
|
---|
| 145 |
|
---|
| 146 | _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);
|
---|
| 147 | #else
|
---|
| 148 | mavlink_camera_trigger_t packet;
|
---|
| 149 | packet.time_usec = time_usec;
|
---|
| 150 | packet.seq = seq;
|
---|
| 151 |
|
---|
| 152 | _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);
|
---|
| 153 | #endif
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | /**
|
---|
| 157 | * @brief Send a camera_trigger message
|
---|
| 158 | * @param chan MAVLink channel to send the message
|
---|
| 159 | * @param struct The MAVLink struct to serialize
|
---|
| 160 | */
|
---|
| 161 | static inline void mavlink_msg_camera_trigger_send_struct(mavlink_channel_t chan, const mavlink_camera_trigger_t* camera_trigger)
|
---|
| 162 | {
|
---|
| 163 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 164 | mavlink_msg_camera_trigger_send(chan, camera_trigger->time_usec, camera_trigger->seq);
|
---|
| 165 | #else
|
---|
| 166 | _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);
|
---|
| 167 | #endif
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | #if MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 171 | /*
|
---|
| 172 | This varient of _send() can be used to save stack space by re-using
|
---|
| 173 | memory from the receive buffer. The caller provides a
|
---|
| 174 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 175 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 176 | incoming message with minimum stack space usage.
|
---|
| 177 | */
|
---|
| 178 | static inline void mavlink_msg_camera_trigger_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint32_t seq)
|
---|
| 179 | {
|
---|
| 180 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 181 | char *buf = (char *)msgbuf;
|
---|
| 182 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
| 183 | _mav_put_uint32_t(buf, 8, seq);
|
---|
| 184 |
|
---|
| 185 | _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);
|
---|
| 186 | #else
|
---|
| 187 | mavlink_camera_trigger_t *packet = (mavlink_camera_trigger_t *)msgbuf;
|
---|
| 188 | packet->time_usec = time_usec;
|
---|
| 189 | packet->seq = seq;
|
---|
| 190 |
|
---|
| 191 | _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);
|
---|
| 192 | #endif
|
---|
| 193 | }
|
---|
| 194 | #endif
|
---|
| 195 |
|
---|
| 196 | #endif
|
---|
| 197 |
|
---|
| 198 | // MESSAGE CAMERA_TRIGGER UNPACKING
|
---|
| 199 |
|
---|
| 200 |
|
---|
| 201 | /**
|
---|
| 202 | * @brief Get field time_usec from camera_trigger message
|
---|
| 203 | *
|
---|
| 204 | * @return Timestamp for the image frame in microseconds
|
---|
| 205 | */
|
---|
| 206 | static inline uint64_t mavlink_msg_camera_trigger_get_time_usec(const mavlink_message_t* msg)
|
---|
| 207 | {
|
---|
| 208 | return _MAV_RETURN_uint64_t(msg, 0);
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | /**
|
---|
| 212 | * @brief Get field seq from camera_trigger message
|
---|
| 213 | *
|
---|
| 214 | * @return Image frame sequence
|
---|
| 215 | */
|
---|
| 216 | static inline uint32_t mavlink_msg_camera_trigger_get_seq(const mavlink_message_t* msg)
|
---|
| 217 | {
|
---|
| 218 | return _MAV_RETURN_uint32_t(msg, 8);
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | /**
|
---|
| 222 | * @brief Decode a camera_trigger message into a struct
|
---|
| 223 | *
|
---|
| 224 | * @param msg The message to decode
|
---|
| 225 | * @param camera_trigger C-struct to decode the message contents into
|
---|
| 226 | */
|
---|
| 227 | static inline void mavlink_msg_camera_trigger_decode(const mavlink_message_t* msg, mavlink_camera_trigger_t* camera_trigger)
|
---|
| 228 | {
|
---|
| 229 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 230 | camera_trigger->time_usec = mavlink_msg_camera_trigger_get_time_usec(msg);
|
---|
| 231 | camera_trigger->seq = mavlink_msg_camera_trigger_get_seq(msg);
|
---|
| 232 | #else
|
---|
| 233 | uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN;
|
---|
| 234 | memset(camera_trigger, 0, MAVLINK_MSG_ID_CAMERA_TRIGGER_LEN);
|
---|
| 235 | memcpy(camera_trigger, _MAV_PAYLOAD(msg), len);
|
---|
| 236 | #endif
|
---|
| 237 | }
|
---|