source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/mavlink_generated_messages/common/mavlink_msg_setup_signing.h@ 46

Last change on this file since 46 was 46, checked in by Thomas Fuhrmann, 8 years ago

Add the mavlink branch

File size: 12.0 KB
Line 
1// MESSAGE SETUP_SIGNING PACKING
2
3#define MAVLINK_MSG_ID_SETUP_SIGNING 256
4
5MAVPACKED(
6typedef struct __mavlink_setup_signing_t {
7 uint64_t initial_timestamp; /*< initial timestamp*/
8 uint8_t target_system; /*< system id of the target*/
9 uint8_t target_component; /*< component ID of the target*/
10 uint8_t secret_key[32]; /*< signing key*/
11}) mavlink_setup_signing_t;
12
13#define MAVLINK_MSG_ID_SETUP_SIGNING_LEN 42
14#define MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN 42
15#define MAVLINK_MSG_ID_256_LEN 42
16#define MAVLINK_MSG_ID_256_MIN_LEN 42
17
18#define MAVLINK_MSG_ID_SETUP_SIGNING_CRC 71
19#define MAVLINK_MSG_ID_256_CRC 71
20
21#define MAVLINK_MSG_SETUP_SIGNING_FIELD_SECRET_KEY_LEN 32
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_SETUP_SIGNING { \
25 256, \
26 "SETUP_SIGNING", \
27 4, \
28 { { "initial_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_setup_signing_t, initial_timestamp) }, \
29 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_setup_signing_t, target_system) }, \
30 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_setup_signing_t, target_component) }, \
31 { "secret_key", NULL, MAVLINK_TYPE_UINT8_T, 32, 10, offsetof(mavlink_setup_signing_t, secret_key) }, \
32 } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_SETUP_SIGNING { \
36 "SETUP_SIGNING", \
37 4, \
38 { { "initial_timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_setup_signing_t, initial_timestamp) }, \
39 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_setup_signing_t, target_system) }, \
40 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_setup_signing_t, target_component) }, \
41 { "secret_key", NULL, MAVLINK_TYPE_UINT8_T, 32, 10, offsetof(mavlink_setup_signing_t, secret_key) }, \
42 } \
43}
44#endif
45
46/**
47 * @brief Pack a setup_signing message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
51 *
52 * @param target_system system id of the target
53 * @param target_component component ID of the target
54 * @param secret_key signing key
55 * @param initial_timestamp initial timestamp
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_setup_signing_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59 uint8_t target_system, uint8_t target_component, const uint8_t *secret_key, uint64_t initial_timestamp)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62 char buf[MAVLINK_MSG_ID_SETUP_SIGNING_LEN];
63 _mav_put_uint64_t(buf, 0, initial_timestamp);
64 _mav_put_uint8_t(buf, 8, target_system);
65 _mav_put_uint8_t(buf, 9, target_component);
66 _mav_put_uint8_t_array(buf, 10, secret_key, 32);
67 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SETUP_SIGNING_LEN);
68#else
69 mavlink_setup_signing_t packet;
70 packet.initial_timestamp = initial_timestamp;
71 packet.target_system = target_system;
72 packet.target_component = target_component;
73 mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SETUP_SIGNING_LEN);
75#endif
76
77 msg->msgid = MAVLINK_MSG_ID_SETUP_SIGNING;
78 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
79}
80
81/**
82 * @brief Pack a setup_signing message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message will be sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param target_system system id of the target
88 * @param target_component component ID of the target
89 * @param secret_key signing key
90 * @param initial_timestamp initial timestamp
91 * @return length of the message in bytes (excluding serial stream start sign)
92 */
93static inline uint16_t mavlink_msg_setup_signing_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
94 mavlink_message_t* msg,
95 uint8_t target_system,uint8_t target_component,const uint8_t *secret_key,uint64_t initial_timestamp)
96{
97#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
98 char buf[MAVLINK_MSG_ID_SETUP_SIGNING_LEN];
99 _mav_put_uint64_t(buf, 0, initial_timestamp);
100 _mav_put_uint8_t(buf, 8, target_system);
101 _mav_put_uint8_t(buf, 9, target_component);
102 _mav_put_uint8_t_array(buf, 10, secret_key, 32);
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SETUP_SIGNING_LEN);
104#else
105 mavlink_setup_signing_t packet;
106 packet.initial_timestamp = initial_timestamp;
107 packet.target_system = target_system;
108 packet.target_component = target_component;
109 mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SETUP_SIGNING_LEN);
111#endif
112
113 msg->msgid = MAVLINK_MSG_ID_SETUP_SIGNING;
114 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
115}
116
117/**
118 * @brief Encode a setup_signing struct
119 *
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param msg The MAVLink message to compress the data into
123 * @param setup_signing C-struct to read the message contents from
124 */
125static inline uint16_t mavlink_msg_setup_signing_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_setup_signing_t* setup_signing)
126{
127 return mavlink_msg_setup_signing_pack(system_id, component_id, msg, setup_signing->target_system, setup_signing->target_component, setup_signing->secret_key, setup_signing->initial_timestamp);
128}
129
130/**
131 * @brief Encode a setup_signing struct on a channel
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param setup_signing C-struct to read the message contents from
138 */
139static inline uint16_t mavlink_msg_setup_signing_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_setup_signing_t* setup_signing)
140{
141 return mavlink_msg_setup_signing_pack_chan(system_id, component_id, chan, msg, setup_signing->target_system, setup_signing->target_component, setup_signing->secret_key, setup_signing->initial_timestamp);
142}
143
144/**
145 * @brief Send a setup_signing message
146 * @param chan MAVLink channel to send the message
147 *
148 * @param target_system system id of the target
149 * @param target_component component ID of the target
150 * @param secret_key signing key
151 * @param initial_timestamp initial timestamp
152 */
153#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
154
155static inline void mavlink_msg_setup_signing_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *secret_key, uint64_t initial_timestamp)
156{
157#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[MAVLINK_MSG_ID_SETUP_SIGNING_LEN];
159 _mav_put_uint64_t(buf, 0, initial_timestamp);
160 _mav_put_uint8_t(buf, 8, target_system);
161 _mav_put_uint8_t(buf, 9, target_component);
162 _mav_put_uint8_t_array(buf, 10, secret_key, 32);
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, buf, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
164#else
165 mavlink_setup_signing_t packet;
166 packet.initial_timestamp = initial_timestamp;
167 packet.target_system = target_system;
168 packet.target_component = target_component;
169 mav_array_memcpy(packet.secret_key, secret_key, sizeof(uint8_t)*32);
170 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, (const char *)&packet, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
171#endif
172}
173
174/**
175 * @brief Send a setup_signing message
176 * @param chan MAVLink channel to send the message
177 * @param struct The MAVLink struct to serialize
178 */
179static inline void mavlink_msg_setup_signing_send_struct(mavlink_channel_t chan, const mavlink_setup_signing_t* setup_signing)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 mavlink_msg_setup_signing_send(chan, setup_signing->target_system, setup_signing->target_component, setup_signing->secret_key, setup_signing->initial_timestamp);
183#else
184 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, (const char *)setup_signing, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
185#endif
186}
187
188#if MAVLINK_MSG_ID_SETUP_SIGNING_LEN <= MAVLINK_MAX_PAYLOAD_LEN
189/*
190 This varient of _send() can be used to save stack space by re-using
191 memory from the receive buffer. The caller provides a
192 mavlink_message_t which is the size of a full mavlink message. This
193 is usually the receive buffer for the channel, and allows a reply to an
194 incoming message with minimum stack space usage.
195 */
196static inline void mavlink_msg_setup_signing_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *secret_key, uint64_t initial_timestamp)
197{
198#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199 char *buf = (char *)msgbuf;
200 _mav_put_uint64_t(buf, 0, initial_timestamp);
201 _mav_put_uint8_t(buf, 8, target_system);
202 _mav_put_uint8_t(buf, 9, target_component);
203 _mav_put_uint8_t_array(buf, 10, secret_key, 32);
204 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, buf, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
205#else
206 mavlink_setup_signing_t *packet = (mavlink_setup_signing_t *)msgbuf;
207 packet->initial_timestamp = initial_timestamp;
208 packet->target_system = target_system;
209 packet->target_component = target_component;
210 mav_array_memcpy(packet->secret_key, secret_key, sizeof(uint8_t)*32);
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SETUP_SIGNING, (const char *)packet, MAVLINK_MSG_ID_SETUP_SIGNING_MIN_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_LEN, MAVLINK_MSG_ID_SETUP_SIGNING_CRC);
212#endif
213}
214#endif
215
216#endif
217
218// MESSAGE SETUP_SIGNING UNPACKING
219
220
221/**
222 * @brief Get field target_system from setup_signing message
223 *
224 * @return system id of the target
225 */
226static inline uint8_t mavlink_msg_setup_signing_get_target_system(const mavlink_message_t* msg)
227{
228 return _MAV_RETURN_uint8_t(msg, 8);
229}
230
231/**
232 * @brief Get field target_component from setup_signing message
233 *
234 * @return component ID of the target
235 */
236static inline uint8_t mavlink_msg_setup_signing_get_target_component(const mavlink_message_t* msg)
237{
238 return _MAV_RETURN_uint8_t(msg, 9);
239}
240
241/**
242 * @brief Get field secret_key from setup_signing message
243 *
244 * @return signing key
245 */
246static inline uint16_t mavlink_msg_setup_signing_get_secret_key(const mavlink_message_t* msg, uint8_t *secret_key)
247{
248 return _MAV_RETURN_uint8_t_array(msg, secret_key, 32, 10);
249}
250
251/**
252 * @brief Get field initial_timestamp from setup_signing message
253 *
254 * @return initial timestamp
255 */
256static inline uint64_t mavlink_msg_setup_signing_get_initial_timestamp(const mavlink_message_t* msg)
257{
258 return _MAV_RETURN_uint64_t(msg, 0);
259}
260
261/**
262 * @brief Decode a setup_signing message into a struct
263 *
264 * @param msg The message to decode
265 * @param setup_signing C-struct to decode the message contents into
266 */
267static inline void mavlink_msg_setup_signing_decode(const mavlink_message_t* msg, mavlink_setup_signing_t* setup_signing)
268{
269#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 setup_signing->initial_timestamp = mavlink_msg_setup_signing_get_initial_timestamp(msg);
271 setup_signing->target_system = mavlink_msg_setup_signing_get_target_system(msg);
272 setup_signing->target_component = mavlink_msg_setup_signing_get_target_component(msg);
273 mavlink_msg_setup_signing_get_secret_key(msg, setup_signing->secret_key);
274#else
275 uint8_t len = msg->len < MAVLINK_MSG_ID_SETUP_SIGNING_LEN? msg->len : MAVLINK_MSG_ID_SETUP_SIGNING_LEN;
276 memset(setup_signing, 0, MAVLINK_MSG_ID_SETUP_SIGNING_LEN);
277 memcpy(setup_signing, _MAV_PAYLOAD(msg), len);
278#endif
279}
Note: See TracBrowser for help on using the repository browser.