blob: 4ff54632c21e58c856f268554ce8c73fe07fae96 [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/*-----------------------------------------------------------------------------------------------*/
2/**
3 @file ql_ms_nw.h
4 @brief network registration 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 20200518 rambo.shan Add WEA and ETWS alert indication.
21 20191225 stan.li Modify function description.
22 20191202 stan.li change the name of ql_nw_pref_nwmode_roming_info_t
23 20190528 stan.li Created .
24-------------------------------------------------------------------------------------------------*/
25
26#ifndef __QL_MS_NW_H__
27#define __QL_MS_NW_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ql_type.h"
34#include "ql_nw.h"
35
36typedef void (*ql_ms_nw_voice_reg_ind_cb)(int sim_id, ql_nw_reg_status_info_t *p_info);
37
38typedef void (*ql_ms_nw_data_reg_ind_cb)(int sim_id, ql_nw_reg_status_info_t *p_info);
39
40typedef void (*ql_ms_nw_signal_strength_ind_cb)(int sim_id, ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E level);
41
42typedef void (*ql_ms_nw_cell_access_status_ind_cb)(int sim_id, QL_NW_CELL_ACCESS_STATE_TYPE_E status);
43
44typedef void (*ql_ms_nw_nitz_time_update_ind_cb)(int sim_id, ql_nw_nitz_time_info_t *p_info);
45
46typedef void (*ql_ms_nw_network_scan_async_cb)(int sim_id, int async_index, ql_nw_scan_result_list_info_t *p_info);
47
48typedef void (*ql_ms_nw_wea_reg_ind_cb)(int sim_id, ql_nw_wea_alert_info_t *p_info);
49
50typedef void (*ql_ms_nw_etws_reg_ind_cb)(int sim_id, ql_nw_etws_alert_info_t *p_info);
51
52/*-----------------------------------------------------------------------------------------------*/
53/**
54 @brief Initialize NW service.
55 @note You must call this function before other functions can be used in this module.
56 @return Whether the NW service was successfully intialized.
57 @retval QL_ERR_OK successful
58 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
59 @retval Other error code defined by ql_type.h
60 */
61/*-----------------------------------------------------------------------------------------------*/
62int ql_ms_nw_init(void);
63
64/*-----------------------------------------------------------------------------------------------*/
65/**
66 @brief Deinitializes NW service.
67 @return Whether the NW service was deinitialized successfully.
68 @retval QL_ERR_OK successful.
69 @retval Other error code defined by ql_type.h.
70 */
71/*-----------------------------------------------------------------------------------------------*/
72int ql_ms_nw_deinit(void);
73
74/*-----------------------------------------------------------------------------------------------*/
75/**
76 @brief scan network status.
77 @param[in] sim id number
78 @param[out] async_index The index of request msg
79 @param[in] async_cb The callback function of request msg
80 @return Whether to successfully trigger the network scan operation
81 @retval QL_ERR_OK successful
82 @retval QL_ERR_NOT_INIT uninitialized
83 @retval QL_ERR_SERVICE_NOT_READY service is not ready
84 @retval QL_ERR_INVALID_ARG Invalid arguments
85 @retval Other error code defined by ql_type.h
86 */
87/*-----------------------------------------------------------------------------------------------*/
88int ql_ms_nw_network_scan(int sim_id, int *async_index, ql_ms_nw_network_scan_async_cb async_cb);
89
90/*-----------------------------------------------------------------------------------------------*/
91/**
92 @brief set power mode.
93 @param[in] sim id number
94 @param[in] lower_mode, defined by QL_NW_LOWER_POWER_MASK_XXX
95 @return Whether to successfully set the power mode
96 @retval QL_ERR_OK successful
97 @retval QL_ERR_NOT_INIT uninitialized
98 @retval QL_ERR_SERVICE_NOT_READY service is not ready
99 @retval QL_ERR_INVALID_ARG Invalid arguments
100 @retval Other error code defined by ql_type.h
101 */
102/*-----------------------------------------------------------------------------------------------*/
103int ql_ms_nw_set_power_mode(int sim_id, uint8_t lower_mode);
104
105/*-----------------------------------------------------------------------------------------------*/
106/**
107 @brief set perferred NW mode and roaming indicator.
108 @param[in] sim id number
109 @param[in] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
110 @return Whether to successfully set nwmode and roaming
111 @retval QL_ERR_OK successful
112 @retval QL_ERR_NOT_INIT uninitialized
113 @retval QL_ERR_SERVICE_NOT_READY service is not ready
114 @retval QL_ERR_INVALID_ARG Invalid arguments
115 @retval Other error code defined by ql_type.h
116 */
117/*-----------------------------------------------------------------------------------------------*/
118int ql_ms_nw_set_pref_nwmode_roaming(int sim_id, ql_nw_pref_nwmode_roaming_info_t *p_info);
119
120/*-----------------------------------------------------------------------------------------------*/
121/**
122 @brief get perferred NW mode and roaming indicator.
123 @param[in] sim id number
124 @param[out] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
125 @return Whether to successfully get nwmode and roaming
126 @retval QL_ERR_OK successful
127 @retval QL_ERR_NOT_INIT uninitialized
128 @retval QL_ERR_SERVICE_NOT_READY service is not ready
129 @retval QL_ERR_INVALID_ARG Invalid arguments
130 @retval Other error code defined by ql_type.h
131 */
132/*-----------------------------------------------------------------------------------------------*/
133int ql_ms_nw_get_pref_nwmode_roaming(int sim_id, ql_nw_pref_nwmode_roaming_info_t *p_info);
134
135/*-----------------------------------------------------------------------------------------------*/
136/**
137 @brief get mobile operator name.
138 @param[in] sim id number
139 @param[out] p_info Pointer that point to ql_nw_mobile_operator_name_info_t
140 @return Whether to successfully get the mobile operator name
141 @retval QL_ERR_OK successful
142 @retval QL_ERR_NOT_INIT uninitialized
143 @retval QL_ERR_SERVICE_NOT_READY service is not ready
144 @retval QL_ERR_INVALID_ARG Invalid arguments
145 @retval Other error code defined by ql_type.h
146 */
147/*-----------------------------------------------------------------------------------------------*/
148int ql_ms_nw_get_mobile_operator_name(int sim_id, ql_nw_mobile_operator_name_info_t *p_info);
149
150/*-----------------------------------------------------------------------------------------------*/
151/**
152 @brief get cell information.
153 @param[in] sim id number
154 @param[out] p_info Pointer that point to ql_nw_cell_info_t
155 @return Whether to successfully get the cell information
156 @retval QL_ERR_OK successful
157 @retval QL_ERR_NOT_INIT uninitialized
158 @retval QL_ERR_SERVICE_NOT_READY service is not ready
159 @retval QL_ERR_INVALID_ARG Invalid arguments
160 @retval Other error code defined by ql_type.h
161 */
162/*-----------------------------------------------------------------------------------------------*/
163int ql_ms_nw_get_cell_info(int sim_id, ql_nw_cell_info_t *p_info);
164
165/*-----------------------------------------------------------------------------------------------*/
166/**
167 @brief get voice registration status.
168 @param[in] sim id number
169 @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
170 @return Whether to successfully get the voice registration status
171 @retval QL_ERR_OK successful
172 @retval QL_ERR_NOT_INIT uninitialized
173 @retval QL_ERR_SERVICE_NOT_READY service is not ready
174 @retval QL_ERR_INVALID_ARG Invalid arguments
175 @retval Other error code defined by ql_type.h
176 */
177/*-----------------------------------------------------------------------------------------------*/
178int ql_ms_nw_get_voice_reg_status(int sim_id, ql_nw_reg_status_info_t *p_info);
179
180/*-----------------------------------------------------------------------------------------------*/
181/**
182 @brief get data registration status.
183 @param[in] sim id number
184 @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
185 @return Whether to successfully get the data registration status
186 @retval QL_ERR_OK successful
187 @retval QL_ERR_NOT_INIT uninitialized
188 @retval QL_ERR_SERVICE_NOT_READY service is not ready
189 @retval QL_ERR_INVALID_ARG Invalid arguments
190 @retval Other error code defined by ql_type.h
191 */
192/*-----------------------------------------------------------------------------------------------*/
193int ql_ms_nw_get_data_reg_status(int sim_id, ql_nw_reg_status_info_t *p_info);
194
195/*-----------------------------------------------------------------------------------------------*/
196/**
197 @brief get current signal strength.
198 @param[in] sim id number
199 @param[out] p_info Pointer that point to ql_nw_signal_strength_info_t
200 @param[out] p_level: signal strength level
201 @return Whether to successfully get the signal strength
202 @retval QL_ERR_OK successful
203 @retval QL_ERR_NOT_INIT uninitialized
204 @retval QL_ERR_SERVICE_NOT_READY service is not ready
205 @retval QL_ERR_INVALID_ARG Invalid arguments
206 @retval Other error code defined by ql_type.h
207 */
208/*-----------------------------------------------------------------------------------------------*/
209int ql_ms_nw_get_signal_strength(int sim_id, ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E* p_level);
210
211/*-----------------------------------------------------------------------------------------------*/
212/**
213 @brief get current cell acccess status.
214 @param[in] sim id number
215 @param[out] p_info Pointer that point to QL_NW_CELL_ACCESS_STATE_TYPE_E
216 @return Whether to successfully get the cell access status
217 @retval QL_ERR_OK successful
218 @retval QL_ERR_NOT_INIT uninitialized
219 @retval QL_ERR_SERVICE_NOT_READY service is not ready
220 @retval QL_ERR_INVALID_ARG Invalid arguments
221 @retval Other error code defined by ql_type.h
222 */
223/*-----------------------------------------------------------------------------------------------*/
224int ql_ms_nw_get_cell_access_status(int sim_id, QL_NW_CELL_ACCESS_STATE_TYPE_E *p_info);
225
226/*-----------------------------------------------------------------------------------------------*/
227/**
228 @brief get network time.
229 @param[in] sim id number
230 @param[out] p_info Pointer that point to ql_nw_nitz_time_info_t
231 @return Whether to successfully get the network time
232 @retval QL_ERR_OK successful
233 @retval QL_ERR_NOT_INIT uninitialized
234 @retval QL_ERR_SERVICE_NOT_READY service is not ready
235 @retval QL_ERR_INVALID_ARG Invalid arguments
236 @retval Other error code defined by ql_type.h
237 */
238/*-----------------------------------------------------------------------------------------------*/
239int ql_ms_nw_get_nitz_time_info(int sim_id, ql_nw_nitz_time_info_t *p_info);
240
241/*-----------------------------------------------------------------------------------------------*/
242/**
243 @brief register voice registration event.
244 @param[in] sim id number
245 @param[in] cb_func Voice registration indication callback function
246 @return Whether the voice registration event was successfully registered.
247 @retval QL_ERR_OK successful
248 @retval QL_ERR_NOT_INIT uninitialized
249 @retval QL_ERR_SERVICE_NOT_READY service is not ready
250 @retval QL_ERR_INVALID_ARG Invalid arguments
251 @retval Other error code defined by ql_type.h
252 */
253/*-----------------------------------------------------------------------------------------------*/
254int ql_ms_nw_set_voice_reg_ind_cb(int sim_id, ql_ms_nw_voice_reg_ind_cb cb_func);
255
256/*-----------------------------------------------------------------------------------------------*/
257/**
258 @brief register data registration event.
259 @param[in] sim id number
260 @param[in] cb_func Data registration indication callback function
261 @return Whether the data registration event was successfully registered.
262 @retval QL_ERR_OK successful
263 @retval QL_ERR_NOT_INIT uninitialized
264 @retval QL_ERR_SERVICE_NOT_READY service is not ready
265 @retval QL_ERR_INVALID_ARG Invalid arguments
266 @retval Other error code defined by ql_type.h
267 */
268/*-----------------------------------------------------------------------------------------------*/
269int ql_ms_nw_set_data_reg_ind_cb(int sim_id, ql_ms_nw_data_reg_ind_cb cb_func);
270
271/*-----------------------------------------------------------------------------------------------*/
272/**
273 @brief register signal strength event.
274 @param[in] sim id number
275 @param[in] cb_func Signal strength indication callback function
276 @return Whether the signal strength event was successfully registered
277 @retval QL_ERR_OK successful
278 @retval QL_ERR_NOT_INIT uninitialized
279 @retval QL_ERR_SERVICE_NOT_READY service is not ready
280 @retval QL_ERR_INVALID_ARG Invalid arguments
281 @retval Other error code defined by ql_type.h
282 */
283/*-----------------------------------------------------------------------------------------------*/
284int ql_ms_nw_set_signal_strength_ind_cb(int sim_id, ql_ms_nw_signal_strength_ind_cb cb_func);
285
286/*-----------------------------------------------------------------------------------------------*/
287/**
288 @brief register cell access status event.
289 @param[in] sim id number
290 @param[in] cb_func Cell access status indication callback function
291 @return Whether the cell access status event was successfully registered
292 @retval QL_ERR_OK successful
293 @retval QL_ERR_NOT_INIT uninitialized
294 @retval QL_ERR_SERVICE_NOT_READY service is not ready
295 @retval QL_ERR_INVALID_ARG Invalid arguments
296 @retval Other error code defined by ql_type.h
297 */
298/*-----------------------------------------------------------------------------------------------*/
299int ql_ms_nw_set_cell_access_status_ind_cb(int sim_id, ql_ms_nw_cell_access_status_ind_cb cb_func);
300
301/*-----------------------------------------------------------------------------------------------*/
302/**
303 @brief register network time event.
304 @param[in] sim id number
305 @param[in] cb_func nitz time update indication callback function
306 @return Whether the network time event was successfully registered
307 @retval QL_ERR_OK successful
308 @retval QL_ERR_NOT_INIT uninitialized
309 @retval QL_ERR_SERVICE_NOT_READY service is not ready
310 @retval QL_ERR_INVALID_ARG Invalid arguments
311 @retval Other error code defined by ql_type.h
312 */
313/*-----------------------------------------------------------------------------------------------*/
314int ql_ms_nw_set_nitz_time_update_ind_cb(int sim_id, ql_ms_nw_nitz_time_update_ind_cb cb_func);
315
316/*-----------------------------------------------------------------------------------------------*/
317/**
318 @brief register wea alert event.
319 @param[in] sim id number
320 @param[in] cb_func wea alert indication callback function
321 @return Whether the network time event was successfully registered
322 @retval QL_ERR_OK successful
323 @retval QL_ERR_NOT_INIT uninitialized
324 @retval QL_ERR_SERVICE_NOT_READY service is not ready
325 @retval QL_ERR_INVALID_ARG Invalid arguments
326 @retval Other error code defined by ql_type.h
327 */
328/*-----------------------------------------------------------------------------------------------*/
329int ql_ms_nw_set_wea_alert_ind_cb(int sim_id, ql_ms_nw_wea_reg_ind_cb cb_func);
330
331/*-----------------------------------------------------------------------------------------------*/
332/**
333 @brief register etws alert event.
334 @param[in] sim id number
335 @param[in] cb_func etws alert indication callback function
336 @return Whether the network time event was successfully registered
337 @retval QL_ERR_OK successful
338 @retval QL_ERR_NOT_INIT uninitialized
339 @retval QL_ERR_SERVICE_NOT_READY service is not ready
340 @retval QL_ERR_INVALID_ARG Invalid arguments
341 @retval Other error code defined by ql_type.h
342 */
343/*-----------------------------------------------------------------------------------------------*/
344int ql_ms_nw_set_etws_alert_ind_cb(int sim_id, ql_ms_nw_etws_reg_ind_cb cb_func);
345
346/*-----------------------------------------------------------------------------------------------*/
347/**
348 @brief set wea alert config.
349 @param[in] sim id number
350 @param[in] item Items to set.
351 @param[in] p_info Pointer that point to ql_nw_wea_config_t.
352 @return Whether to successfully set the wea config.
353 @retval QL_ERR_OK successful
354 @retval QL_ERR_NOT_INIT uninitialized
355 @retval QL_ERR_SERVICE_NOT_READY service is not ready
356 @retval QL_ERR_INVALID_ARG Invalid arguments
357 @retval Other error code defined by ql_type.h
358 */
359/*-----------------------------------------------------------------------------------------------*/
360int ql_ms_nw_set_wea_config(int sim_id, int item, ql_nw_wea_config_t *p_info);
361
362/*-----------------------------------------------------------------------------------------------*/
363/**
364 @brief Gets wea config.
365 @param[in] sim id number
366 @param[out] p_config wea config.
367 @return Whether the wea config was successfully obtained.
368 @retval QL_ERR_OK successful.
369 @retval QL_ERR_INVALID_ARG invalid argument.
370 @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
371 @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
372 @retval Other error code defined by ql_type.h.
373 */
374/*-----------------------------------------------------------------------------------------------*/
375int ql_ms_nw_get_wea_config(int sim_id, ql_nw_wea_config_t *p_config);
376
377/*-----------------------------------------------------------------------------------------------*/
378/**
379 @brief set etws alert config.
380 @param[in] sim id number
381 @param[in] etws config.
382 @return Whether to successfully set the etws config.
383 @retval QL_ERR_OK successful
384 @retval QL_ERR_NOT_INIT uninitialized
385 @retval QL_ERR_SERVICE_NOT_READY service is not ready
386 @retval QL_ERR_INVALID_ARG Invalid arguments
387 @retval Other error code defined by ql_type.h
388 */
389/*-----------------------------------------------------------------------------------------------*/
390int ql_ms_nw_set_etws_config(int sim_id, uint8_t enable_etws);
391
392/*-----------------------------------------------------------------------------------------------*/
393/**
394 @brief get etws alert config.
395 @param[in] sim id number
396 @param[out] p_enable_etws Pointer.
397 @return Whether to successfully set the etws config.
398 @retval QL_ERR_OK successful
399 @retval QL_ERR_NOT_INIT uninitialized
400 @retval QL_ERR_SERVICE_NOT_READY service is not ready
401 @retval QL_ERR_INVALID_ARG Invalid arguments
402 @retval Other error code defined by ql_type.h
403 */
404/*-----------------------------------------------------------------------------------------------*/
405int ql_ms_nw_get_etws_config(int sim_id, uint8_t* p_enable_etws);
406
407/*-----------------------------------------------------------------------------------------------*/
408/**
409 @brief get high capability subscription.
410 @param[in] sim id number
411 @param[out] p_high_cap pointer that point to QL_NW_BIND_SUB_TYPE_E
412 @return Whether the high capability subscription was successfully obtained.
413 @retval QL_ERR_OK successful
414 @retval QL_ERR_NOT_INIT uninitialized
415 @retval QL_ERR_SERVICE_NOT_READY service is not ready
416 @retval QL_ERR_INVALID_ARG Invalid arguments
417 @retval Other error code defined by ql_type.h
418 */
419/*-----------------------------------------------------------------------------------------------*/
420int ql_ms_nw_get_high_cap_sub(QL_NW_BIND_SUB_TYPE_E *p_high_cap);
421
422/*-----------------------------------------------------------------------------------------------*/
423/**
424 @brief set the SIM card index that can uniquely register to the 5G network.
425 the main difference between high and non-high capability subscription is that high capability
426 subscription can register to 5G network while non-high capability subscription can only
427 register to LTE or GSM.
428 @param[in] sim id number
429 @param[in] high_cap high capability subscription
430 @return Whether to successfully set the high capability subscription.
431 @retval QL_ERR_OK successful
432 @retval QL_ERR_NOT_INIT uninitialized
433 @retval QL_ERR_SERVICE_NOT_READY service is not ready
434 @retval QL_ERR_INVALID_ARG Invalid arguments
435 @retval Other error code defined by ql_type.h
436 */
437/*-----------------------------------------------------------------------------------------------*/
438int ql_ms_nw_set_high_cap_sub(QL_NW_BIND_SUB_TYPE_E high_cap);
439
440/*-----------------------------------------------------------------------------------------------*/
441/**
442 @brief Registration server error callback. Currently, only if the server exits abnormally,
443 the callback function will be executed, and the error code is QL_ERR_ABORTED;
444 @param[in] sim id number
445 @param[in] cb Callback function
446 @return
447 QL_ERR_OK - successful
448 Other - error code defined by ql_type.h
449 */
450/*-----------------------------------------------------------------------------------------------*/
451int ql_ms_nw_set_service_error_cb(ql_nw_service_error_cb_f cb);
452
453#ifdef __cplusplus
454}
455#endif
456
457
458#endif
459