b.liu | d440f9f | 2025-04-18 10:44:31 +0800 | [diff] [blame^] | 1 | /*-----------------------------------------------------------------------------------------------*/ |
| 2 | /** |
| 3 | @file ql_atc.h |
| 4 | @brief AT command API |
| 5 | */ |
| 6 | /*-----------------------------------------------------------------------------------------------*/ |
| 7 | |
| 8 | /*------------------------------------------------------------------------------------------------- |
| 9 | Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. |
| 10 | Quectel Wireless Solution Proprietary and Confidential. |
| 11 | -------------------------------------------------------------------------------------------------*/ |
| 12 | |
| 13 | /*------------------------------------------------------------------------------------------------- |
| 14 | EDIT HISTORY |
| 15 | This section contains comments describing changes made to the file. |
| 16 | Notice that changes are listed in reverse chronological order. |
| 17 | $Header: $ |
| 18 | when who what, where, why |
| 19 | -------- --- ---------------------------------------------------------- |
| 20 | 20191225 stan.li Modify function description. |
| 21 | 20191225 solomon.cui Fix possible null pointer dereference. |
| 22 | 20190702 stan.li Created . |
| 23 | -------------------------------------------------------------------------------------------------*/ |
| 24 | |
| 25 | #ifndef __QL_ATC_H__ |
| 26 | #define __QL_ATC_H__ |
| 27 | |
| 28 | #ifdef __cplusplus |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| 32 | #define QL_ATC_MAX_REQ_MSG_LEN 513 /**< Maximum request message size. */ |
| 33 | #define QL_ATC_MAX_RESP_MSG_LEN 4097 /**< Maximum response message size. */ |
| 34 | |
| 35 | typedef void (*ql_atc_async_cb)(int async_index, char *req_buf, char *rsp_buf); |
| 36 | typedef void (*ql_atc_service_error_cb_f)(int error); |
| 37 | |
| 38 | /*-----------------------------------------------------------------------------------------------*/ |
| 39 | /** |
| 40 | @brief Initialize ATC service. |
| 41 | @note You must call this function before other functions can be used in this module. |
| 42 | @return Whether the ATC service was successfully intialized. |
| 43 | @retval QL_ERR_OK successful. |
| 44 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 45 | @retval Other error code defined by ql_type.h. |
| 46 | */ |
| 47 | /*-----------------------------------------------------------------------------------------------*/ |
| 48 | int ql_atc_init(void); |
| 49 | |
| 50 | |
| 51 | /*-----------------------------------------------------------------------------------------------*/ |
| 52 | /** |
| 53 | @brief send at command async. |
| 54 | @param[in] req_buf At command request content |
| 55 | @param[out] async_index Async AT command index |
| 56 | @param[in] async_cb Async callback function |
| 57 | @return Whether to successfully send the AT command asynchronously |
| 58 | @retval QL_ERR_OK successful |
| 59 | @retval QL_ERR_NOT_INIT uninitialized |
| 60 | @retval QL_ERR_SERVICE_NOT_READY service is not ready |
| 61 | @retval Other error code defined by ql_type.h |
| 62 | */ |
| 63 | /*-----------------------------------------------------------------------------------------------*/ |
| 64 | int ql_atc_send_async(char *req_buf, int *async_index, void *async_cb); |
| 65 | |
| 66 | |
| 67 | /*-----------------------------------------------------------------------------------------------*/ |
| 68 | /** |
| 69 | @brief send AT command. |
| 70 | @param[in] req_buf At command request content |
| 71 | @param[in] rsp_buf At command response content |
| 72 | @param[in] rsp_len The length of rsp_buf |
| 73 | @return Whether to successfully send AT command |
| 74 | @retval QL_ERR_OK successful |
| 75 | @retval QL_ERR_NOT_INIT uninitialized |
| 76 | @retval QL_ERR_SERVICE_NOT_READY service is not ready |
| 77 | @retval Other error code defined by ql_type.h |
| 78 | */ |
| 79 | /*-----------------------------------------------------------------------------------------------*/ |
| 80 | int ql_atc_send(char *req_buf, char *rsp_buf, int rsp_len); |
| 81 | |
| 82 | /*-----------------------------------------------------------------------------------------------*/ |
| 83 | /** |
| 84 | @brief Deinitialize ATC service. |
| 85 | @return Whether the DM service was successfully deintialized. |
| 86 | @retval QL_ERR_OK successful. |
| 87 | @retval Other error code defined by ql_type.h. |
| 88 | */ |
| 89 | /*-----------------------------------------------------------------------------------------------*/ |
| 90 | int ql_atc_deinit(void); |
| 91 | |
| 92 | |
| 93 | #ifdef __cplusplus |
| 94 | } |
| 95 | #endif |
| 96 | |
| 97 | |
| 98 | #endif |