mavlink_msg_cellular_config.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. #pragma once
  2. // MESSAGE CELLULAR_CONFIG PACKING
  3. #define MAVLINK_MSG_ID_CELLULAR_CONFIG 336
  4. typedef struct __mavlink_cellular_config_t {
  5. uint8_t enable_lte; /*< Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.*/
  6. uint8_t enable_pin; /*< Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.*/
  7. char pin[16]; /*< PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.*/
  8. char new_pin[16]; /*< New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.*/
  9. char apn[32]; /*< Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.*/
  10. char puk[16]; /*< Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.*/
  11. uint8_t roaming; /*< Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.*/
  12. uint8_t response; /*< Message acceptance response (sent back to GS).*/
  13. } mavlink_cellular_config_t;
  14. #define MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN 84
  15. #define MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN 84
  16. #define MAVLINK_MSG_ID_336_LEN 84
  17. #define MAVLINK_MSG_ID_336_MIN_LEN 84
  18. #define MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC 245
  19. #define MAVLINK_MSG_ID_336_CRC 245
  20. #define MAVLINK_MSG_CELLULAR_CONFIG_FIELD_PIN_LEN 16
  21. #define MAVLINK_MSG_CELLULAR_CONFIG_FIELD_NEW_PIN_LEN 16
  22. #define MAVLINK_MSG_CELLULAR_CONFIG_FIELD_APN_LEN 32
  23. #define MAVLINK_MSG_CELLULAR_CONFIG_FIELD_PUK_LEN 16
  24. #if MAVLINK_COMMAND_24BIT
  25. #define MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG { \
  26. 336, \
  27. "CELLULAR_CONFIG", \
  28. 8, \
  29. { { "enable_lte", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_cellular_config_t, enable_lte) }, \
  30. { "enable_pin", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_cellular_config_t, enable_pin) }, \
  31. { "pin", NULL, MAVLINK_TYPE_CHAR, 16, 2, offsetof(mavlink_cellular_config_t, pin) }, \
  32. { "new_pin", NULL, MAVLINK_TYPE_CHAR, 16, 18, offsetof(mavlink_cellular_config_t, new_pin) }, \
  33. { "apn", NULL, MAVLINK_TYPE_CHAR, 32, 34, offsetof(mavlink_cellular_config_t, apn) }, \
  34. { "puk", NULL, MAVLINK_TYPE_CHAR, 16, 66, offsetof(mavlink_cellular_config_t, puk) }, \
  35. { "roaming", NULL, MAVLINK_TYPE_UINT8_T, 0, 82, offsetof(mavlink_cellular_config_t, roaming) }, \
  36. { "response", NULL, MAVLINK_TYPE_UINT8_T, 0, 83, offsetof(mavlink_cellular_config_t, response) }, \
  37. } \
  38. }
  39. #else
  40. #define MAVLINK_MESSAGE_INFO_CELLULAR_CONFIG { \
  41. "CELLULAR_CONFIG", \
  42. 8, \
  43. { { "enable_lte", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_cellular_config_t, enable_lte) }, \
  44. { "enable_pin", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_cellular_config_t, enable_pin) }, \
  45. { "pin", NULL, MAVLINK_TYPE_CHAR, 16, 2, offsetof(mavlink_cellular_config_t, pin) }, \
  46. { "new_pin", NULL, MAVLINK_TYPE_CHAR, 16, 18, offsetof(mavlink_cellular_config_t, new_pin) }, \
  47. { "apn", NULL, MAVLINK_TYPE_CHAR, 32, 34, offsetof(mavlink_cellular_config_t, apn) }, \
  48. { "puk", NULL, MAVLINK_TYPE_CHAR, 16, 66, offsetof(mavlink_cellular_config_t, puk) }, \
  49. { "roaming", NULL, MAVLINK_TYPE_UINT8_T, 0, 82, offsetof(mavlink_cellular_config_t, roaming) }, \
  50. { "response", NULL, MAVLINK_TYPE_UINT8_T, 0, 83, offsetof(mavlink_cellular_config_t, response) }, \
  51. } \
  52. }
  53. #endif
  54. /**
  55. * @brief Pack a cellular_config message
  56. * @param system_id ID of this system
  57. * @param component_id ID of this component (e.g. 200 for IMU)
  58. * @param msg The MAVLink message to compress the data into
  59. *
  60. * @param enable_lte Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  61. * @param enable_pin Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  62. * @param pin PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.
  63. * @param new_pin New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.
  64. * @param apn Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.
  65. * @param puk Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.
  66. * @param roaming Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  67. * @param response Message acceptance response (sent back to GS).
  68. * @return length of the message in bytes (excluding serial stream start sign)
  69. */
  70. static inline uint16_t mavlink_msg_cellular_config_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  71. uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response)
  72. {
  73. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  74. char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN];
  75. _mav_put_uint8_t(buf, 0, enable_lte);
  76. _mav_put_uint8_t(buf, 1, enable_pin);
  77. _mav_put_uint8_t(buf, 82, roaming);
  78. _mav_put_uint8_t(buf, 83, response);
  79. _mav_put_char_array(buf, 2, pin, 16);
  80. _mav_put_char_array(buf, 18, new_pin, 16);
  81. _mav_put_char_array(buf, 34, apn, 32);
  82. _mav_put_char_array(buf, 66, puk, 16);
  83. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  84. #else
  85. mavlink_cellular_config_t packet;
  86. packet.enable_lte = enable_lte;
  87. packet.enable_pin = enable_pin;
  88. packet.roaming = roaming;
  89. packet.response = response;
  90. mav_array_memcpy(packet.pin, pin, sizeof(char)*16);
  91. mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16);
  92. mav_array_memcpy(packet.apn, apn, sizeof(char)*32);
  93. mav_array_memcpy(packet.puk, puk, sizeof(char)*16);
  94. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  95. #endif
  96. msg->msgid = MAVLINK_MSG_ID_CELLULAR_CONFIG;
  97. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  98. }
  99. /**
  100. * @brief Pack a cellular_config message
  101. * @param system_id ID of this system
  102. * @param component_id ID of this component (e.g. 200 for IMU)
  103. * @param status MAVLink status structure
  104. * @param msg The MAVLink message to compress the data into
  105. *
  106. * @param enable_lte Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  107. * @param enable_pin Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  108. * @param pin PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.
  109. * @param new_pin New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.
  110. * @param apn Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.
  111. * @param puk Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.
  112. * @param roaming Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  113. * @param response Message acceptance response (sent back to GS).
  114. * @return length of the message in bytes (excluding serial stream start sign)
  115. */
  116. static inline uint16_t mavlink_msg_cellular_config_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  117. uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response)
  118. {
  119. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  120. char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN];
  121. _mav_put_uint8_t(buf, 0, enable_lte);
  122. _mav_put_uint8_t(buf, 1, enable_pin);
  123. _mav_put_uint8_t(buf, 82, roaming);
  124. _mav_put_uint8_t(buf, 83, response);
  125. _mav_put_char_array(buf, 2, pin, 16);
  126. _mav_put_char_array(buf, 18, new_pin, 16);
  127. _mav_put_char_array(buf, 34, apn, 32);
  128. _mav_put_char_array(buf, 66, puk, 16);
  129. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  130. #else
  131. mavlink_cellular_config_t packet;
  132. packet.enable_lte = enable_lte;
  133. packet.enable_pin = enable_pin;
  134. packet.roaming = roaming;
  135. packet.response = response;
  136. mav_array_memcpy(packet.pin, pin, sizeof(char)*16);
  137. mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16);
  138. mav_array_memcpy(packet.apn, apn, sizeof(char)*32);
  139. mav_array_memcpy(packet.puk, puk, sizeof(char)*16);
  140. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  141. #endif
  142. msg->msgid = MAVLINK_MSG_ID_CELLULAR_CONFIG;
  143. #if MAVLINK_CRC_EXTRA
  144. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  145. #else
  146. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  147. #endif
  148. }
  149. /**
  150. * @brief Pack a cellular_config message on a channel
  151. * @param system_id ID of this system
  152. * @param component_id ID of this component (e.g. 200 for IMU)
  153. * @param chan The MAVLink channel this message will be sent over
  154. * @param msg The MAVLink message to compress the data into
  155. * @param enable_lte Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  156. * @param enable_pin Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  157. * @param pin PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.
  158. * @param new_pin New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.
  159. * @param apn Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.
  160. * @param puk Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.
  161. * @param roaming Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  162. * @param response Message acceptance response (sent back to GS).
  163. * @return length of the message in bytes (excluding serial stream start sign)
  164. */
  165. static inline uint16_t mavlink_msg_cellular_config_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  166. mavlink_message_t* msg,
  167. uint8_t enable_lte,uint8_t enable_pin,const char *pin,const char *new_pin,const char *apn,const char *puk,uint8_t roaming,uint8_t response)
  168. {
  169. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  170. char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN];
  171. _mav_put_uint8_t(buf, 0, enable_lte);
  172. _mav_put_uint8_t(buf, 1, enable_pin);
  173. _mav_put_uint8_t(buf, 82, roaming);
  174. _mav_put_uint8_t(buf, 83, response);
  175. _mav_put_char_array(buf, 2, pin, 16);
  176. _mav_put_char_array(buf, 18, new_pin, 16);
  177. _mav_put_char_array(buf, 34, apn, 32);
  178. _mav_put_char_array(buf, 66, puk, 16);
  179. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  180. #else
  181. mavlink_cellular_config_t packet;
  182. packet.enable_lte = enable_lte;
  183. packet.enable_pin = enable_pin;
  184. packet.roaming = roaming;
  185. packet.response = response;
  186. mav_array_memcpy(packet.pin, pin, sizeof(char)*16);
  187. mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16);
  188. mav_array_memcpy(packet.apn, apn, sizeof(char)*32);
  189. mav_array_memcpy(packet.puk, puk, sizeof(char)*16);
  190. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  191. #endif
  192. msg->msgid = MAVLINK_MSG_ID_CELLULAR_CONFIG;
  193. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  194. }
  195. /**
  196. * @brief Encode a cellular_config struct
  197. *
  198. * @param system_id ID of this system
  199. * @param component_id ID of this component (e.g. 200 for IMU)
  200. * @param msg The MAVLink message to compress the data into
  201. * @param cellular_config C-struct to read the message contents from
  202. */
  203. static inline uint16_t mavlink_msg_cellular_config_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_cellular_config_t* cellular_config)
  204. {
  205. return mavlink_msg_cellular_config_pack(system_id, component_id, msg, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response);
  206. }
  207. /**
  208. * @brief Encode a cellular_config struct on a channel
  209. *
  210. * @param system_id ID of this system
  211. * @param component_id ID of this component (e.g. 200 for IMU)
  212. * @param chan The MAVLink channel this message will be sent over
  213. * @param msg The MAVLink message to compress the data into
  214. * @param cellular_config C-struct to read the message contents from
  215. */
  216. static inline uint16_t mavlink_msg_cellular_config_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_cellular_config_t* cellular_config)
  217. {
  218. return mavlink_msg_cellular_config_pack_chan(system_id, component_id, chan, msg, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response);
  219. }
  220. /**
  221. * @brief Encode a cellular_config struct with provided status structure
  222. *
  223. * @param system_id ID of this system
  224. * @param component_id ID of this component (e.g. 200 for IMU)
  225. * @param status MAVLink status structure
  226. * @param msg The MAVLink message to compress the data into
  227. * @param cellular_config C-struct to read the message contents from
  228. */
  229. static inline uint16_t mavlink_msg_cellular_config_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_cellular_config_t* cellular_config)
  230. {
  231. return mavlink_msg_cellular_config_pack_status(system_id, component_id, _status, msg, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response);
  232. }
  233. /**
  234. * @brief Send a cellular_config message
  235. * @param chan MAVLink channel to send the message
  236. *
  237. * @param enable_lte Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  238. * @param enable_pin Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  239. * @param pin PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.
  240. * @param new_pin New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.
  241. * @param apn Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.
  242. * @param puk Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.
  243. * @param roaming Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  244. * @param response Message acceptance response (sent back to GS).
  245. */
  246. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  247. static inline void mavlink_msg_cellular_config_send(mavlink_channel_t chan, uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response)
  248. {
  249. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  250. char buf[MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN];
  251. _mav_put_uint8_t(buf, 0, enable_lte);
  252. _mav_put_uint8_t(buf, 1, enable_pin);
  253. _mav_put_uint8_t(buf, 82, roaming);
  254. _mav_put_uint8_t(buf, 83, response);
  255. _mav_put_char_array(buf, 2, pin, 16);
  256. _mav_put_char_array(buf, 18, new_pin, 16);
  257. _mav_put_char_array(buf, 34, apn, 32);
  258. _mav_put_char_array(buf, 66, puk, 16);
  259. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  260. #else
  261. mavlink_cellular_config_t packet;
  262. packet.enable_lte = enable_lte;
  263. packet.enable_pin = enable_pin;
  264. packet.roaming = roaming;
  265. packet.response = response;
  266. mav_array_memcpy(packet.pin, pin, sizeof(char)*16);
  267. mav_array_memcpy(packet.new_pin, new_pin, sizeof(char)*16);
  268. mav_array_memcpy(packet.apn, apn, sizeof(char)*32);
  269. mav_array_memcpy(packet.puk, puk, sizeof(char)*16);
  270. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, (const char *)&packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  271. #endif
  272. }
  273. /**
  274. * @brief Send a cellular_config message
  275. * @param chan MAVLink channel to send the message
  276. * @param struct The MAVLink struct to serialize
  277. */
  278. static inline void mavlink_msg_cellular_config_send_struct(mavlink_channel_t chan, const mavlink_cellular_config_t* cellular_config)
  279. {
  280. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  281. mavlink_msg_cellular_config_send(chan, cellular_config->enable_lte, cellular_config->enable_pin, cellular_config->pin, cellular_config->new_pin, cellular_config->apn, cellular_config->puk, cellular_config->roaming, cellular_config->response);
  282. #else
  283. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, (const char *)cellular_config, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  284. #endif
  285. }
  286. #if MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  287. /*
  288. This variant of _send() can be used to save stack space by re-using
  289. memory from the receive buffer. The caller provides a
  290. mavlink_message_t which is the size of a full mavlink message. This
  291. is usually the receive buffer for the channel, and allows a reply to an
  292. incoming message with minimum stack space usage.
  293. */
  294. static inline void mavlink_msg_cellular_config_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t enable_lte, uint8_t enable_pin, const char *pin, const char *new_pin, const char *apn, const char *puk, uint8_t roaming, uint8_t response)
  295. {
  296. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  297. char *buf = (char *)msgbuf;
  298. _mav_put_uint8_t(buf, 0, enable_lte);
  299. _mav_put_uint8_t(buf, 1, enable_pin);
  300. _mav_put_uint8_t(buf, 82, roaming);
  301. _mav_put_uint8_t(buf, 83, response);
  302. _mav_put_char_array(buf, 2, pin, 16);
  303. _mav_put_char_array(buf, 18, new_pin, 16);
  304. _mav_put_char_array(buf, 34, apn, 32);
  305. _mav_put_char_array(buf, 66, puk, 16);
  306. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, buf, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  307. #else
  308. mavlink_cellular_config_t *packet = (mavlink_cellular_config_t *)msgbuf;
  309. packet->enable_lte = enable_lte;
  310. packet->enable_pin = enable_pin;
  311. packet->roaming = roaming;
  312. packet->response = response;
  313. mav_array_memcpy(packet->pin, pin, sizeof(char)*16);
  314. mav_array_memcpy(packet->new_pin, new_pin, sizeof(char)*16);
  315. mav_array_memcpy(packet->apn, apn, sizeof(char)*32);
  316. mav_array_memcpy(packet->puk, puk, sizeof(char)*16);
  317. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CELLULAR_CONFIG, (const char *)packet, MAVLINK_MSG_ID_CELLULAR_CONFIG_MIN_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN, MAVLINK_MSG_ID_CELLULAR_CONFIG_CRC);
  318. #endif
  319. }
  320. #endif
  321. #endif
  322. // MESSAGE CELLULAR_CONFIG UNPACKING
  323. /**
  324. * @brief Get field enable_lte from cellular_config message
  325. *
  326. * @return Enable/disable LTE. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  327. */
  328. static inline uint8_t mavlink_msg_cellular_config_get_enable_lte(const mavlink_message_t* msg)
  329. {
  330. return _MAV_RETURN_uint8_t(msg, 0);
  331. }
  332. /**
  333. * @brief Get field enable_pin from cellular_config message
  334. *
  335. * @return Enable/disable PIN on the SIM card. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  336. */
  337. static inline uint8_t mavlink_msg_cellular_config_get_enable_pin(const mavlink_message_t* msg)
  338. {
  339. return _MAV_RETURN_uint8_t(msg, 1);
  340. }
  341. /**
  342. * @brief Get field pin from cellular_config message
  343. *
  344. * @return PIN sent to the SIM card. Blank when PIN is disabled. Empty when message is sent back as a response.
  345. */
  346. static inline uint16_t mavlink_msg_cellular_config_get_pin(const mavlink_message_t* msg, char *pin)
  347. {
  348. return _MAV_RETURN_char_array(msg, pin, 16, 2);
  349. }
  350. /**
  351. * @brief Get field new_pin from cellular_config message
  352. *
  353. * @return New PIN when changing the PIN. Blank to leave it unchanged. Empty when message is sent back as a response.
  354. */
  355. static inline uint16_t mavlink_msg_cellular_config_get_new_pin(const mavlink_message_t* msg, char *new_pin)
  356. {
  357. return _MAV_RETURN_char_array(msg, new_pin, 16, 18);
  358. }
  359. /**
  360. * @brief Get field apn from cellular_config message
  361. *
  362. * @return Name of the cellular APN. Blank to leave it unchanged. Current APN when sent back as a response.
  363. */
  364. static inline uint16_t mavlink_msg_cellular_config_get_apn(const mavlink_message_t* msg, char *apn)
  365. {
  366. return _MAV_RETURN_char_array(msg, apn, 32, 34);
  367. }
  368. /**
  369. * @brief Get field puk from cellular_config message
  370. *
  371. * @return Required PUK code in case the user failed to authenticate 3 times with the PIN. Empty when message is sent back as a response.
  372. */
  373. static inline uint16_t mavlink_msg_cellular_config_get_puk(const mavlink_message_t* msg, char *puk)
  374. {
  375. return _MAV_RETURN_char_array(msg, puk, 16, 66);
  376. }
  377. /**
  378. * @brief Get field roaming from cellular_config message
  379. *
  380. * @return Enable/disable roaming. 0: setting unchanged, 1: disabled, 2: enabled. Current setting when sent back as a response.
  381. */
  382. static inline uint8_t mavlink_msg_cellular_config_get_roaming(const mavlink_message_t* msg)
  383. {
  384. return _MAV_RETURN_uint8_t(msg, 82);
  385. }
  386. /**
  387. * @brief Get field response from cellular_config message
  388. *
  389. * @return Message acceptance response (sent back to GS).
  390. */
  391. static inline uint8_t mavlink_msg_cellular_config_get_response(const mavlink_message_t* msg)
  392. {
  393. return _MAV_RETURN_uint8_t(msg, 83);
  394. }
  395. /**
  396. * @brief Decode a cellular_config message into a struct
  397. *
  398. * @param msg The message to decode
  399. * @param cellular_config C-struct to decode the message contents into
  400. */
  401. static inline void mavlink_msg_cellular_config_decode(const mavlink_message_t* msg, mavlink_cellular_config_t* cellular_config)
  402. {
  403. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  404. cellular_config->enable_lte = mavlink_msg_cellular_config_get_enable_lte(msg);
  405. cellular_config->enable_pin = mavlink_msg_cellular_config_get_enable_pin(msg);
  406. mavlink_msg_cellular_config_get_pin(msg, cellular_config->pin);
  407. mavlink_msg_cellular_config_get_new_pin(msg, cellular_config->new_pin);
  408. mavlink_msg_cellular_config_get_apn(msg, cellular_config->apn);
  409. mavlink_msg_cellular_config_get_puk(msg, cellular_config->puk);
  410. cellular_config->roaming = mavlink_msg_cellular_config_get_roaming(msg);
  411. cellular_config->response = mavlink_msg_cellular_config_get_response(msg);
  412. #else
  413. uint8_t len = msg->len < MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN? msg->len : MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN;
  414. memset(cellular_config, 0, MAVLINK_MSG_ID_CELLULAR_CONFIG_LEN);
  415. memcpy(cellular_config, _MAV_PAYLOAD(msg), len);
  416. #endif
  417. }