b.liu | d440f9f | 2025-04-18 10:44:31 +0800 | [diff] [blame] | 1 | /*-----------------------------------------------------------------------------------------------*/ |
| 2 | /** |
| 3 | @file ql_cell_locator.h |
| 4 | @brief cell_locator service 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 | 20220810 sunshine Created . |
| 21 | -------------------------------------------------------------------------------------------------*/ |
| 22 | |
| 23 | #ifndef __QL_CELL_LOCATOR_H__ |
| 24 | #define __QL_CELL_LOCATOR_H__ |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | typedef struct |
| 33 | { |
| 34 | char *ptr; |
| 35 | size_t len; |
| 36 | } curl_rsp_msg_t; |
| 37 | |
| 38 | |
| 39 | |
| 40 | typedef struct |
| 41 | { |
| 42 | double latitude; |
| 43 | double longitude; |
| 44 | double altitude; |
| 45 | } ql_inject_location_t; |
| 46 | |
| 47 | typedef struct |
| 48 | { |
| 49 | /*longtitude*/ |
| 50 | double lon; |
| 51 | /*latitude*/ |
| 52 | double lat; |
| 53 | /*accuracy*/ |
| 54 | unsigned short accuracy; |
| 55 | |
| 56 | char err_msg[256]; |
| 57 | } ql_perform_rsp; |
| 58 | |
| 59 | typedef void (*ql_cell_locator_ind_cb_f)(void *msg); |
| 60 | |
| 61 | typedef void (*ql_cell_locator_error_cb_f)(int error); |
| 62 | |
| 63 | |
| 64 | /*-----------------------------------------------------------------------------------------------*/ |
| 65 | /** |
| 66 | @brief Initialize the cell_locator client |
| 67 | @return |
| 68 | QL_ERR_OK - successful |
| 69 | QL_ERR_INVALID_ARG - as defined |
| 70 | QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry |
| 71 | Other - error code defined by ql_type.h |
| 72 | */ |
| 73 | /*-----------------------------------------------------------------------------------------------*/ |
| 74 | int ql_cell_locator_init(void); |
| 75 | |
| 76 | |
| 77 | |
| 78 | /*-----------------------------------------------------------------------------------------------*/ |
| 79 | /** |
| 80 | @brief set locator query server and port, server length must be less than 255 bytes. |
| 81 | @return |
| 82 | QL_ERR_OK - successful |
| 83 | QL_ERR_INVALID_ARG - as defined |
| 84 | QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry |
| 85 | Other - error code defined by ql_type.h |
| 86 | */ |
| 87 | /*-----------------------------------------------------------------------------------------------*/ |
| 88 | int ql_cell_locator_set_server(char *server, uint16_t port); |
| 89 | |
| 90 | |
| 91 | |
| 92 | /*-----------------------------------------------------------------------------------------------*/ |
| 93 | /** |
| 94 | @brief set locator query timeout, the value must between 1-300 [seconds] |
| 95 | @return |
| 96 | QL_ERR_OK - successful |
| 97 | QL_ERR_INVALID_ARG - as defined |
| 98 | QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry |
| 99 | Other - error code defined by ql_type.h |
| 100 | */ |
| 101 | /*-----------------------------------------------------------------------------------------------*/ |
| 102 | int ql_cell_locator_set_timeout(uint16_t timeout); |
| 103 | |
| 104 | |
| 105 | |
| 106 | /*-----------------------------------------------------------------------------------------------*/ |
| 107 | /** |
| 108 | @brief set locator query token, token length must be 16 bytes. the token Used to verify that |
| 109 | the client accessing the service is valid. |
| 110 | @return |
| 111 | QL_ERR_OK - successful |
| 112 | QL_ERR_INVALID_ARG - as defined |
| 113 | QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry |
| 114 | Other - error code defined by ql_type.h |
| 115 | */ |
| 116 | /*-----------------------------------------------------------------------------------------------*/ |
| 117 | int ql_cell_locator_set_token(char *token); |
| 118 | |
| 119 | |
| 120 | /*-----------------------------------------------------------------------------------------------*/ |
| 121 | /** |
| 122 | @brief Register cell_locator callback |
| 123 | @param[in] cb |
| 124 | @return |
| 125 | QL_ERR_OK - successful |
| 126 | QL_ERR_NOT_INIT - uninitialized |
| 127 | QL_ERR_SERVICE_NOT_READY - service is not ready |
| 128 | QL_ERR_INVALID_ARG - Invalid arguments |
| 129 | Other - error code defined by ql_type.h |
| 130 | */ |
| 131 | /*-----------------------------------------------------------------------------------------------*/ |
| 132 | int ql_cell_locator_set_ind_cb(ql_cell_locator_ind_cb_f cb); |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | /*-----------------------------------------------------------------------------------------------*/ |
| 138 | /** |
| 139 | @brief Registration server error callback. Currently, only if the server exits abnormally, |
| 140 | the callback function will be executed, and the error code is QL_ERR_ABORTED; |
| 141 | @param[in] cb Callback function |
| 142 | @return |
| 143 | QL_ERR_OK - successful |
| 144 | Other - error code defined by ql_type.h |
| 145 | */ |
| 146 | /*-----------------------------------------------------------------------------------------------*/ |
| 147 | int ql_cell_locator_set_service_error_cb(ql_cell_locator_error_cb_f cb); |
| 148 | |
| 149 | |
| 150 | |
| 151 | /*-----------------------------------------------------------------------------------------------*/ |
| 152 | /** |
| 153 | @brief Deinitialize the cell_locator client |
| 154 | @return |
| 155 | QL_ERR_OK - successful |
| 156 | Other - error code defined by ql_type.h |
| 157 | */ |
| 158 | /*-----------------------------------------------------------------------------------------------*/ |
| 159 | int ql_cell_locator_deinit(void); |
| 160 | |
| 161 | /*-----------------------------------------------------------------------------------------------*/ |
| 162 | /** |
| 163 | @brief cell_locator start |
| 164 | @return |
| 165 | QL_ERR_OK - successful |
| 166 | Other - error code defined by ql_type.h |
| 167 | */ |
| 168 | /*-----------------------------------------------------------------------------------------------*/ |
| 169 | int ql_cell_locator_start(void); |
| 170 | |
| 171 | /*-----------------------------------------------------------------------------------------------*/ |
| 172 | /** |
| 173 | @brief cell_locator stop |
| 174 | @return |
| 175 | QL_ERR_OK - successful |
| 176 | Other - error code defined by ql_type.h |
| 177 | */ |
| 178 | /*-----------------------------------------------------------------------------------------------*/ |
| 179 | int ql_cell_locator_stop(void); |
| 180 | |
| 181 | int ql_cell_locator_perform(ql_perform_rsp *rsp_ptr); |
| 182 | |
| 183 | #ifdef __cplusplus |
| 184 | } |
| 185 | #endif |
| 186 | |
| 187 | #endif |
| 188 | |