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.

363 lines
15 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE CELLULAR_STATUS PACKING
  3. #define MAVLINK_MSG_ID_CELLULAR_STATUS 334
  4. MAVPACKED(
  5. typedef struct __mavlink_cellular_status_t {
  6. uint32_t cid; /*< Cell ID. If unknown, set to: UINT32_MAX*/
  7. uint16_t status; /*< Status bitmap*/
  8. uint16_t mcc; /*< Mobile country code. If unknown, set to: UINT16_MAX*/
  9. uint16_t mnc; /*< Mobile network code. If unknown, set to: UINT16_MAX*/
  10. uint16_t lac; /*< Location area code. If unknown, set to: 0*/
  11. uint8_t type; /*< Cellular network radio type: gsm, cdma, lte...*/
  12. uint8_t quality; /*< Cellular network RSSI/RSRP in dBm, absolute value*/
  13. }) mavlink_cellular_status_t;
  14. #define MAVLINK_MSG_ID_CELLULAR_STATUS_LEN 14
  15. #define MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN 14
  16. #define MAVLINK_MSG_ID_334_LEN 14
  17. #define MAVLINK_MSG_ID_334_MIN_LEN 14
  18. #define MAVLINK_MSG_ID_CELLULAR_STATUS_CRC 135
  19. #define MAVLINK_MSG_ID_334_CRC 135
  20. #if MAVLINK_COMMAND_24BIT
  21. #define MAVLINK_MESSAGE_INFO_CELLULAR_STATUS { \
  22. 334, \
  23. "CELLULAR_STATUS", \
  24. 7, \
  25. { { "status", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_cellular_status_t, status) }, \
  26. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_cellular_status_t, type) }, \
  27. { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_cellular_status_t, quality) }, \
  28. { "mcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_cellular_status_t, mcc) }, \
  29. { "mnc", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_cellular_status_t, mnc) }, \
  30. { "lac", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_cellular_status_t, lac) }, \
  31. { "cid", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_cellular_status_t, cid) }, \
  32. } \
  33. }
  34. #else
  35. #define MAVLINK_MESSAGE_INFO_CELLULAR_STATUS { \
  36. "CELLULAR_STATUS", \
  37. 7, \
  38. { { "status", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_cellular_status_t, status) }, \
  39. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_cellular_status_t, type) }, \
  40. { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_cellular_status_t, quality) }, \
  41. { "mcc", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_cellular_status_t, mcc) }, \
  42. { "mnc", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_cellular_status_t, mnc) }, \
  43. { "lac", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_cellular_status_t, lac) }, \
  44. { "cid", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_cellular_status_t, cid) }, \
  45. } \
  46. }
  47. #endif
  48. /**
  49. * @brief Pack a cellular_status message
  50. * @param system_id ID of this system
  51. * @param component_id ID of this component (e.g. 200 for IMU)
  52. * @param msg The MAVLink message to compress the data into
  53. *
  54. * @param status Status bitmap
  55. * @param type Cellular network radio type: gsm, cdma, lte...
  56. * @param quality Cellular network RSSI/RSRP in dBm, absolute value
  57. * @param mcc Mobile country code. If unknown, set to: UINT16_MAX
  58. * @param mnc Mobile network code. If unknown, set to: UINT16_MAX
  59. * @param lac Location area code. If unknown, set to: 0
  60. * @param cid Cell ID. If unknown, set to: UINT32_MAX
  61. * @return length of the message in bytes (excluding serial stream start sign)
  62. */
  63. static inline uint16_t mavlink_msg_cellular_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  64. uint16_t status, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint32_t cid)
  65. {
  66. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  67. char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN];
  68. _mav_put_uint32_t(buf, 0, cid);
  69. _mav_put_uint16_t(buf, 4, status);
  70. _mav_put_uint16_t(buf, 6, mcc);
  71. _mav_put_uint16_t(buf, 8, mnc);
  72. _mav_put_uint16_t(buf, 10, lac);
  73. _mav_put_uint8_t(buf, 12, type);
  74. _mav_put_uint8_t(buf, 13, quality);
  75. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN);
  76. #else
  77. mavlink_cellular_status_t packet;
  78. packet.cid = cid;
  79. packet.status = status;
  80. packet.mcc = mcc;
  81. packet.mnc = mnc;
  82. packet.lac = lac;
  83. packet.type = type;
  84. packet.quality = quality;
  85. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN);
  86. #endif
  87. msg->msgid = MAVLINK_MSG_ID_CELLULAR_STATUS;
  88. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  89. }
  90. /**
  91. * @brief Pack a cellular_status message on a channel
  92. * @param system_id ID of this system
  93. * @param component_id ID of this component (e.g. 200 for IMU)
  94. * @param chan The MAVLink channel this message will be sent over
  95. * @param msg The MAVLink message to compress the data into
  96. * @param status Status bitmap
  97. * @param type Cellular network radio type: gsm, cdma, lte...
  98. * @param quality Cellular network RSSI/RSRP in dBm, absolute value
  99. * @param mcc Mobile country code. If unknown, set to: UINT16_MAX
  100. * @param mnc Mobile network code. If unknown, set to: UINT16_MAX
  101. * @param lac Location area code. If unknown, set to: 0
  102. * @param cid Cell ID. If unknown, set to: UINT32_MAX
  103. * @return length of the message in bytes (excluding serial stream start sign)
  104. */
  105. static inline uint16_t mavlink_msg_cellular_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  106. mavlink_message_t* msg,
  107. uint16_t status,uint8_t type,uint8_t quality,uint16_t mcc,uint16_t mnc,uint16_t lac,uint32_t cid)
  108. {
  109. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  110. char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN];
  111. _mav_put_uint32_t(buf, 0, cid);
  112. _mav_put_uint16_t(buf, 4, status);
  113. _mav_put_uint16_t(buf, 6, mcc);
  114. _mav_put_uint16_t(buf, 8, mnc);
  115. _mav_put_uint16_t(buf, 10, lac);
  116. _mav_put_uint8_t(buf, 12, type);
  117. _mav_put_uint8_t(buf, 13, quality);
  118. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN);
  119. #else
  120. mavlink_cellular_status_t packet;
  121. packet.cid = cid;
  122. packet.status = status;
  123. packet.mcc = mcc;
  124. packet.mnc = mnc;
  125. packet.lac = lac;
  126. packet.type = type;
  127. packet.quality = quality;
  128. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN);
  129. #endif
  130. msg->msgid = MAVLINK_MSG_ID_CELLULAR_STATUS;
  131. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  132. }
  133. /**
  134. * @brief Encode a cellular_status struct
  135. *
  136. * @param system_id ID of this system
  137. * @param component_id ID of this component (e.g. 200 for IMU)
  138. * @param msg The MAVLink message to compress the data into
  139. * @param cellular_status C-struct to read the message contents from
  140. */
  141. static inline uint16_t mavlink_msg_cellular_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_cellular_status_t* cellular_status)
  142. {
  143. return mavlink_msg_cellular_status_pack(system_id, component_id, msg, cellular_status->status, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->cid);
  144. }
  145. /**
  146. * @brief Encode a cellular_status struct on a channel
  147. *
  148. * @param system_id ID of this system
  149. * @param component_id ID of this component (e.g. 200 for IMU)
  150. * @param chan The MAVLink channel this message will be sent over
  151. * @param msg The MAVLink message to compress the data into
  152. * @param cellular_status C-struct to read the message contents from
  153. */
  154. static inline uint16_t mavlink_msg_cellular_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_cellular_status_t* cellular_status)
  155. {
  156. return mavlink_msg_cellular_status_pack_chan(system_id, component_id, chan, msg, cellular_status->status, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->cid);
  157. }
  158. /**
  159. * @brief Send a cellular_status message
  160. * @param chan MAVLink channel to send the message
  161. *
  162. * @param status Status bitmap
  163. * @param type Cellular network radio type: gsm, cdma, lte...
  164. * @param quality Cellular network RSSI/RSRP in dBm, absolute value
  165. * @param mcc Mobile country code. If unknown, set to: UINT16_MAX
  166. * @param mnc Mobile network code. If unknown, set to: UINT16_MAX
  167. * @param lac Location area code. If unknown, set to: 0
  168. * @param cid Cell ID. If unknown, set to: UINT32_MAX
  169. */
  170. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  171. static inline void mavlink_msg_cellular_status_send(mavlink_channel_t chan, uint16_t status, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint32_t cid)
  172. {
  173. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  174. char buf[MAVLINK_MSG_ID_CELLULAR_STATUS_LEN];
  175. _mav_put_uint32_t(buf, 0, cid);
  176. _mav_put_uint16_t(buf, 4, status);
  177. _mav_put_uint16_t(buf, 6, mcc);
  178. _mav_put_uint16_t(buf, 8, mnc);
  179. _mav_put_uint16_t(buf, 10, lac);
  180. _mav_put_uint8_t(buf, 12, type);
  181. _mav_put_uint8_t(buf, 13, quality);
  182. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, buf, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  183. #else
  184. mavlink_cellular_status_t packet;
  185. packet.cid = cid;
  186. packet.status = status;
  187. packet.mcc = mcc;
  188. packet.mnc = mnc;
  189. packet.lac = lac;
  190. packet.type = type;
  191. packet.quality = quality;
  192. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  193. #endif
  194. }
  195. /**
  196. * @brief Send a cellular_status message
  197. * @param chan MAVLink channel to send the message
  198. * @param struct The MAVLink struct to serialize
  199. */
  200. static inline void mavlink_msg_cellular_status_send_struct(mavlink_channel_t chan, const mavlink_cellular_status_t* cellular_status)
  201. {
  202. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  203. mavlink_msg_cellular_status_send(chan, cellular_status->status, cellular_status->type, cellular_status->quality, cellular_status->mcc, cellular_status->mnc, cellular_status->lac, cellular_status->cid);
  204. #else
  205. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)cellular_status, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  206. #endif
  207. }
  208. #if MAVLINK_MSG_ID_CELLULAR_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  209. /*
  210. This varient of _send() can be used to save stack space by re-using
  211. memory from the receive buffer. The caller provides a
  212. mavlink_message_t which is the size of a full mavlink message. This
  213. is usually the receive buffer for the channel, and allows a reply to an
  214. incoming message with minimum stack space usage.
  215. */
  216. static inline void mavlink_msg_cellular_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t status, uint8_t type, uint8_t quality, uint16_t mcc, uint16_t mnc, uint16_t lac, uint32_t cid)
  217. {
  218. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  219. char *buf = (char *)msgbuf;
  220. _mav_put_uint32_t(buf, 0, cid);
  221. _mav_put_uint16_t(buf, 4, status);
  222. _mav_put_uint16_t(buf, 6, mcc);
  223. _mav_put_uint16_t(buf, 8, mnc);
  224. _mav_put_uint16_t(buf, 10, lac);
  225. _mav_put_uint8_t(buf, 12, type);
  226. _mav_put_uint8_t(buf, 13, quality);
  227. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, buf, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  228. #else
  229. mavlink_cellular_status_t *packet = (mavlink_cellular_status_t *)msgbuf;
  230. packet->cid = cid;
  231. packet->status = status;
  232. packet->mcc = mcc;
  233. packet->mnc = mnc;
  234. packet->lac = lac;
  235. packet->type = type;
  236. packet->quality = quality;
  237. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_STATUS, (const char *)packet, MAVLINK_MSG_ID_CELLULAR_STATUS_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN, MAVLINK_MSG_ID_CELLULAR_STATUS_CRC);
  238. #endif
  239. }
  240. #endif
  241. #endif
  242. // MESSAGE CELLULAR_STATUS UNPACKING
  243. /**
  244. * @brief Get field status from cellular_status message
  245. *
  246. * @return Status bitmap
  247. */
  248. static inline uint16_t mavlink_msg_cellular_status_get_status(const mavlink_message_t* msg)
  249. {
  250. return _MAV_RETURN_uint16_t(msg, 4);
  251. }
  252. /**
  253. * @brief Get field type from cellular_status message
  254. *
  255. * @return Cellular network radio type: gsm, cdma, lte...
  256. */
  257. static inline uint8_t mavlink_msg_cellular_status_get_type(const mavlink_message_t* msg)
  258. {
  259. return _MAV_RETURN_uint8_t(msg, 12);
  260. }
  261. /**
  262. * @brief Get field quality from cellular_status message
  263. *
  264. * @return Cellular network RSSI/RSRP in dBm, absolute value
  265. */
  266. static inline uint8_t mavlink_msg_cellular_status_get_quality(const mavlink_message_t* msg)
  267. {
  268. return _MAV_RETURN_uint8_t(msg, 13);
  269. }
  270. /**
  271. * @brief Get field mcc from cellular_status message
  272. *
  273. * @return Mobile country code. If unknown, set to: UINT16_MAX
  274. */
  275. static inline uint16_t mavlink_msg_cellular_status_get_mcc(const mavlink_message_t* msg)
  276. {
  277. return _MAV_RETURN_uint16_t(msg, 6);
  278. }
  279. /**
  280. * @brief Get field mnc from cellular_status message
  281. *
  282. * @return Mobile network code. If unknown, set to: UINT16_MAX
  283. */
  284. static inline uint16_t mavlink_msg_cellular_status_get_mnc(const mavlink_message_t* msg)
  285. {
  286. return _MAV_RETURN_uint16_t(msg, 8);
  287. }
  288. /**
  289. * @brief Get field lac from cellular_status message
  290. *
  291. * @return Location area code. If unknown, set to: 0
  292. */
  293. static inline uint16_t mavlink_msg_cellular_status_get_lac(const mavlink_message_t* msg)
  294. {
  295. return _MAV_RETURN_uint16_t(msg, 10);
  296. }
  297. /**
  298. * @brief Get field cid from cellular_status message
  299. *
  300. * @return Cell ID. If unknown, set to: UINT32_MAX
  301. */
  302. static inline uint32_t mavlink_msg_cellular_status_get_cid(const mavlink_message_t* msg)
  303. {
  304. return _MAV_RETURN_uint32_t(msg, 0);
  305. }
  306. /**
  307. * @brief Decode a cellular_status message into a struct
  308. *
  309. * @param msg The message to decode
  310. * @param cellular_status C-struct to decode the message contents into
  311. */
  312. static inline void mavlink_msg_cellular_status_decode(const mavlink_message_t* msg, mavlink_cellular_status_t* cellular_status)
  313. {
  314. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  315. cellular_status->cid = mavlink_msg_cellular_status_get_cid(msg);
  316. cellular_status->status = mavlink_msg_cellular_status_get_status(msg);
  317. cellular_status->mcc = mavlink_msg_cellular_status_get_mcc(msg);
  318. cellular_status->mnc = mavlink_msg_cellular_status_get_mnc(msg);
  319. cellular_status->lac = mavlink_msg_cellular_status_get_lac(msg);
  320. cellular_status->type = mavlink_msg_cellular_status_get_type(msg);
  321. cellular_status->quality = mavlink_msg_cellular_status_get_quality(msg);
  322. #else
  323. uint8_t len = msg->len < MAVLINK_MSG_ID_CELLULAR_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CELLULAR_STATUS_LEN;
  324. memset(cellular_status, 0, MAVLINK_MSG_ID_CELLULAR_STATUS_LEN);
  325. memcpy(cellular_status, _MAV_PAYLOAD(msg), len);
  326. #endif
  327. }