/mavlink/include/pixhawk/mavlink_msg_point_of_interest.h

https://github.com/flixr/mavlink-ivy-interface · C Header · 292 lines · 166 code · 25 blank · 101 comment · 3 complexity · 76c79f4767dc14392043f52676ee74b2 MD5 · raw file

  1. // MESSAGE POINT_OF_INTEREST PACKING
  2. #define MAVLINK_MSG_ID_POINT_OF_INTEREST 191
  3. typedef struct __mavlink_point_of_interest_t
  4. {
  5. float x; ///< X Position
  6. float y; ///< Y Position
  7. float z; ///< Z Position
  8. uint16_t timeout; ///< 0: no timeout, >1: timeout in seconds
  9. uint8_t type; ///< 0: Notice, 1: Warning, 2: Critical, 3: Emergency, 4: Debug
  10. uint8_t color; ///< 0: blue, 1: yellow, 2: red, 3: orange, 4: green, 5: magenta
  11. uint8_t coordinate_system; ///< 0: global, 1:local
  12. char name[26]; ///< POI name
  13. } mavlink_point_of_interest_t;
  14. #define MAVLINK_MSG_ID_POINT_OF_INTEREST_LEN 43
  15. #define MAVLINK_MSG_ID_191_LEN 43
  16. #define MAVLINK_MSG_POINT_OF_INTEREST_FIELD_NAME_LEN 26
  17. #define MAVLINK_MESSAGE_INFO_POINT_OF_INTEREST { \
  18. "POINT_OF_INTEREST", \
  19. 8, \
  20. { { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_point_of_interest_t, x) }, \
  21. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_point_of_interest_t, y) }, \
  22. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_point_of_interest_t, z) }, \
  23. { "timeout", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_point_of_interest_t, timeout) }, \
  24. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_point_of_interest_t, type) }, \
  25. { "color", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_point_of_interest_t, color) }, \
  26. { "coordinate_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_point_of_interest_t, coordinate_system) }, \
  27. { "name", NULL, MAVLINK_TYPE_CHAR, 26, 17, offsetof(mavlink_point_of_interest_t, name) }, \
  28. } \
  29. }
  30. /**
  31. * @brief Pack a point_of_interest message
  32. * @param system_id ID of this system
  33. * @param component_id ID of this component (e.g. 200 for IMU)
  34. * @param msg The MAVLink message to compress the data into
  35. *
  36. * @param type 0: Notice, 1: Warning, 2: Critical, 3: Emergency, 4: Debug
  37. * @param color 0: blue, 1: yellow, 2: red, 3: orange, 4: green, 5: magenta
  38. * @param coordinate_system 0: global, 1:local
  39. * @param timeout 0: no timeout, >1: timeout in seconds
  40. * @param x X Position
  41. * @param y Y Position
  42. * @param z Z Position
  43. * @param name POI name
  44. * @return length of the message in bytes (excluding serial stream start sign)
  45. */
  46. static inline uint16_t mavlink_msg_point_of_interest_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  47. uint8_t type, uint8_t color, uint8_t coordinate_system, uint16_t timeout, float x, float y, float z, const char *name)
  48. {
  49. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  50. char buf[43];
  51. _mav_put_float(buf, 0, x);
  52. _mav_put_float(buf, 4, y);
  53. _mav_put_float(buf, 8, z);
  54. _mav_put_uint16_t(buf, 12, timeout);
  55. _mav_put_uint8_t(buf, 14, type);
  56. _mav_put_uint8_t(buf, 15, color);
  57. _mav_put_uint8_t(buf, 16, coordinate_system);
  58. _mav_put_char_array(buf, 17, name, 26);
  59. memcpy(_MAV_PAYLOAD(msg), buf, 43);
  60. #else
  61. mavlink_point_of_interest_t packet;
  62. packet.x = x;
  63. packet.y = y;
  64. packet.z = z;
  65. packet.timeout = timeout;
  66. packet.type = type;
  67. packet.color = color;
  68. packet.coordinate_system = coordinate_system;
  69. memcpy(packet.name, name, sizeof(char)*26);
  70. memcpy(_MAV_PAYLOAD(msg), &packet, 43);
  71. #endif
  72. msg->msgid = MAVLINK_MSG_ID_POINT_OF_INTEREST;
  73. return mavlink_finalize_message(msg, system_id, component_id, 43, 95);
  74. }
  75. /**
  76. * @brief Pack a point_of_interest message on a channel
  77. * @param system_id ID of this system
  78. * @param component_id ID of this component (e.g. 200 for IMU)
  79. * @param chan The MAVLink channel this message was sent over
  80. * @param msg The MAVLink message to compress the data into
  81. * @param type 0: Notice, 1: Warning, 2: Critical, 3: Emergency, 4: Debug
  82. * @param color 0: blue, 1: yellow, 2: red, 3: orange, 4: green, 5: magenta
  83. * @param coordinate_system 0: global, 1:local
  84. * @param timeout 0: no timeout, >1: timeout in seconds
  85. * @param x X Position
  86. * @param y Y Position
  87. * @param z Z Position
  88. * @param name POI name
  89. * @return length of the message in bytes (excluding serial stream start sign)
  90. */
  91. static inline uint16_t mavlink_msg_point_of_interest_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  92. mavlink_message_t* msg,
  93. uint8_t type,uint8_t color,uint8_t coordinate_system,uint16_t timeout,float x,float y,float z,const char *name)
  94. {
  95. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  96. char buf[43];
  97. _mav_put_float(buf, 0, x);
  98. _mav_put_float(buf, 4, y);
  99. _mav_put_float(buf, 8, z);
  100. _mav_put_uint16_t(buf, 12, timeout);
  101. _mav_put_uint8_t(buf, 14, type);
  102. _mav_put_uint8_t(buf, 15, color);
  103. _mav_put_uint8_t(buf, 16, coordinate_system);
  104. _mav_put_char_array(buf, 17, name, 26);
  105. memcpy(_MAV_PAYLOAD(msg), buf, 43);
  106. #else
  107. mavlink_point_of_interest_t packet;
  108. packet.x = x;
  109. packet.y = y;
  110. packet.z = z;
  111. packet.timeout = timeout;
  112. packet.type = type;
  113. packet.color = color;
  114. packet.coordinate_system = coordinate_system;
  115. memcpy(packet.name, name, sizeof(char)*26);
  116. memcpy(_MAV_PAYLOAD(msg), &packet, 43);
  117. #endif
  118. msg->msgid = MAVLINK_MSG_ID_POINT_OF_INTEREST;
  119. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 43, 95);
  120. }
  121. /**
  122. * @brief Encode a point_of_interest struct into a message
  123. *
  124. * @param system_id ID of this system
  125. * @param component_id ID of this component (e.g. 200 for IMU)
  126. * @param msg The MAVLink message to compress the data into
  127. * @param point_of_interest C-struct to read the message contents from
  128. */
  129. static inline uint16_t mavlink_msg_point_of_interest_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_point_of_interest_t* point_of_interest)
  130. {
  131. return mavlink_msg_point_of_interest_pack(system_id, component_id, msg, point_of_interest->type, point_of_interest->color, point_of_interest->coordinate_system, point_of_interest->timeout, point_of_interest->x, point_of_interest->y, point_of_interest->z, point_of_interest->name);
  132. }
  133. /**
  134. * @brief Send a point_of_interest message
  135. * @param chan MAVLink channel to send the message
  136. *
  137. * @param type 0: Notice, 1: Warning, 2: Critical, 3: Emergency, 4: Debug
  138. * @param color 0: blue, 1: yellow, 2: red, 3: orange, 4: green, 5: magenta
  139. * @param coordinate_system 0: global, 1:local
  140. * @param timeout 0: no timeout, >1: timeout in seconds
  141. * @param x X Position
  142. * @param y Y Position
  143. * @param z Z Position
  144. * @param name POI name
  145. */
  146. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  147. static inline void mavlink_msg_point_of_interest_send(mavlink_channel_t chan, uint8_t type, uint8_t color, uint8_t coordinate_system, uint16_t timeout, float x, float y, float z, const char *name)
  148. {
  149. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  150. char buf[43];
  151. _mav_put_float(buf, 0, x);
  152. _mav_put_float(buf, 4, y);
  153. _mav_put_float(buf, 8, z);
  154. _mav_put_uint16_t(buf, 12, timeout);
  155. _mav_put_uint8_t(buf, 14, type);
  156. _mav_put_uint8_t(buf, 15, color);
  157. _mav_put_uint8_t(buf, 16, coordinate_system);
  158. _mav_put_char_array(buf, 17, name, 26);
  159. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POINT_OF_INTEREST, buf, 43, 95);
  160. #else
  161. mavlink_point_of_interest_t packet;
  162. packet.x = x;
  163. packet.y = y;
  164. packet.z = z;
  165. packet.timeout = timeout;
  166. packet.type = type;
  167. packet.color = color;
  168. packet.coordinate_system = coordinate_system;
  169. memcpy(packet.name, name, sizeof(char)*26);
  170. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POINT_OF_INTEREST, (const char *)&packet, 43, 95);
  171. #endif
  172. }
  173. #endif
  174. // MESSAGE POINT_OF_INTEREST UNPACKING
  175. /**
  176. * @brief Get field type from point_of_interest message
  177. *
  178. * @return 0: Notice, 1: Warning, 2: Critical, 3: Emergency, 4: Debug
  179. */
  180. static inline uint8_t mavlink_msg_point_of_interest_get_type(const mavlink_message_t* msg)
  181. {
  182. return _MAV_RETURN_uint8_t(msg, 14);
  183. }
  184. /**
  185. * @brief Get field color from point_of_interest message
  186. *
  187. * @return 0: blue, 1: yellow, 2: red, 3: orange, 4: green, 5: magenta
  188. */
  189. static inline uint8_t mavlink_msg_point_of_interest_get_color(const mavlink_message_t* msg)
  190. {
  191. return _MAV_RETURN_uint8_t(msg, 15);
  192. }
  193. /**
  194. * @brief Get field coordinate_system from point_of_interest message
  195. *
  196. * @return 0: global, 1:local
  197. */
  198. static inline uint8_t mavlink_msg_point_of_interest_get_coordinate_system(const mavlink_message_t* msg)
  199. {
  200. return _MAV_RETURN_uint8_t(msg, 16);
  201. }
  202. /**
  203. * @brief Get field timeout from point_of_interest message
  204. *
  205. * @return 0: no timeout, >1: timeout in seconds
  206. */
  207. static inline uint16_t mavlink_msg_point_of_interest_get_timeout(const mavlink_message_t* msg)
  208. {
  209. return _MAV_RETURN_uint16_t(msg, 12);
  210. }
  211. /**
  212. * @brief Get field x from point_of_interest message
  213. *
  214. * @return X Position
  215. */
  216. static inline float mavlink_msg_point_of_interest_get_x(const mavlink_message_t* msg)
  217. {
  218. return _MAV_RETURN_float(msg, 0);
  219. }
  220. /**
  221. * @brief Get field y from point_of_interest message
  222. *
  223. * @return Y Position
  224. */
  225. static inline float mavlink_msg_point_of_interest_get_y(const mavlink_message_t* msg)
  226. {
  227. return _MAV_RETURN_float(msg, 4);
  228. }
  229. /**
  230. * @brief Get field z from point_of_interest message
  231. *
  232. * @return Z Position
  233. */
  234. static inline float mavlink_msg_point_of_interest_get_z(const mavlink_message_t* msg)
  235. {
  236. return _MAV_RETURN_float(msg, 8);
  237. }
  238. /**
  239. * @brief Get field name from point_of_interest message
  240. *
  241. * @return POI name
  242. */
  243. static inline uint16_t mavlink_msg_point_of_interest_get_name(const mavlink_message_t* msg, char *name)
  244. {
  245. return _MAV_RETURN_char_array(msg, name, 26, 17);
  246. }
  247. /**
  248. * @brief Decode a point_of_interest message into a struct
  249. *
  250. * @param msg The message to decode
  251. * @param point_of_interest C-struct to decode the message contents into
  252. */
  253. static inline void mavlink_msg_point_of_interest_decode(const mavlink_message_t* msg, mavlink_point_of_interest_t* point_of_interest)
  254. {
  255. #if MAVLINK_NEED_BYTE_SWAP
  256. point_of_interest->x = mavlink_msg_point_of_interest_get_x(msg);
  257. point_of_interest->y = mavlink_msg_point_of_interest_get_y(msg);
  258. point_of_interest->z = mavlink_msg_point_of_interest_get_z(msg);
  259. point_of_interest->timeout = mavlink_msg_point_of_interest_get_timeout(msg);
  260. point_of_interest->type = mavlink_msg_point_of_interest_get_type(msg);
  261. point_of_interest->color = mavlink_msg_point_of_interest_get_color(msg);
  262. point_of_interest->coordinate_system = mavlink_msg_point_of_interest_get_coordinate_system(msg);
  263. mavlink_msg_point_of_interest_get_name(msg, point_of_interest->name);
  264. #else
  265. memcpy(point_of_interest, _MAV_PAYLOAD(msg), 43);
  266. #endif
  267. }