RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_memory_vect.h
1#pragma once
2// MESSAGE MEMORY_VECT PACKING
3
4#define MAVLINK_MSG_ID_MEMORY_VECT 249
5
6MAVPACKED(
7typedef struct __mavlink_memory_vect_t {
8 uint16_t address; /*< Starting address of the debug variables*/
9 uint8_t ver; /*< Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below*/
10 uint8_t type; /*< Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14*/
11 int8_t value[32]; /*< Memory contents at specified address*/
12}) mavlink_memory_vect_t;
13
14#define MAVLINK_MSG_ID_MEMORY_VECT_LEN 36
15#define MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN 36
16#define MAVLINK_MSG_ID_249_LEN 36
17#define MAVLINK_MSG_ID_249_MIN_LEN 36
18
19#define MAVLINK_MSG_ID_MEMORY_VECT_CRC 204
20#define MAVLINK_MSG_ID_249_CRC 204
21
22#define MAVLINK_MSG_MEMORY_VECT_FIELD_VALUE_LEN 32
23
24#if MAVLINK_COMMAND_24BIT
25#define MAVLINK_MESSAGE_INFO_MEMORY_VECT { \
26 249, \
27 "MEMORY_VECT", \
28 4, \
29 { { "address", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_memory_vect_t, address) }, \
30 { "ver", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_memory_vect_t, ver) }, \
31 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_memory_vect_t, type) }, \
32 { "value", NULL, MAVLINK_TYPE_INT8_T, 32, 4, offsetof(mavlink_memory_vect_t, value) }, \
33 } \
34}
35#else
36#define MAVLINK_MESSAGE_INFO_MEMORY_VECT { \
37 "MEMORY_VECT", \
38 4, \
39 { { "address", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_memory_vect_t, address) }, \
40 { "ver", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_memory_vect_t, ver) }, \
41 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_memory_vect_t, type) }, \
42 { "value", NULL, MAVLINK_TYPE_INT8_T, 32, 4, offsetof(mavlink_memory_vect_t, value) }, \
43 } \
44}
45#endif
46
59static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60 uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
61{
62#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
64 _mav_put_uint16_t(buf, 0, address);
65 _mav_put_uint8_t(buf, 2, ver);
66 _mav_put_uint8_t(buf, 3, type);
67 _mav_put_int8_t_array(buf, 4, value, 32);
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
69#else
70 mavlink_memory_vect_t packet;
71 packet.address = address;
72 packet.ver = ver;
73 packet.type = type;
74 mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
76#endif
77
78 msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
79 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
80}
81
94static inline uint16_t mavlink_msg_memory_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
95 mavlink_message_t* msg,
96 uint16_t address,uint8_t ver,uint8_t type,const int8_t *value)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
100 _mav_put_uint16_t(buf, 0, address);
101 _mav_put_uint8_t(buf, 2, ver);
102 _mav_put_uint8_t(buf, 3, type);
103 _mav_put_int8_t_array(buf, 4, value, 32);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
105#else
106 mavlink_memory_vect_t packet;
107 packet.address = address;
108 packet.ver = ver;
109 packet.type = type;
110 mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
111 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
112#endif
113
114 msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
115 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
116}
117
126static inline uint16_t mavlink_msg_memory_vect_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_memory_vect_t* memory_vect)
127{
128 return mavlink_msg_memory_vect_pack(system_id, component_id, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
129}
130
140static inline uint16_t mavlink_msg_memory_vect_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_memory_vect_t* memory_vect)
141{
142 return mavlink_msg_memory_vect_pack_chan(system_id, component_id, chan, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
143}
144
154#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
155
156static inline void mavlink_msg_memory_vect_send(mavlink_channel_t chan, uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
157{
158#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
159 char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
160 _mav_put_uint16_t(buf, 0, address);
161 _mav_put_uint8_t(buf, 2, ver);
162 _mav_put_uint8_t(buf, 3, type);
163 _mav_put_int8_t_array(buf, 4, value, 32);
164 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, buf, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
165#else
166 mavlink_memory_vect_t packet;
167 packet.address = address;
168 packet.ver = ver;
169 packet.type = type;
170 mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
171 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)&packet, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
172#endif
173}
174
180static inline void mavlink_msg_memory_vect_send_struct(mavlink_channel_t chan, const mavlink_memory_vect_t* memory_vect)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 mavlink_msg_memory_vect_send(chan, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
184#else
185 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)memory_vect, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
186#endif
187}
188
189#if MAVLINK_MSG_ID_MEMORY_VECT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
190/*
191 This varient of _send() can be used to save stack space by re-using
192 memory from the receive buffer. The caller provides a
193 mavlink_message_t which is the size of a full mavlink message. This
194 is usually the receive buffer for the channel, and allows a reply to an
195 incoming message with minimum stack space usage.
196 */
197static inline void mavlink_msg_memory_vect_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
198{
199#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 char *buf = (char *)msgbuf;
201 _mav_put_uint16_t(buf, 0, address);
202 _mav_put_uint8_t(buf, 2, ver);
203 _mav_put_uint8_t(buf, 3, type);
204 _mav_put_int8_t_array(buf, 4, value, 32);
205 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, buf, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
206#else
207 mavlink_memory_vect_t *packet = (mavlink_memory_vect_t *)msgbuf;
208 packet->address = address;
209 packet->ver = ver;
210 packet->type = type;
211 mav_array_memcpy(packet->value, value, sizeof(int8_t)*32);
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)packet, MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN, MAVLINK_MSG_ID_MEMORY_VECT_LEN, MAVLINK_MSG_ID_MEMORY_VECT_CRC);
213#endif
214}
215#endif
216
217#endif
218
219// MESSAGE MEMORY_VECT UNPACKING
220
221
227static inline uint16_t mavlink_msg_memory_vect_get_address(const mavlink_message_t* msg)
228{
229 return _MAV_RETURN_uint16_t(msg, 0);
230}
231
237static inline uint8_t mavlink_msg_memory_vect_get_ver(const mavlink_message_t* msg)
238{
239 return _MAV_RETURN_uint8_t(msg, 2);
240}
241
247static inline uint8_t mavlink_msg_memory_vect_get_type(const mavlink_message_t* msg)
248{
249 return _MAV_RETURN_uint8_t(msg, 3);
250}
251
257static inline uint16_t mavlink_msg_memory_vect_get_value(const mavlink_message_t* msg, int8_t *value)
258{
259 return _MAV_RETURN_int8_t_array(msg, value, 32, 4);
260}
261
268static inline void mavlink_msg_memory_vect_decode(const mavlink_message_t* msg, mavlink_memory_vect_t* memory_vect)
269{
270#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
271 memory_vect->address = mavlink_msg_memory_vect_get_address(msg);
272 memory_vect->ver = mavlink_msg_memory_vect_get_ver(msg);
273 memory_vect->type = mavlink_msg_memory_vect_get_type(msg);
274 mavlink_msg_memory_vect_get_value(msg, memory_vect->value);
275#else
276 uint8_t len = msg->len < MAVLINK_MSG_ID_MEMORY_VECT_LEN? msg->len : MAVLINK_MSG_ID_MEMORY_VECT_LEN;
277 memset(memory_vect, 0, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
278 memcpy(memory_vect, _MAV_PAYLOAD(msg), len);
279#endif
280}