mavlink_msg_timesync.h
Go to the documentation of this file.
1 // MESSAGE TIMESYNC PACKING
2 
3 #define MAVLINK_MSG_ID_TIMESYNC 111
4 
5 typedef struct __mavlink_timesync_t
6 {
7  int64_t tc1; /*< Time sync timestamp 1*/
8  int64_t ts1; /*< Time sync timestamp 2*/
10 
11 #define MAVLINK_MSG_ID_TIMESYNC_LEN 16
12 #define MAVLINK_MSG_ID_111_LEN 16
13 
14 #define MAVLINK_MSG_ID_TIMESYNC_CRC 34
15 #define MAVLINK_MSG_ID_111_CRC 34
16 
17 
18 
19 #define MAVLINK_MESSAGE_INFO_TIMESYNC { \
20  "TIMESYNC", \
21  2, \
22  { { "tc1", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_timesync_t, tc1) }, \
23  { "ts1", NULL, MAVLINK_TYPE_INT64_T, 0, 8, offsetof(mavlink_timesync_t, ts1) }, \
24  } \
25 }
26 
27 
38 static inline uint16_t mavlink_msg_timesync_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
39  int64_t tc1, int64_t ts1)
40 {
41 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
43  _mav_put_int64_t(buf, 0, tc1);
44  _mav_put_int64_t(buf, 8, ts1);
45 
47 #else
48  mavlink_timesync_t packet;
49  packet.tc1 = tc1;
50  packet.ts1 = ts1;
51 
53 #endif
54 
55  msg->msgid = MAVLINK_MSG_ID_TIMESYNC;
56 #if MAVLINK_CRC_EXTRA
58 #else
59  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TIMESYNC_LEN);
60 #endif
61 }
62 
73 static inline uint16_t mavlink_msg_timesync_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
74  mavlink_message_t* msg,
75  int64_t tc1,int64_t ts1)
76 {
77 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79  _mav_put_int64_t(buf, 0, tc1);
80  _mav_put_int64_t(buf, 8, ts1);
81 
83 #else
84  mavlink_timesync_t packet;
85  packet.tc1 = tc1;
86  packet.ts1 = ts1;
87 
89 #endif
90 
91  msg->msgid = MAVLINK_MSG_ID_TIMESYNC;
92 #if MAVLINK_CRC_EXTRA
94 #else
95  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TIMESYNC_LEN);
96 #endif
97 }
98 
107 static inline uint16_t mavlink_msg_timesync_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_timesync_t* timesync)
108 {
109  return mavlink_msg_timesync_pack(system_id, component_id, msg, timesync->tc1, timesync->ts1);
110 }
111 
121 static inline uint16_t mavlink_msg_timesync_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_timesync_t* timesync)
122 {
123  return mavlink_msg_timesync_pack_chan(system_id, component_id, chan, msg, timesync->tc1, timesync->ts1);
124 }
125 
133 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
134 
135 static inline void mavlink_msg_timesync_send(mavlink_channel_t chan, int64_t tc1, int64_t ts1)
136 {
137 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
138  char buf[MAVLINK_MSG_ID_TIMESYNC_LEN];
139  _mav_put_int64_t(buf, 0, tc1);
140  _mav_put_int64_t(buf, 8, ts1);
141 
142 #if MAVLINK_CRC_EXTRA
143  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC);
144 #else
145  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_LEN);
146 #endif
147 #else
148  mavlink_timesync_t packet;
149  packet.tc1 = tc1;
150  packet.ts1 = ts1;
151 
152 #if MAVLINK_CRC_EXTRA
153  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)&packet, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC);
154 #else
155  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)&packet, MAVLINK_MSG_ID_TIMESYNC_LEN);
156 #endif
157 #endif
158 }
159 
160 #if MAVLINK_MSG_ID_TIMESYNC_LEN <= MAVLINK_MAX_PAYLOAD_LEN
161 /*
162  This varient of _send() can be used to save stack space by re-using
163  memory from the receive buffer. The caller provides a
164  mavlink_message_t which is the size of a full mavlink message. This
165  is usually the receive buffer for the channel, and allows a reply to an
166  incoming message with minimum stack space usage.
167  */
168 static inline void mavlink_msg_timesync_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int64_t tc1, int64_t ts1)
169 {
170 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171  char *buf = (char *)msgbuf;
172  _mav_put_int64_t(buf, 0, tc1);
173  _mav_put_int64_t(buf, 8, ts1);
174 
175 #if MAVLINK_CRC_EXTRA
176  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC);
177 #else
178  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_LEN);
179 #endif
180 #else
181  mavlink_timesync_t *packet = (mavlink_timesync_t *)msgbuf;
182  packet->tc1 = tc1;
183  packet->ts1 = ts1;
184 
185 #if MAVLINK_CRC_EXTRA
186  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)packet, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC);
187 #else
188  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)packet, MAVLINK_MSG_ID_TIMESYNC_LEN);
189 #endif
190 #endif
191 }
192 #endif
193 
194 #endif
195 
196 // MESSAGE TIMESYNC UNPACKING
197 
198 
204 static inline int64_t mavlink_msg_timesync_get_tc1(const mavlink_message_t* msg)
205 {
206  return _MAV_RETURN_int64_t(msg, 0);
207 }
208 
214 static inline int64_t mavlink_msg_timesync_get_ts1(const mavlink_message_t* msg)
215 {
216  return _MAV_RETURN_int64_t(msg, 8);
217 }
218 
225 static inline void mavlink_msg_timesync_decode(const mavlink_message_t* msg, mavlink_timesync_t* timesync)
226 {
227 #if MAVLINK_NEED_BYTE_SWAP
228  timesync->tc1 = mavlink_msg_timesync_get_tc1(msg);
229  timesync->ts1 = mavlink_msg_timesync_get_ts1(msg);
230 #else
231  memcpy(timesync, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_TIMESYNC_LEN);
232 #endif
233 }
#define _mav_put_int64_t(buf, wire_offset, b)
Definition: protocol.h:150


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:47