b.liu | d440f9f | 2025-04-18 10:44:31 +0800 | [diff] [blame] | 1 | /*-----------------------------------------------------------------------------------------------*/ |
| 2 | /** |
| 3 | @file ql_ms_sms.h |
| 4 | @brief short message service API, support Dual Sim Dual Active(DSDA). |
| 5 | */ |
| 6 | /*-----------------------------------------------------------------------------------------------*/ |
| 7 | |
| 8 | /*------------------------------------------------------------------------------------------------- |
| 9 | Copyright (c) 2021 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 | 2021069 Stan.li Created. |
| 21 | -------------------------------------------------------------------------------------------------*/ |
| 22 | #ifndef __QL_MS_SMS_H__ |
| 23 | #define __QL_MS_SMS_H__ |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
| 28 | #include "ql_type.h" |
| 29 | #include "ql_sms.h" |
| 30 | |
| 31 | |
| 32 | typedef void (*ql_ms_sms_msg_async_cb_f)(int sim_id, int id, int result); |
| 33 | typedef void (*ql_ms_sms_msg_recv_cb_f)(int sim_id, ql_sms_msg_t *p_msg, ql_sms_timestamp_t *timestamp, |
| 34 | ql_sms_user_data_head_t *head); |
| 35 | typedef void (*ql_ms_sms_pdu_async_cb_f)(int sim_id, int id, int result); |
| 36 | typedef void (*ql_ms_sms_pdu_recv_cb_f)(int sim_id, ql_sms_pdu_t *p_pdu); |
| 37 | |
| 38 | /*-----------------------------------------------------------------------------------------------*/ |
| 39 | /** |
| 40 | @brief Initializes SMS service. |
| 41 | @return Whether the SMS service was initialized successfully. |
| 42 | @retval QL_ERR_OK successful. |
| 43 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 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_ms_sms_init(void); |
| 49 | |
| 50 | /*-----------------------------------------------------------------------------------------------*/ |
| 51 | /** |
| 52 | @brief Deinitializes SMS service. |
| 53 | @return Whether the SMS service was deinitialized successfully. |
| 54 | @retval QL_ERR_OK successful. |
| 55 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 56 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 57 | @retval Other error code defined by ql_type.h. |
| 58 | */ |
| 59 | /*-----------------------------------------------------------------------------------------------*/ |
| 60 | int ql_ms_sms_deinit(void); |
| 61 | |
| 62 | /*-----------------------------------------------------------------------------------------------*/ |
| 63 | /** |
| 64 | @brief Sets the service center address. |
| 65 | @param[in] sim id number |
| 66 | @param[in] addr service center address. |
| 67 | @param[in] len service center address length. |
| 68 | @return Whether the service center address was set successfully. |
| 69 | @retval QL_ERR_OK successful. |
| 70 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 71 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 72 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 73 | @retval Other error code defined by ql_type.h. |
| 74 | */ |
| 75 | /*-----------------------------------------------------------------------------------------------*/ |
| 76 | int ql_ms_sms_set_service_center_addr(int sim_id, char *addr, int len); |
| 77 | |
| 78 | /*-----------------------------------------------------------------------------------------------*/ |
| 79 | /** |
| 80 | @brief Gets the service center address. |
| 81 | @param[in] sim id number |
| 82 | @param[out] addr service center address. |
| 83 | @param[in] len service center address length. |
| 84 | @return Whether the service center address was successfully obtained. |
| 85 | @retval QL_ERR_OK successful. |
| 86 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 87 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 88 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 89 | @retval Other error code defined by ql_type.h. |
| 90 | */ |
| 91 | /*-----------------------------------------------------------------------------------------------*/ |
| 92 | int ql_ms_sms_get_service_center_addr(int sim_id, char *addr, int len); |
| 93 | |
| 94 | /*-----------------------------------------------------------------------------------------------*/ |
| 95 | /** |
| 96 | @brief Sends message synchronously. |
| 97 | @param[in] sim id number |
| 98 | @param[in] p_msg pointer to ql_ms_sms_msg_t. |
| 99 | @return Whether the message was successfully sent synchronously. |
| 100 | @retval QL_ERR_OK successful. |
| 101 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 102 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 103 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 104 | @retval Other error code defined by ql_type.h. |
| 105 | */ |
| 106 | /*-----------------------------------------------------------------------------------------------*/ |
| 107 | int ql_ms_sms_send_msg(int sim_id, ql_sms_msg_t *p_msg); |
| 108 | |
| 109 | /*-----------------------------------------------------------------------------------------------*/ |
| 110 | /** |
| 111 | @brief Sends message asynchronously. |
| 112 | @param[in] sim id number |
| 113 | @param[in] p_msg pointer to ql_ms_sms_msg_t |
| 114 | @param[out] id id for this async operation |
| 115 | @param[in] cb async callback |
| 116 | @return Whether the message was successfully sent asynchronously. |
| 117 | @retval QL_ERR_OK successful. |
| 118 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 119 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 120 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 121 | @retval Other error code defined by ql_type.h. |
| 122 | */ |
| 123 | /*-----------------------------------------------------------------------------------------------*/ |
| 124 | int ql_ms_sms_send_msg_async(int sim_id, ql_sms_msg_t *p_msg, int *id, ql_ms_sms_msg_async_cb_f cb); |
| 125 | |
| 126 | /*-----------------------------------------------------------------------------------------------*/ |
| 127 | /** |
| 128 | @brief Sets SMS message reception callback hanlder. |
| 129 | @param[in] sim id number |
| 130 | @param[in] cb message reception callback handler. |
| 131 | @return Whether the message reception callback hanlder was set successfully. |
| 132 | @retval QL_ERR_OK successful. |
| 133 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 134 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 135 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 136 | @retval Other error code defined by ql_type.h. |
| 137 | */ |
| 138 | /*-----------------------------------------------------------------------------------------------*/ |
| 139 | int ql_ms_sms_set_msg_recv_cb(int sim_id, ql_ms_sms_msg_recv_cb_f cb); |
| 140 | |
| 141 | /*-----------------------------------------------------------------------------------------------*/ |
| 142 | /** |
| 143 | @brief Sends PDU synchronously. |
| 144 | @param[in] sim id number |
| 145 | @param[in] p_pdu SMS PDU. |
| 146 | @return Whether the PDU was successfully sent synchronously. |
| 147 | @retval QL_ERR_OK successful. |
| 148 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 149 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 150 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 151 | @retval Other error code defined by ql_type.h. |
| 152 | */ |
| 153 | /*-----------------------------------------------------------------------------------------------*/ |
| 154 | int ql_ms_sms_send_pdu(int sim_id, ql_sms_pdu_t *p_pdu); |
| 155 | |
| 156 | /*-----------------------------------------------------------------------------------------------*/ |
| 157 | /** |
| 158 | @brief Sends PDU asynchronously. |
| 159 | @param[in] sim id number |
| 160 | @param[in] p_pdu sms pdu. |
| 161 | @param[out] id id for this async operation. |
| 162 | @param[in] cb async callback. |
| 163 | @return Whether the PDU was successfully sent asynchronously. |
| 164 | @retval QL_ERR_OK successful. |
| 165 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 166 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 167 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 168 | @retval Other error code defined by ql_type.h. |
| 169 | */ |
| 170 | /*-----------------------------------------------------------------------------------------------*/ |
| 171 | int ql_ms_sms_send_pdu_async(int sim_id, ql_sms_pdu_t *p_pdu, int *id, ql_ms_sms_pdu_async_cb_f cb); |
| 172 | |
| 173 | /*-----------------------------------------------------------------------------------------------*/ |
| 174 | /** |
| 175 | @brief Sets SMS PDU reception callback hanlder. |
| 176 | @param[in] sim id number |
| 177 | @param[in] cb PDU reception callback handler. |
| 178 | @return Whether the PDU reception callback hanlder was set successfully. |
| 179 | @retval QL_ERR_OK successful. |
| 180 | @retval QL_ERR_INVALID_ARG invalid argument. |
| 181 | @retval QL_ERR_UNKNOWN unknown error, failed to connect to service. |
| 182 | @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry. |
| 183 | @retval Other error code defined by ql_type.h. |
| 184 | */ |
| 185 | /*-----------------------------------------------------------------------------------------------*/ |
| 186 | int ql_ms_sms_set_pdu_recv_cb(int sim_id, ql_ms_sms_pdu_recv_cb_f cb); |
| 187 | |
| 188 | /*-----------------------------------------------------------------------------------------------*/ |
| 189 | /** |
| 190 | @brief Registration server error callback. Currently, only if the server exits abnormally, |
| 191 | the callback function will be executed, and the error code is QL_ERR_ABORTED; |
| 192 | @param[in] cb Callback function |
| 193 | @return |
| 194 | QL_ERR_OK - successful |
| 195 | Other - error code defined by ql_type.h |
| 196 | */ |
| 197 | /*-----------------------------------------------------------------------------------------------*/ |
| 198 | int ql_ms_sms_set_service_error_cb(ql_sms_service_error_cb_f cb); |
| 199 | |
| 200 | #ifdef __cplusplus |
| 201 | } |
| 202 | #endif |
| 203 | |
| 204 | |
| 205 | #endif |
| 206 | |