blob: 66f28dde9975187bb01fe7c49ed8a62540eadb1f [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/*-----------------------------------------------------------------------------------------------*/
2/**
3 @file ql_lanhost.h
4 @brief LANHOST API
5*/
6/*-----------------------------------------------------------------------------------------------*/
7
8/*-------------------------------------------------------------------------------------------------
9 Copyright (c) 2018 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 20191016 tyler.kuang Created .
21-------------------------------------------------------------------------------------------------*/
22
23#ifndef __QL_LANHOST_H__
24#define __QL_LANHOST_H__
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29#include "ql_net_common.h"
30
31
32typedef void (*ql_lanhost_ind_cb_f)(QL_LANHOST_EVENT_TYPE_E event_type, ql_lanhost_t *p_host);
33
34typedef void (*ql_lanhost_service_error_cb_f)(int error);
35
36/*-----------------------------------------------------------------------------------------------*/
37/**
38 @brief Initialize the lanhost service
39 @return
40 QL_ERR_OK - successful
41 QL_ERR_INVALID_ARG - as defined
42 QL_ERR_UNKNOWN - unknown error, failed to connect to service
43 QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
44 Other - error code defined by ql_type.h
45 */
46/*-----------------------------------------------------------------------------------------------*/
47int ql_lanhost_init(void);
48
49/*-----------------------------------------------------------------------------------------------*/
50/**
51 @brief Get all lanhost list, the maximum of lanhost is defined by QL_NET_MAX_LANHOST_NUM
52 @param[out] list Lanhost array
53 @param[in,out] list_len, in-> array size, out->current instance number
54 @return
55 QL_ERR_OK - successful
56 QL_ERR_INVALID_ARG - as defined
57 QL_ERR_UNKNOWN - unknown error, failed to connect to service
58 QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
59 Other - error code defined by ql_type.h
60 */
61/*-----------------------------------------------------------------------------------------------*/
62int ql_lanhost_get_list(ql_lanhost_t *list, int *list_len);
63
64/*-----------------------------------------------------------------------------------------------*/
65/**
66 @brief Register lanhost status change event
67 @param[in] cb
68 @return
69 QL_ERR_OK - successful
70 QL_ERR_NOT_INIT - uninitialized
71 QL_ERR_SERVICE_NOT_READY - service is not ready
72 QL_ERR_INVALID_ARG - Invalid arguments
73 Other - error code defined by ql_type.h
74 */
75/*-----------------------------------------------------------------------------------------------*/
76int ql_lanhost_set_ind_cb(ql_lanhost_ind_cb_f cb);
77
78/*-----------------------------------------------------------------------------------------------*/
79/**
80 @brief Registration server error callback. Currently, only if the server exits abnormally,
81 the callback function will be executed, and the error code is QL_ERR_ABORTED;
82 @param[in] cb Callback function
83 @return
84 QL_ERR_OK - successful
85 Other - error code defined by ql_type.h
86 */
87/*-----------------------------------------------------------------------------------------------*/
88int ql_lanhost_set_service_error_cb(ql_lanhost_service_error_cb_f cb);
89
90/*-----------------------------------------------------------------------------------------------*/
91/**
92 @brief Deinitialize the lanhost service
93 @return
94 QL_ERR_OK - successful
95 Other - error code defined by ql_type.h
96 */
97/*-----------------------------------------------------------------------------------------------*/
98int ql_lanhost_deinit(void);
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif
105