1 | // MESSAGE MEMORY_VECT PACKING
|
---|
2 |
|
---|
3 | #define MAVLINK_MSG_ID_MEMORY_VECT 249
|
---|
4 |
|
---|
5 | typedef struct MAVLINK_PACKED __mavlink_memory_vect_t
|
---|
6 | {
|
---|
7 | uint16_t address; /*< Starting address of the debug variables*/
|
---|
8 | uint8_t ver; /*< Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below*/
|
---|
9 | 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*/
|
---|
10 | int8_t value[32]; /*< Memory contents at specified address*/
|
---|
11 | } mavlink_memory_vect_t;
|
---|
12 |
|
---|
13 | #define MAVLINK_MSG_ID_MEMORY_VECT_LEN 36
|
---|
14 | #define MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN 36
|
---|
15 | #define MAVLINK_MSG_ID_249_LEN 36
|
---|
16 | #define MAVLINK_MSG_ID_249_MIN_LEN 36
|
---|
17 |
|
---|
18 | #define MAVLINK_MSG_ID_MEMORY_VECT_CRC 204
|
---|
19 | #define MAVLINK_MSG_ID_249_CRC 204
|
---|
20 |
|
---|
21 | #define MAVLINK_MSG_MEMORY_VECT_FIELD_VALUE_LEN 32
|
---|
22 |
|
---|
23 | #if MAVLINK_COMMAND_24BIT
|
---|
24 | #define MAVLINK_MESSAGE_INFO_MEMORY_VECT { \
|
---|
25 | 249, \
|
---|
26 | "MEMORY_VECT", \
|
---|
27 | 4, \
|
---|
28 | { { "address", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_memory_vect_t, address) }, \
|
---|
29 | { "ver", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_memory_vect_t, ver) }, \
|
---|
30 | { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_memory_vect_t, type) }, \
|
---|
31 | { "value", NULL, MAVLINK_TYPE_INT8_T, 32, 4, offsetof(mavlink_memory_vect_t, value) }, \
|
---|
32 | } \
|
---|
33 | }
|
---|
34 | #else
|
---|
35 | #define MAVLINK_MESSAGE_INFO_MEMORY_VECT { \
|
---|
36 | "MEMORY_VECT", \
|
---|
37 | 4, \
|
---|
38 | { { "address", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_memory_vect_t, address) }, \
|
---|
39 | { "ver", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_memory_vect_t, ver) }, \
|
---|
40 | { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_memory_vect_t, type) }, \
|
---|
41 | { "value", NULL, MAVLINK_TYPE_INT8_T, 32, 4, offsetof(mavlink_memory_vect_t, value) }, \
|
---|
42 | } \
|
---|
43 | }
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * @brief Pack a memory_vect 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 address Starting address of the debug variables
|
---|
53 | * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
|
---|
54 | * @param 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
|
---|
55 | * @param value Memory contents at specified address
|
---|
56 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
57 | */
|
---|
58 | static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
59 | uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
|
---|
60 | {
|
---|
61 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
62 | char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
|
---|
63 | _mav_put_uint16_t(buf, 0, address);
|
---|
64 | _mav_put_uint8_t(buf, 2, ver);
|
---|
65 | _mav_put_uint8_t(buf, 3, type);
|
---|
66 | _mav_put_int8_t_array(buf, 4, value, 32);
|
---|
67 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
|
---|
68 | #else
|
---|
69 | mavlink_memory_vect_t packet;
|
---|
70 | packet.address = address;
|
---|
71 | packet.ver = ver;
|
---|
72 | packet.type = type;
|
---|
73 | mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
|
---|
74 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
|
---|
78 | 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);
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * @brief Pack a memory_vect 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 address Starting address of the debug variables
|
---|
88 | * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
|
---|
89 | * @param 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
|
---|
90 | * @param value Memory contents at specified address
|
---|
91 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
92 | */
|
---|
93 | static inline uint16_t mavlink_msg_memory_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
94 | mavlink_message_t* msg,
|
---|
95 | uint16_t address,uint8_t ver,uint8_t type,const int8_t *value)
|
---|
96 | {
|
---|
97 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
98 | char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
|
---|
99 | _mav_put_uint16_t(buf, 0, address);
|
---|
100 | _mav_put_uint8_t(buf, 2, ver);
|
---|
101 | _mav_put_uint8_t(buf, 3, type);
|
---|
102 | _mav_put_int8_t_array(buf, 4, value, 32);
|
---|
103 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
|
---|
104 | #else
|
---|
105 | mavlink_memory_vect_t packet;
|
---|
106 | packet.address = address;
|
---|
107 | packet.ver = ver;
|
---|
108 | packet.type = type;
|
---|
109 | mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
|
---|
110 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
|
---|
114 | 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);
|
---|
115 | }
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * @brief Encode a memory_vect 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 memory_vect C-struct to read the message contents from
|
---|
124 | */
|
---|
125 | static 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)
|
---|
126 | {
|
---|
127 | return mavlink_msg_memory_vect_pack(system_id, component_id, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
|
---|
128 | }
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * @brief Encode a memory_vect 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 memory_vect C-struct to read the message contents from
|
---|
138 | */
|
---|
139 | static 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)
|
---|
140 | {
|
---|
141 | 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);
|
---|
142 | }
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * @brief Send a memory_vect message
|
---|
146 | * @param chan MAVLink channel to send the message
|
---|
147 | *
|
---|
148 | * @param address Starting address of the debug variables
|
---|
149 | * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
|
---|
150 | * @param 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
|
---|
151 | * @param value Memory contents at specified address
|
---|
152 | */
|
---|
153 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
154 |
|
---|
155 | static inline void mavlink_msg_memory_vect_send(mavlink_channel_t chan, uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
|
---|
156 | {
|
---|
157 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
158 | char buf[MAVLINK_MSG_ID_MEMORY_VECT_LEN];
|
---|
159 | _mav_put_uint16_t(buf, 0, address);
|
---|
160 | _mav_put_uint8_t(buf, 2, ver);
|
---|
161 | _mav_put_uint8_t(buf, 3, type);
|
---|
162 | _mav_put_int8_t_array(buf, 4, value, 32);
|
---|
163 | _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);
|
---|
164 | #else
|
---|
165 | mavlink_memory_vect_t packet;
|
---|
166 | packet.address = address;
|
---|
167 | packet.ver = ver;
|
---|
168 | packet.type = type;
|
---|
169 | mav_array_memcpy(packet.value, value, sizeof(int8_t)*32);
|
---|
170 | _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);
|
---|
171 | #endif
|
---|
172 | }
|
---|
173 |
|
---|
174 | /**
|
---|
175 | * @brief Send a memory_vect message
|
---|
176 | * @param chan MAVLink channel to send the message
|
---|
177 | * @param struct The MAVLink struct to serialize
|
---|
178 | */
|
---|
179 | static inline void mavlink_msg_memory_vect_send_struct(mavlink_channel_t chan, const mavlink_memory_vect_t* memory_vect)
|
---|
180 | {
|
---|
181 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
182 | mavlink_msg_memory_vect_send(chan, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
|
---|
183 | #else
|
---|
184 | _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);
|
---|
185 | #endif
|
---|
186 | }
|
---|
187 |
|
---|
188 | #if MAVLINK_MSG_ID_MEMORY_VECT_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 | */
|
---|
196 | static 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)
|
---|
197 | {
|
---|
198 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
199 | char *buf = (char *)msgbuf;
|
---|
200 | _mav_put_uint16_t(buf, 0, address);
|
---|
201 | _mav_put_uint8_t(buf, 2, ver);
|
---|
202 | _mav_put_uint8_t(buf, 3, type);
|
---|
203 | _mav_put_int8_t_array(buf, 4, value, 32);
|
---|
204 | _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);
|
---|
205 | #else
|
---|
206 | mavlink_memory_vect_t *packet = (mavlink_memory_vect_t *)msgbuf;
|
---|
207 | packet->address = address;
|
---|
208 | packet->ver = ver;
|
---|
209 | packet->type = type;
|
---|
210 | mav_array_memcpy(packet->value, value, sizeof(int8_t)*32);
|
---|
211 | _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);
|
---|
212 | #endif
|
---|
213 | }
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | #endif
|
---|
217 |
|
---|
218 | // MESSAGE MEMORY_VECT UNPACKING
|
---|
219 |
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * @brief Get field address from memory_vect message
|
---|
223 | *
|
---|
224 | * @return Starting address of the debug variables
|
---|
225 | */
|
---|
226 | static inline uint16_t mavlink_msg_memory_vect_get_address(const mavlink_message_t* msg)
|
---|
227 | {
|
---|
228 | return _MAV_RETURN_uint16_t(msg, 0);
|
---|
229 | }
|
---|
230 |
|
---|
231 | /**
|
---|
232 | * @brief Get field ver from memory_vect message
|
---|
233 | *
|
---|
234 | * @return Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
|
---|
235 | */
|
---|
236 | static inline uint8_t mavlink_msg_memory_vect_get_ver(const mavlink_message_t* msg)
|
---|
237 | {
|
---|
238 | return _MAV_RETURN_uint8_t(msg, 2);
|
---|
239 | }
|
---|
240 |
|
---|
241 | /**
|
---|
242 | * @brief Get field type from memory_vect message
|
---|
243 | *
|
---|
244 | * @return 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
|
---|
245 | */
|
---|
246 | static inline uint8_t mavlink_msg_memory_vect_get_type(const mavlink_message_t* msg)
|
---|
247 | {
|
---|
248 | return _MAV_RETURN_uint8_t(msg, 3);
|
---|
249 | }
|
---|
250 |
|
---|
251 | /**
|
---|
252 | * @brief Get field value from memory_vect message
|
---|
253 | *
|
---|
254 | * @return Memory contents at specified address
|
---|
255 | */
|
---|
256 | static inline uint16_t mavlink_msg_memory_vect_get_value(const mavlink_message_t* msg, int8_t *value)
|
---|
257 | {
|
---|
258 | return _MAV_RETURN_int8_t_array(msg, value, 32, 4);
|
---|
259 | }
|
---|
260 |
|
---|
261 | /**
|
---|
262 | * @brief Decode a memory_vect message into a struct
|
---|
263 | *
|
---|
264 | * @param msg The message to decode
|
---|
265 | * @param memory_vect C-struct to decode the message contents into
|
---|
266 | */
|
---|
267 | static inline void mavlink_msg_memory_vect_decode(const mavlink_message_t* msg, mavlink_memory_vect_t* memory_vect)
|
---|
268 | {
|
---|
269 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
270 | memory_vect->address = mavlink_msg_memory_vect_get_address(msg);
|
---|
271 | memory_vect->ver = mavlink_msg_memory_vect_get_ver(msg);
|
---|
272 | memory_vect->type = mavlink_msg_memory_vect_get_type(msg);
|
---|
273 | mavlink_msg_memory_vect_get_value(msg, memory_vect->value);
|
---|
274 | #else
|
---|
275 | uint8_t len = msg->len < MAVLINK_MSG_ID_MEMORY_VECT_LEN? msg->len : MAVLINK_MSG_ID_MEMORY_VECT_LEN;
|
---|
276 | memset(memory_vect, 0, MAVLINK_MSG_ID_MEMORY_VECT_LEN);
|
---|
277 | memcpy(memory_vect, _MAV_PAYLOAD(msg), len);
|
---|
278 | #endif
|
---|
279 | }
|
---|