blob: b25c38f7683512be3a161001c54cff9098d745be [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/*-----------------------------------------------------------------------------------------------*/
2/**
3 @file ql_dm.h
4 @brief device management API
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 20200316 stan.li Optimize the ql_dm_get_modem_state interface
21 20191224 stan.li Add radio on/off API
22 20190625 stan.li Created .
23-------------------------------------------------------------------------------------------------*/
24
25#ifndef __QL_MS_DM_H__
26#define __QL_MS_DM_H__
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include "ql_type.h"
33#include "ql_dm.h"
34
35typedef void (*ql_ms_dm_air_plane_mode_ind_cb)(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
36typedef void (*ql_ms_dm_modem_state_ind_cb)(int statue);
37
38/*-----------------------------------------------------------------------------------------------*/
39/**
40 @brief Initialize DM service.
41 @note You must call this function before other functions can be used in this module.
42 @return Whether the DM 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/*-----------------------------------------------------------------------------------------------*/
48int ql_ms_dm_init(void);
49
50
51/*-----------------------------------------------------------------------------------------------*/
52/**
53 @brief Deinitialize DM service.
54 @return Whether the DM service was successfully deintialized.
55 @retval QL_ERR_OK successful.
56 @retval Other error code defined by ql_type.h.
57 */
58/*-----------------------------------------------------------------------------------------------*/
59int ql_ms_dm_deinit(void);
60
61
62/*-----------------------------------------------------------------------------------------------*/
63/**
64 @brief get device software version.
65 @param[out] soft_ver Return software version
66 @param[in] soft_ver_len The length of soft_ver
67 @return Whether to successfully get the software version
68 @retval QL_ERR_OK successful
69 @retval QL_ERR_NOT_INIT uninitialized
70 @retval QL_ERR_SERVICE_NOT_READY service is not ready
71 @retval QL_ERR_INVALID_ARG Invalid arguments
72 @retval Other error code defined by ql_type.h
73 */
74/*-----------------------------------------------------------------------------------------------*/
75int ql_ms_dm_get_software_version(char *soft_ver, int soft_ver_len);
76
77
78/*-----------------------------------------------------------------------------------------------*/
79/**
80 @brief get modem state.
81 @details QL_DM_MODEM_STATE_ONLINE,if modem starts normally.
82 @details QL_DM_MODEM_STATE_OFFLINE,in modem starts abnormally.
83 @details QL_DM_MODEM_STATE_UNKNOWN,unknown error.
84 @param[out] modem_state The state of modem
85 @return Whether to successfully get the modem state
86 @retval QL_ERR_OK successful
87 @retval QL_ERR_NOT_INIT uninitialized
88 @retval QL_ERR_SERVICE_NOT_READY service is not ready
89 @retval QL_ERR_INVALID_ARG Invalid arguments
90 @retval Other error code defined by ql_type.h
91 */
92/*-----------------------------------------------------------------------------------------------*/
93int ql_ms_dm_get_modem_state(QL_DM_MODEM_STATE_TYPE_E *modem_state);
94
95/*-----------------------------------------------------------------------------------------------*/
96/**
97 @brief register modem state event.
98 @param[in] cb_func modem state indication callback function
99 @return Whether the modem state event was successfully registered.
100 @retval QL_ERR_OK successful
101 @retval QL_ERR_NOT_INIT uninitialized
102 @retval QL_ERR_SERVICE_NOT_READY service is not ready
103 @retval QL_ERR_INVALID_ARG Invalid arguments
104 @retval Other error code defined by ql_type.h
105 */
106/*-----------------------------------------------------------------------------------------------*/
107int ql_ms_dm_set_modem_state_change_ind_cb(ql_dm_modem_state_ind_cb cb_func);
108
109/*-----------------------------------------------------------------------------------------------*/
110/**
111 @brief get module temperature.
112 @param[out] temperature The current temperature
113 @return Whether to successfully get the temperature
114 @retval QL_ERR_OK successful
115 @retval QL_ERR_NOT_INIT uninitialized
116 @retval QL_ERR_SERVICE_NOT_READY service is not ready
117 @retval QL_ERR_INVALID_ARG Invalid arguments
118 @retval Other error code defined by ql_type.h
119 */
120/*-----------------------------------------------------------------------------------------------*/
121int ql_ms_dm_get_temperature(float *temperature);
122
123
124/*-----------------------------------------------------------------------------------------------*/
125/**
126 @brief get device serial numbers.
127 @param[out] p_info Pointer that point to ql_dm_device_serial_numbers_info_t
128 @return Whether to successfully get the serial numbers
129 @retval QL_ERR_OK successful
130 @retval QL_ERR_NOT_INIT uninitialized
131 @retval QL_ERR_SERVICE_NOT_READY service is not ready
132 @retval QL_ERR_INVALID_ARG Invalid arguments
133 @retval Other error code defined by ql_type.h
134 */
135/*-----------------------------------------------------------------------------------------------*/
136int ql_ms_dm_get_device_serial_numbers(ql_dm_device_serial_numbers_info_t *p_info);
137
138
139/*-----------------------------------------------------------------------------------------------*/
140/**
141 @brief get device firmware revision identification.
142 @param[out] firmware_rev_id Return device firmware revision id
143 @param[in] firmware_rev_id_len The length of firmware_rev_id
144 @return Whether to successfully get the firmware revision id
145 @retval QL_ERR_OK successful
146 @retval QL_ERR_NOT_INIT uninitialized
147 @retval QL_ERR_SERVICE_NOT_READY service is not ready
148 @retval QL_ERR_INVALID_ARG Invalid arguments
149 @retval Other error code defined by ql_type.h
150 */
151/*-----------------------------------------------------------------------------------------------*/
152int ql_ms_dm_get_device_firmware_rev_id(char *firmware_rev_id, int firmware_rev_id_len);
153
154
155/*-----------------------------------------------------------------------------------------------*/
156/**
157 @brief get air plane mode.
158 @param[in] sim id number
159 @param[out] p_info Pointer that point to QL_DM_AIR_PLANE_MODE_TYPE_E
160 @return Whether to successfully get the air plane mode
161 @retval QL_ERR_OK successful
162 @retval QL_ERR_NOT_INIT uninitialized
163 @retval QL_ERR_SERVICE_NOT_READY service is not ready
164 @retval QL_ERR_INVALID_ARG Invalid arguments
165 @retval Other error code defined by ql_type.h
166 */
167/*-----------------------------------------------------------------------------------------------*/
168int ql_ms_dm_get_air_plane_mode(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E *p_info);
169
170
171/*-----------------------------------------------------------------------------------------------*/
172/**
173 @brief set air plane mode.
174 @param[in] sim id number
175 @param[in] air_plane_mode 1:ON, 2:OFF
176 @return Whether to successfully set the air plane mode
177 @retval QL_ERR_OK successful
178 @retval QL_ERR_NOT_INIT uninitialized
179 @retval QL_ERR_SERVICE_NOT_READY service is not ready
180 @retval QL_ERR_INVALID_ARG Invalid arguments
181 @retval Other error code defined by ql_type.h
182 */
183/*-----------------------------------------------------------------------------------------------*/
184int ql_ms_dm_set_air_plane_mode(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
185
186
187/*-----------------------------------------------------------------------------------------------*/
188/**
189 @brief register air plane mode event.
190 @param[in] sim_id Sim id number
191 @param[in] cb_func Air plane mode indication callback function
192 @return Whether the air plane mode event was successfully registered.
193 @retval QL_ERR_OK successful
194 @retval QL_ERR_NOT_INIT uninitialized
195 @retval QL_ERR_SERVICE_NOT_READY service is not ready
196 @retval QL_ERR_INVALID_ARG Invalid arguments
197 @retval Other error code defined by ql_type.h
198 */
199/*-----------------------------------------------------------------------------------------------*/
200int ql_ms_dm_set_air_plane_mode_ind_cb(int sim_id, ql_ms_dm_air_plane_mode_ind_cb cb_func);
201
202
203/*-----------------------------------------------------------------------------------------------*/
204/**
205 @brief get cpu occupancy.
206 @param[out] cpu_occupancy The percentage of cpu occupancy
207 @return Whether to successfully get the cpu occupancy
208 @retval QL_ERR_OK successful
209 @retval QL_ERR_NOT_INIT uninitialized
210 @retval QL_ERR_SERVICE_NOT_READY service is not ready
211 @retval QL_ERR_INVALID_ARG Invalid arguments
212 @retval Other error code defined by ql_type.h
213 */
214/*-----------------------------------------------------------------------------------------------*/
215int ql_ms_dm_get_cpu_occupancy(float *cpu_occupancy);
216
217
218/*-----------------------------------------------------------------------------------------------*/
219/**
220 @brief get mem usage.
221 @param[out] mem_use The percentage of mem usage
222 @return Whether to successfully get the memory usage
223 @retval QL_ERR_OK successful
224 @retval QL_ERR_NOT_INIT uninitialized
225 @retval QL_ERR_SERVICE_NOT_READY service is not ready
226 @retval QL_ERR_INVALID_ARG Invalid arguments
227 @retval Other error code defined by ql_type.h
228 */
229/*-----------------------------------------------------------------------------------------------*/
230int ql_ms_dm_get_mem_usage(float *mem_use);
231
232
233/*-----------------------------------------------------------------------------------------------*/
234/**
235 @brief get NV item value.
236 @param[in] sim id number
237 @param[in] nv_item_name The NV item name that is either NV item id or NV item path
238 @param[out] nv_item_value The nv value buf of nv_item_name
239 param[in] nv_item_value_len The length of nv_item_value
240 param[out] nv_len The real length of nv_item_name
241 @return Whether to successfully get the NV value
242 @retval QL_ERR_OK successful
243 @retval QL_ERR_NOT_INIT uninitialized
244 @retval QL_ERR_SERVICE_NOT_READY service is not ready
245 @retval QL_ERR_INVALID_ARG Invalid arguments
246 @retval Other error code defined by ql_type.h
247 */
248/*-----------------------------------------------------------------------------------------------*/
249int ql_ms_dm_get_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len, int *nv_len);
250
251/*-----------------------------------------------------------------------------------------------*/
252/**
253 @brief set NV item value.
254 @param[in] sim id number
255 @param[in] nv_item_name The NV item name that is either NV item id or NV item path
256 @param[in] nv_item_value The NV value of nv_item_name
257 @param[in] nv_item_value_len The length of nv_item_value
258 param[out] nv_len The real length of nv_item_name
259 @return Whether to successfully set the NV value
260 @retval QL_ERR_OK successful
261 @retval QL_ERR_NOT_INIT uninitialized
262 @retval QL_ERR_SERVICE_NOT_READY service is not ready
263 @retval QL_ERR_INVALID_ARG Invalid arguments
264 @retval Other error code defined by ql_type.h
265 */
266/*-----------------------------------------------------------------------------------------------*/
267int ql_ms_dm_set_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len, int *nv_len);
268
269/*-----------------------------------------------------------------------------------------------*/
270/**
271 @brief set radio on, its function is the same as at+cfun=1.
272 @param[in] sim id number
273 @return Whether to successfully set the radio on
274 @retval QL_ERR_OK successful
275 @retval QL_ERR_NOT_INIT uninitialized
276 @retval QL_ERR_SERVICE_NOT_READY service is not ready
277 @retval QL_ERR_INVALID_ARG Invalid arguments
278 @retval Other error code defined by ql_type.h
279 */
280/*-----------------------------------------------------------------------------------------------*/
281int ql_ms_dm_set_radio_on(int sim_id);
282
283
284/*-----------------------------------------------------------------------------------------------*/
285/**
286 @brief set radio off, its function is the same as at+cfun=0.
287 @param[in] sim id number
288 @return Whether to successfully set the radio off
289 @retval QL_ERR_OK successful
290 @retval QL_ERR_NOT_INIT uninitialized
291 @retval QL_ERR_SERVICE_NOT_READY service is not ready
292 @retval QL_ERR_INVALID_ARG Invalid arguments
293 @retval Other error code defined by ql_type.h
294 */
295/*-----------------------------------------------------------------------------------------------*/
296int ql_ms_dm_set_radio_off(int sim_id);
297
298/*-----------------------------------------------------------------------------------------------*/
299/**
300 @brief get modem CPU utilization.
301 @param[out] mem_use The percentage of modem utilization
302 @return Whether to successfully get the modem utilization
303 @retval QL_ERR_OK successful
304 @retval QL_ERR_NOT_INIT uninitialized
305 @retval QL_ERR_SERVICE_NOT_READY service is not ready
306 @retval QL_ERR_INVALID_ARG Invalid arguments
307 @retval Other error code defined by ql_type.h
308 */
309/*-----------------------------------------------------------------------------------------------*/
310int ql_ms_dm_get_modem_cpu_occupancy(float *cpu_occupancy);
311
312/*-----------------------------------------------------------------------------------------------*/
313/**
314 @brief get modem mem utilization.
315 @param[out] mem_use The percentage of modem utilization
316 @return Whether to successfully get the modem utilization
317 @retval QL_ERR_OK successful
318 @retval QL_ERR_NOT_INIT uninitialized
319 @retval QL_ERR_SERVICE_NOT_READY service is not ready
320 @retval QL_ERR_INVALID_ARG Invalid arguments
321 @retval Other error code defined by ql_type.h
322 */
323/*-----------------------------------------------------------------------------------------------*/
324int ql_ms_dm_get_modem_mem_usage(float *mem_use);
325
326/*-----------------------------------------------------------------------------------------------*/
327/**
328 @brief get QOOS enable state
329 @param[in] sim id number
330 @param[out] enable The enable state of QOOS
331 @return Whether to successfully get the QOOS enable state
332 @retval QL_ERR_OK successful
333 @retval QL_ERR_NOT_INIT uninitialized
334 @retval QL_ERR_SERVICE_NOT_READY service is not ready
335 @retval QL_ERR_INVALID_ARG Invalid arguments
336 @retval Other error code defined by ql_type.h
337 */
338/*-----------------------------------------------------------------------------------------------*/
339int ql_ms_dm_get_qoos_enable(int sim_id, QL_DM_QOOS_ENABLE_TYPE_E *enable);
340
341/*-----------------------------------------------------------------------------------------------*/
342/**
343 @brief set QOOS enable state
344 @param[in] sim id number
345 @param[in] enable The enable state of QOOS
346 @return Whether to successfully set the QOOS enable state
347 @retval QL_ERR_OK successful
348 @retval QL_ERR_NOT_INIT uninitialized
349 @retval QL_ERR_SERVICE_NOT_READY service is not ready
350 @retval QL_ERR_INVALID_ARG Invalid arguments
351 @retval Other error code defined by ql_type.h
352 */
353/*-----------------------------------------------------------------------------------------------*/
354int ql_ms_dm_set_qoos_enable(int sim_id, QL_DM_QOOS_ENABLE_TYPE_E enable);
355
356/*-----------------------------------------------------------------------------------------------*/
357/**
358 @brief get QOOS configuration
359 @param[in] sim id number
360 @param[out] config The configuration of QOOS
361 @return Whether to successfully get the QOOS configuration
362 @retval QL_ERR_OK successful
363 @retval QL_ERR_NOT_INIT uninitialized
364 @retval QL_ERR_SERVICE_NOT_READY service is not ready
365 @retval QL_ERR_INVALID_ARG Invalid arguments
366 @retval Other error code defined by ql_type.h
367 */
368/*-----------------------------------------------------------------------------------------------*/
369int ql_ms_dm_get_qoos_config(int sim_id, ql_dm_qoos_config_t *config);
370
371/*-----------------------------------------------------------------------------------------------*/
372/**
373 @brief set QOOS configuration
374 @param[in] sim id number
375 @param[in] config The configuration of QOOS
376 @return Whether to successfully set the QOOS configuration
377 @retval QL_ERR_OK successful
378 @retval QL_ERR_NOT_INIT uninitialized
379 @retval QL_ERR_SERVICE_NOT_READY service is not ready
380 @retval QL_ERR_INVALID_ARG Invalid arguments
381 @retval Other error code defined by ql_type.h
382 */
383/*-----------------------------------------------------------------------------------------------*/
384int ql_ms_dm_set_qoos_config(int sim_id, char enable ,int p1, int p2, int p3);
385
386
387/*-----------------------------------------------------------------------------------------------*/
388/**
389 @brief get MSSR(Modem SubSysem Reset) level.
390 @param[out] p_level The MSSR level
391 @return Whether to successfully get the MSSR level
392 @retval QL_ERR_OK successful
393 @retval QL_ERR_NOT_INIT uninitialized
394 @retval QL_ERR_SERVICE_NOT_READY service is not ready
395 @retval QL_ERR_INVALID_ARG Invalid arguments
396 @retval Other error code defined by ql_type.h
397 */
398/*-----------------------------------------------------------------------------------------------*/
399int ql_ms_dm_get_mssr_level(int *p_level);
400
401
402/*-----------------------------------------------------------------------------------------------*/
403/**
404 @brief set MSSR(Modem SubSysem Reset) level.
405 @param[in] level The MSSR level
406 @return Whether to successfully set the MSSR level
407 @retval QL_ERR_OK successful
408 @retval QL_ERR_NOT_INIT uninitialized
409 @retval QL_ERR_SERVICE_NOT_READY service is not ready
410 @retval QL_ERR_INVALID_ARG Invalid arguments
411 @retval Other error code defined by ql_type.h
412 */
413/*-----------------------------------------------------------------------------------------------*/
414int ql_ms_dm_set_mssr_level(int level);
415
416
417/*-----------------------------------------------------------------------------------------------*/
418/**
419 @brief Registration server error callback. Currently, only if the server exits abnormally,
420 the callback function will be executed, and the error code is QL_ERR_ABORTED;
421 @param[in] cb Callback function
422 @return
423 QL_ERR_OK - successful
424 Other - error code defined by ql_type.h
425 */
426/*-----------------------------------------------------------------------------------------------*/
427int ql_ms_dm_set_service_error_cb(ql_dm_service_error_cb_f cb);
428
429
430#ifdef __cplusplus
431}
432#endif
433
434
435#endif
436