You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

263 lines
9.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE PTZ_STATUS PACKING
  3. #define MAVLINK_MSG_ID_PTZ_STATUS 192
  4. MAVPACKED(
  5. typedef struct __mavlink_ptz_status_t {
  6. int16_t pan; /*< The Pan value in 10ths of degree*/
  7. int16_t tilt; /*< The Tilt value in 10ths of degree*/
  8. uint8_t zoom; /*< The actual Zoom Value*/
  9. }) mavlink_ptz_status_t;
  10. #define MAVLINK_MSG_ID_PTZ_STATUS_LEN 5
  11. #define MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN 5
  12. #define MAVLINK_MSG_ID_192_LEN 5
  13. #define MAVLINK_MSG_ID_192_MIN_LEN 5
  14. #define MAVLINK_MSG_ID_PTZ_STATUS_CRC 187
  15. #define MAVLINK_MSG_ID_192_CRC 187
  16. #if MAVLINK_COMMAND_24BIT
  17. #define MAVLINK_MESSAGE_INFO_PTZ_STATUS { \
  18. 192, \
  19. "PTZ_STATUS", \
  20. 3, \
  21. { { "zoom", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_ptz_status_t, zoom) }, \
  22. { "pan", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_ptz_status_t, pan) }, \
  23. { "tilt", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_ptz_status_t, tilt) }, \
  24. } \
  25. }
  26. #else
  27. #define MAVLINK_MESSAGE_INFO_PTZ_STATUS { \
  28. "PTZ_STATUS", \
  29. 3, \
  30. { { "zoom", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_ptz_status_t, zoom) }, \
  31. { "pan", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_ptz_status_t, pan) }, \
  32. { "tilt", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_ptz_status_t, tilt) }, \
  33. } \
  34. }
  35. #endif
  36. /**
  37. * @brief Pack a ptz_status message
  38. * @param system_id ID of this system
  39. * @param component_id ID of this component (e.g. 200 for IMU)
  40. * @param msg The MAVLink message to compress the data into
  41. *
  42. * @param zoom The actual Zoom Value
  43. * @param pan The Pan value in 10ths of degree
  44. * @param tilt The Tilt value in 10ths of degree
  45. * @return length of the message in bytes (excluding serial stream start sign)
  46. */
  47. static inline uint16_t mavlink_msg_ptz_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  48. uint8_t zoom, int16_t pan, int16_t tilt)
  49. {
  50. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  51. char buf[MAVLINK_MSG_ID_PTZ_STATUS_LEN];
  52. _mav_put_int16_t(buf, 0, pan);
  53. _mav_put_int16_t(buf, 2, tilt);
  54. _mav_put_uint8_t(buf, 4, zoom);
  55. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PTZ_STATUS_LEN);
  56. #else
  57. mavlink_ptz_status_t packet;
  58. packet.pan = pan;
  59. packet.tilt = tilt;
  60. packet.zoom = zoom;
  61. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PTZ_STATUS_LEN);
  62. #endif
  63. msg->msgid = MAVLINK_MSG_ID_PTZ_STATUS;
  64. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  65. }
  66. /**
  67. * @brief Pack a ptz_status message on a channel
  68. * @param system_id ID of this system
  69. * @param component_id ID of this component (e.g. 200 for IMU)
  70. * @param chan The MAVLink channel this message will be sent over
  71. * @param msg The MAVLink message to compress the data into
  72. * @param zoom The actual Zoom Value
  73. * @param pan The Pan value in 10ths of degree
  74. * @param tilt The Tilt value in 10ths of degree
  75. * @return length of the message in bytes (excluding serial stream start sign)
  76. */
  77. static inline uint16_t mavlink_msg_ptz_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  78. mavlink_message_t* msg,
  79. uint8_t zoom,int16_t pan,int16_t tilt)
  80. {
  81. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  82. char buf[MAVLINK_MSG_ID_PTZ_STATUS_LEN];
  83. _mav_put_int16_t(buf, 0, pan);
  84. _mav_put_int16_t(buf, 2, tilt);
  85. _mav_put_uint8_t(buf, 4, zoom);
  86. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PTZ_STATUS_LEN);
  87. #else
  88. mavlink_ptz_status_t packet;
  89. packet.pan = pan;
  90. packet.tilt = tilt;
  91. packet.zoom = zoom;
  92. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PTZ_STATUS_LEN);
  93. #endif
  94. msg->msgid = MAVLINK_MSG_ID_PTZ_STATUS;
  95. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  96. }
  97. /**
  98. * @brief Encode a ptz_status struct
  99. *
  100. * @param system_id ID of this system
  101. * @param component_id ID of this component (e.g. 200 for IMU)
  102. * @param msg The MAVLink message to compress the data into
  103. * @param ptz_status C-struct to read the message contents from
  104. */
  105. static inline uint16_t mavlink_msg_ptz_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ptz_status_t* ptz_status)
  106. {
  107. return mavlink_msg_ptz_status_pack(system_id, component_id, msg, ptz_status->zoom, ptz_status->pan, ptz_status->tilt);
  108. }
  109. /**
  110. * @brief Encode a ptz_status struct on a channel
  111. *
  112. * @param system_id ID of this system
  113. * @param component_id ID of this component (e.g. 200 for IMU)
  114. * @param chan The MAVLink channel this message will be sent over
  115. * @param msg The MAVLink message to compress the data into
  116. * @param ptz_status C-struct to read the message contents from
  117. */
  118. static inline uint16_t mavlink_msg_ptz_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ptz_status_t* ptz_status)
  119. {
  120. return mavlink_msg_ptz_status_pack_chan(system_id, component_id, chan, msg, ptz_status->zoom, ptz_status->pan, ptz_status->tilt);
  121. }
  122. /**
  123. * @brief Send a ptz_status message
  124. * @param chan MAVLink channel to send the message
  125. *
  126. * @param zoom The actual Zoom Value
  127. * @param pan The Pan value in 10ths of degree
  128. * @param tilt The Tilt value in 10ths of degree
  129. */
  130. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  131. static inline void mavlink_msg_ptz_status_send(mavlink_channel_t chan, uint8_t zoom, int16_t pan, int16_t tilt)
  132. {
  133. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  134. char buf[MAVLINK_MSG_ID_PTZ_STATUS_LEN];
  135. _mav_put_int16_t(buf, 0, pan);
  136. _mav_put_int16_t(buf, 2, tilt);
  137. _mav_put_uint8_t(buf, 4, zoom);
  138. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PTZ_STATUS, buf, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  139. #else
  140. mavlink_ptz_status_t packet;
  141. packet.pan = pan;
  142. packet.tilt = tilt;
  143. packet.zoom = zoom;
  144. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PTZ_STATUS, (const char *)&packet, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  145. #endif
  146. }
  147. /**
  148. * @brief Send a ptz_status message
  149. * @param chan MAVLink channel to send the message
  150. * @param struct The MAVLink struct to serialize
  151. */
  152. static inline void mavlink_msg_ptz_status_send_struct(mavlink_channel_t chan, const mavlink_ptz_status_t* ptz_status)
  153. {
  154. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  155. mavlink_msg_ptz_status_send(chan, ptz_status->zoom, ptz_status->pan, ptz_status->tilt);
  156. #else
  157. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PTZ_STATUS, (const char *)ptz_status, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  158. #endif
  159. }
  160. #if MAVLINK_MSG_ID_PTZ_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  161. /*
  162. This varient of _send() can be used to save stack space by re-using
  163. memory from the receive buffer. The caller provides a
  164. mavlink_message_t which is the size of a full mavlink message. This
  165. is usually the receive buffer for the channel, and allows a reply to an
  166. incoming message with minimum stack space usage.
  167. */
  168. static inline void mavlink_msg_ptz_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t zoom, int16_t pan, int16_t tilt)
  169. {
  170. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  171. char *buf = (char *)msgbuf;
  172. _mav_put_int16_t(buf, 0, pan);
  173. _mav_put_int16_t(buf, 2, tilt);
  174. _mav_put_uint8_t(buf, 4, zoom);
  175. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PTZ_STATUS, buf, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  176. #else
  177. mavlink_ptz_status_t *packet = (mavlink_ptz_status_t *)msgbuf;
  178. packet->pan = pan;
  179. packet->tilt = tilt;
  180. packet->zoom = zoom;
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PTZ_STATUS, (const char *)packet, MAVLINK_MSG_ID_PTZ_STATUS_MIN_LEN, MAVLINK_MSG_ID_PTZ_STATUS_LEN, MAVLINK_MSG_ID_PTZ_STATUS_CRC);
  182. #endif
  183. }
  184. #endif
  185. #endif
  186. // MESSAGE PTZ_STATUS UNPACKING
  187. /**
  188. * @brief Get field zoom from ptz_status message
  189. *
  190. * @return The actual Zoom Value
  191. */
  192. static inline uint8_t mavlink_msg_ptz_status_get_zoom(const mavlink_message_t* msg)
  193. {
  194. return _MAV_RETURN_uint8_t(msg, 4);
  195. }
  196. /**
  197. * @brief Get field pan from ptz_status message
  198. *
  199. * @return The Pan value in 10ths of degree
  200. */
  201. static inline int16_t mavlink_msg_ptz_status_get_pan(const mavlink_message_t* msg)
  202. {
  203. return _MAV_RETURN_int16_t(msg, 0);
  204. }
  205. /**
  206. * @brief Get field tilt from ptz_status message
  207. *
  208. * @return The Tilt value in 10ths of degree
  209. */
  210. static inline int16_t mavlink_msg_ptz_status_get_tilt(const mavlink_message_t* msg)
  211. {
  212. return _MAV_RETURN_int16_t(msg, 2);
  213. }
  214. /**
  215. * @brief Decode a ptz_status message into a struct
  216. *
  217. * @param msg The message to decode
  218. * @param ptz_status C-struct to decode the message contents into
  219. */
  220. static inline void mavlink_msg_ptz_status_decode(const mavlink_message_t* msg, mavlink_ptz_status_t* ptz_status)
  221. {
  222. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  223. ptz_status->pan = mavlink_msg_ptz_status_get_pan(msg);
  224. ptz_status->tilt = mavlink_msg_ptz_status_get_tilt(msg);
  225. ptz_status->zoom = mavlink_msg_ptz_status_get_zoom(msg);
  226. #else
  227. uint8_t len = msg->len < MAVLINK_MSG_ID_PTZ_STATUS_LEN? msg->len : MAVLINK_MSG_ID_PTZ_STATUS_LEN;
  228. memset(ptz_status, 0, MAVLINK_MSG_ID_PTZ_STATUS_LEN);
  229. memcpy(ptz_status, _MAV_PAYLOAD(msg), len);
  230. #endif
  231. }