mavlink_msg_param_ext_set.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. #pragma once
  2. // MESSAGE PARAM_EXT_SET PACKING
  3. #define MAVLINK_MSG_ID_PARAM_EXT_SET 323
  4. typedef struct __mavlink_param_ext_set_t {
  5. uint8_t target_system; /*< System ID*/
  6. uint8_t target_component; /*< Component ID*/
  7. char param_id[16]; /*< Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/
  8. char param_value[128]; /*< Parameter value*/
  9. uint8_t param_type; /*< Parameter type.*/
  10. } mavlink_param_ext_set_t;
  11. #define MAVLINK_MSG_ID_PARAM_EXT_SET_LEN 147
  12. #define MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN 147
  13. #define MAVLINK_MSG_ID_323_LEN 147
  14. #define MAVLINK_MSG_ID_323_MIN_LEN 147
  15. #define MAVLINK_MSG_ID_PARAM_EXT_SET_CRC 78
  16. #define MAVLINK_MSG_ID_323_CRC 78
  17. #define MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_ID_LEN 16
  18. #define MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN 128
  19. #if MAVLINK_COMMAND_24BIT
  20. #define MAVLINK_MESSAGE_INFO_PARAM_EXT_SET { \
  21. 323, \
  22. "PARAM_EXT_SET", \
  23. 5, \
  24. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_param_ext_set_t, target_system) }, \
  25. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_param_ext_set_t, target_component) }, \
  26. { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 2, offsetof(mavlink_param_ext_set_t, param_id) }, \
  27. { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 18, offsetof(mavlink_param_ext_set_t, param_value) }, \
  28. { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 146, offsetof(mavlink_param_ext_set_t, param_type) }, \
  29. } \
  30. }
  31. #else
  32. #define MAVLINK_MESSAGE_INFO_PARAM_EXT_SET { \
  33. "PARAM_EXT_SET", \
  34. 5, \
  35. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_param_ext_set_t, target_system) }, \
  36. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_param_ext_set_t, target_component) }, \
  37. { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 2, offsetof(mavlink_param_ext_set_t, param_id) }, \
  38. { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 18, offsetof(mavlink_param_ext_set_t, param_value) }, \
  39. { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 146, offsetof(mavlink_param_ext_set_t, param_type) }, \
  40. } \
  41. }
  42. #endif
  43. /**
  44. * @brief Pack a param_ext_set message
  45. * @param system_id ID of this system
  46. * @param component_id ID of this component (e.g. 200 for IMU)
  47. * @param msg The MAVLink message to compress the data into
  48. *
  49. * @param target_system System ID
  50. * @param target_component Component ID
  51. * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
  52. * @param param_value Parameter value
  53. * @param param_type Parameter type.
  54. * @return length of the message in bytes (excluding serial stream start sign)
  55. */
  56. static inline uint16_t mavlink_msg_param_ext_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  57. uint8_t target_system, uint8_t target_component, const char *param_id, const char *param_value, uint8_t param_type)
  58. {
  59. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  60. char buf[MAVLINK_MSG_ID_PARAM_EXT_SET_LEN];
  61. _mav_put_uint8_t(buf, 0, target_system);
  62. _mav_put_uint8_t(buf, 1, target_component);
  63. _mav_put_uint8_t(buf, 146, param_type);
  64. _mav_put_char_array(buf, 2, param_id, 16);
  65. _mav_put_char_array(buf, 18, param_value, 128);
  66. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN);
  67. #else
  68. mavlink_param_ext_set_t packet;
  69. packet.target_system = target_system;
  70. packet.target_component = target_component;
  71. packet.param_type = param_type;
  72. mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
  73. mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
  74. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN);
  75. #endif
  76. msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_SET;
  77. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  78. }
  79. /**
  80. * @brief Pack a param_ext_set message on a channel
  81. * @param system_id ID of this system
  82. * @param component_id ID of this component (e.g. 200 for IMU)
  83. * @param chan The MAVLink channel this message will be sent over
  84. * @param msg The MAVLink message to compress the data into
  85. * @param target_system System ID
  86. * @param target_component Component ID
  87. * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
  88. * @param param_value Parameter value
  89. * @param param_type Parameter type.
  90. * @return length of the message in bytes (excluding serial stream start sign)
  91. */
  92. static inline uint16_t mavlink_msg_param_ext_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  93. mavlink_message_t* msg,
  94. uint8_t target_system,uint8_t target_component,const char *param_id,const char *param_value,uint8_t param_type)
  95. {
  96. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  97. char buf[MAVLINK_MSG_ID_PARAM_EXT_SET_LEN];
  98. _mav_put_uint8_t(buf, 0, target_system);
  99. _mav_put_uint8_t(buf, 1, target_component);
  100. _mav_put_uint8_t(buf, 146, param_type);
  101. _mav_put_char_array(buf, 2, param_id, 16);
  102. _mav_put_char_array(buf, 18, param_value, 128);
  103. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN);
  104. #else
  105. mavlink_param_ext_set_t packet;
  106. packet.target_system = target_system;
  107. packet.target_component = target_component;
  108. packet.param_type = param_type;
  109. mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
  110. mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN);
  112. #endif
  113. msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_SET;
  114. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  115. }
  116. /**
  117. * @brief Encode a param_ext_set struct
  118. *
  119. * @param system_id ID of this system
  120. * @param component_id ID of this component (e.g. 200 for IMU)
  121. * @param msg The MAVLink message to compress the data into
  122. * @param param_ext_set C-struct to read the message contents from
  123. */
  124. static inline uint16_t mavlink_msg_param_ext_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_ext_set_t* param_ext_set)
  125. {
  126. return mavlink_msg_param_ext_set_pack(system_id, component_id, msg, param_ext_set->target_system, param_ext_set->target_component, param_ext_set->param_id, param_ext_set->param_value, param_ext_set->param_type);
  127. }
  128. /**
  129. * @brief Encode a param_ext_set struct on a channel
  130. *
  131. * @param system_id ID of this system
  132. * @param component_id ID of this component (e.g. 200 for IMU)
  133. * @param chan The MAVLink channel this message will be sent over
  134. * @param msg The MAVLink message to compress the data into
  135. * @param param_ext_set C-struct to read the message contents from
  136. */
  137. static inline uint16_t mavlink_msg_param_ext_set_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_ext_set_t* param_ext_set)
  138. {
  139. return mavlink_msg_param_ext_set_pack_chan(system_id, component_id, chan, msg, param_ext_set->target_system, param_ext_set->target_component, param_ext_set->param_id, param_ext_set->param_value, param_ext_set->param_type);
  140. }
  141. /**
  142. * @brief Send a param_ext_set message
  143. * @param chan MAVLink channel to send the message
  144. *
  145. * @param target_system System ID
  146. * @param target_component Component ID
  147. * @param param_id Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
  148. * @param param_value Parameter value
  149. * @param param_type Parameter type.
  150. */
  151. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  152. static inline void mavlink_msg_param_ext_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, const char *param_value, uint8_t param_type)
  153. {
  154. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  155. char buf[MAVLINK_MSG_ID_PARAM_EXT_SET_LEN];
  156. _mav_put_uint8_t(buf, 0, target_system);
  157. _mav_put_uint8_t(buf, 1, target_component);
  158. _mav_put_uint8_t(buf, 146, param_type);
  159. _mav_put_char_array(buf, 2, param_id, 16);
  160. _mav_put_char_array(buf, 18, param_value, 128);
  161. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, buf, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  162. #else
  163. mavlink_param_ext_set_t packet;
  164. packet.target_system = target_system;
  165. packet.target_component = target_component;
  166. packet.param_type = param_type;
  167. mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
  168. mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
  169. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  170. #endif
  171. }
  172. /**
  173. * @brief Send a param_ext_set message
  174. * @param chan MAVLink channel to send the message
  175. * @param struct The MAVLink struct to serialize
  176. */
  177. static inline void mavlink_msg_param_ext_set_send_struct(mavlink_channel_t chan, const mavlink_param_ext_set_t* param_ext_set)
  178. {
  179. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  180. mavlink_msg_param_ext_set_send(chan, param_ext_set->target_system, param_ext_set->target_component, param_ext_set->param_id, param_ext_set->param_value, param_ext_set->param_type);
  181. #else
  182. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, (const char *)param_ext_set, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  183. #endif
  184. }
  185. #if MAVLINK_MSG_ID_PARAM_EXT_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  186. /*
  187. This variant of _send() can be used to save stack space by re-using
  188. memory from the receive buffer. The caller provides a
  189. mavlink_message_t which is the size of a full mavlink message. This
  190. is usually the receive buffer for the channel, and allows a reply to an
  191. incoming message with minimum stack space usage.
  192. */
  193. static inline void mavlink_msg_param_ext_set_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, const char *param_value, uint8_t param_type)
  194. {
  195. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  196. char *buf = (char *)msgbuf;
  197. _mav_put_uint8_t(buf, 0, target_system);
  198. _mav_put_uint8_t(buf, 1, target_component);
  199. _mav_put_uint8_t(buf, 146, param_type);
  200. _mav_put_char_array(buf, 2, param_id, 16);
  201. _mav_put_char_array(buf, 18, param_value, 128);
  202. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, buf, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  203. #else
  204. mavlink_param_ext_set_t *packet = (mavlink_param_ext_set_t *)msgbuf;
  205. packet->target_system = target_system;
  206. packet->target_component = target_component;
  207. packet->param_type = param_type;
  208. mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
  209. mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128);
  210. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_SET, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_SET_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN, MAVLINK_MSG_ID_PARAM_EXT_SET_CRC);
  211. #endif
  212. }
  213. #endif
  214. #endif
  215. // MESSAGE PARAM_EXT_SET UNPACKING
  216. /**
  217. * @brief Get field target_system from param_ext_set message
  218. *
  219. * @return System ID
  220. */
  221. static inline uint8_t mavlink_msg_param_ext_set_get_target_system(const mavlink_message_t* msg)
  222. {
  223. return _MAV_RETURN_uint8_t(msg, 0);
  224. }
  225. /**
  226. * @brief Get field target_component from param_ext_set message
  227. *
  228. * @return Component ID
  229. */
  230. static inline uint8_t mavlink_msg_param_ext_set_get_target_component(const mavlink_message_t* msg)
  231. {
  232. return _MAV_RETURN_uint8_t(msg, 1);
  233. }
  234. /**
  235. * @brief Get field param_id from param_ext_set message
  236. *
  237. * @return Parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
  238. */
  239. static inline uint16_t mavlink_msg_param_ext_set_get_param_id(const mavlink_message_t* msg, char *param_id)
  240. {
  241. return _MAV_RETURN_char_array(msg, param_id, 16, 2);
  242. }
  243. /**
  244. * @brief Get field param_value from param_ext_set message
  245. *
  246. * @return Parameter value
  247. */
  248. static inline uint16_t mavlink_msg_param_ext_set_get_param_value(const mavlink_message_t* msg, char *param_value)
  249. {
  250. return _MAV_RETURN_char_array(msg, param_value, 128, 18);
  251. }
  252. /**
  253. * @brief Get field param_type from param_ext_set message
  254. *
  255. * @return Parameter type.
  256. */
  257. static inline uint8_t mavlink_msg_param_ext_set_get_param_type(const mavlink_message_t* msg)
  258. {
  259. return _MAV_RETURN_uint8_t(msg, 146);
  260. }
  261. /**
  262. * @brief Decode a param_ext_set message into a struct
  263. *
  264. * @param msg The message to decode
  265. * @param param_ext_set C-struct to decode the message contents into
  266. */
  267. static inline void mavlink_msg_param_ext_set_decode(const mavlink_message_t* msg, mavlink_param_ext_set_t* param_ext_set)
  268. {
  269. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  270. param_ext_set->target_system = mavlink_msg_param_ext_set_get_target_system(msg);
  271. param_ext_set->target_component = mavlink_msg_param_ext_set_get_target_component(msg);
  272. mavlink_msg_param_ext_set_get_param_id(msg, param_ext_set->param_id);
  273. mavlink_msg_param_ext_set_get_param_value(msg, param_ext_set->param_value);
  274. param_ext_set->param_type = mavlink_msg_param_ext_set_get_param_type(msg);
  275. #else
  276. uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_EXT_SET_LEN? msg->len : MAVLINK_MSG_ID_PARAM_EXT_SET_LEN;
  277. memset(param_ext_set, 0, MAVLINK_MSG_ID_PARAM_EXT_SET_LEN);
  278. memcpy(param_ext_set, _MAV_PAYLOAD(msg), len);
  279. #endif
  280. }