yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | #ifndef _GMSS_PUBLIC_H |
| 37 | #define _GMSS_PUBLIC_H |
| 38 | |
| 39 | #include "kal_general_types.h" |
| 40 | |
| 41 | #if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__))) |
| 42 | #include "mcd_l3_inc_struct.h" |
| 43 | #include "sim_exported_enum.h" |
| 44 | #include "l3_inc_enums_public.h" |
| 45 | #endif |
| 46 | |
| 47 | #ifdef __cplusplus |
| 48 | extern "C" { |
| 49 | #endif |
| 50 | |
| 51 | // bits: 0|N|Lf|Lt|W|C|T|G |
| 52 | #define GMSS_WM_ID_MASK_NR 0x40 |
| 53 | #define GMSS_WM_ID_MASK_LTE_FDD 0x20 |
| 54 | #define GMSS_WM_ID_MASK_LTE_TDD 0x10 |
| 55 | #define GMSS_WM_ID_MASK_LTE (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD) |
| 56 | #define GMSS_WM_ID_MASK_WCDMA 0x08 |
| 57 | #define GMSS_WM_ID_MASK_C2K 0x04 |
| 58 | #define GMSS_WM_ID_MASK_TDSCDMA 0x02 |
| 59 | #define GMSS_WM_ID_MASK_GSM 0x01 |
| 60 | |
| 61 | #define GMSS_WM_LTTG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 62 | #define GMSS_WM_LWG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_GSM) |
| 63 | #define GMSS_WM_LTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 64 | #define GMSS_WM_LWTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 65 | #define GMSS_WM_LWCG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_GSM) |
| 66 | #define GMSS_WM_LWCTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 67 | #define GMSS_WM_LFWG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_GSM) |
| 68 | #define GMSS_WM_LFWCG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_GSM) |
| 69 | #define GMSS_WM_LCTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 70 | #define GMSS_WM_LTCTG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 71 | #define GMSS_WM_LTWG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_GSM) |
| 72 | #define GMSS_WM_LTWCG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_GSM) |
| 73 | #define GMSS_WM_LFTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 74 | #define GMSS_WM_LFCTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_C2K | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM) |
| 75 | |
| 76 | #define GMSS_WM_NLTTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTTG) |
| 77 | #define GMSS_WM_NLWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWG) |
| 78 | #define GMSS_WM_NLTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTG) |
| 79 | #define GMSS_WM_NLWTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWTG) |
| 80 | #define GMSS_WM_NLWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWCG) |
| 81 | #define GMSS_WM_NLWCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWCTG) |
| 82 | #define GMSS_WM_NLFWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFWG) |
| 83 | #define GMSS_WM_NLFWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFWCG) |
| 84 | #define GMSS_WM_NLCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LCTG) |
| 85 | #define GMSS_WM_NLTCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTCTG) |
| 86 | #define GMSS_WM_NLTWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTWG) |
| 87 | #define GMSS_WM_NLTWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTWCG) |
| 88 | #define GMSS_WM_NLFTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFTG) |
| 89 | #define GMSS_WM_NLFCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFCTG) |
| 90 | |
| 91 | #define GMSS_MAX_MCC_ENTRY_NUM 10 |
| 92 | |
| 93 | /************************************************************************* |
| 94 | * Area Configuration |
| 95 | * - |
| 96 | * - |
| 97 | *************************************************************************/ |
| 98 | #define MAX_SIDE_NUM 10 |
| 99 | #define MAX_ZONE_NUM 5 |
| 100 | |
| 101 | #ifdef UNIT_TEST |
| 102 | #define GMSS_GEO_MAX_SUB_NUM 10 |
| 103 | #else |
| 104 | #define GMSS_GEO_MAX_SUB_NUM 256 |
| 105 | #endif /* UNIT_TEST */ |
| 106 | |
| 107 | typedef void *gmss_geo_sub_id; |
| 108 | |
| 109 | /**************************************************************************** |
| 110 | Enum Declarations |
| 111 | ****************************************************************************/ |
| 112 | typedef enum |
| 113 | { |
| 114 | UMTS_WCDMA_DUPLEX_MODE, |
| 115 | UMTS_TDSCDMA_DUPLEX_MODE |
| 116 | } umts_duplex_mode_type; |
| 117 | |
| 118 | typedef enum |
| 119 | { |
| 120 | LTE_FDD_DUPLEX_MODE, |
| 121 | LTE_TDD_DUPLEX_MODE, |
| 122 | LTE_FDD_TDD_DUPLEX_MODE |
| 123 | } lte_duplex_mode_type; |
| 124 | |
| 125 | typedef enum |
| 126 | { |
| 127 | NR_FDD_DUPLEX_MODE, |
| 128 | NR_TDD_DUPLEX_MODE, |
| 129 | NR_FDD_TDD_DUPLEX_MODE |
| 130 | } nr_duplex_mode_type; |
| 131 | |
| 132 | typedef enum |
| 133 | { |
| 134 | GMSS_C2K_FLAG_FALSE, |
| 135 | GMSS_C2K_FLAG_TRUE, |
| 136 | GMSS_C2K_FLAG_UNKNOWN |
| 137 | |
| 138 | } gmss_c2k_flag_enum; |
| 139 | |
| 140 | typedef enum |
| 141 | { |
| 142 | GEO_SERVICE_NONE, |
| 143 | GEO_SERVICE_GPS_DATA_STATUS, |
| 144 | GEO_SERVICE_GEO_AREA_STATUS, |
| 145 | GEO_SERVICE_DISTANCE_STATUS |
| 146 | } geo_service_enum; |
| 147 | |
| 148 | typedef enum |
| 149 | { |
| 150 | GEO_EVENT_NONE, |
| 151 | GEO_EVENT_NO_VALID_GPS_DATA, |
| 152 | GEO_EVENT_VALID_GPS_DATA, |
| 153 | GEO_EVENT_ENTER_GEO_AREA, |
| 154 | GEO_EVENT_LEAVE_GEO_AREA, |
| 155 | GEO_EVENT_FAR_DISTANCE, |
| 156 | GEO_EVENT_END |
| 157 | } geo_event_enum; |
| 158 | |
| 159 | typedef enum |
| 160 | { |
| 161 | AREA_STATUS_UNKNOWN, |
| 162 | AREA_STATUS_IN, |
| 163 | AREA_STATUS_OUT |
| 164 | } geo_area_status_enum; |
| 165 | |
| 166 | typedef enum |
| 167 | { |
| 168 | DATA_STATUS_INVALID, |
| 169 | DATA_STATUS_VALID |
| 170 | } gps_data_status_enum; |
| 171 | |
| 172 | typedef enum |
| 173 | { |
| 174 | NR_AVAIL_UNKNOWN, |
| 175 | NR_AVAIL_UNAVAIL, |
| 176 | NR_AVAIL_AVAIL, |
| 177 | NR_AVAIL_MAX |
| 178 | } nr_avail_enum; |
| 179 | |
| 180 | /**************************************************************************** |
| 181 | Struct Declarations |
| 182 | ****************************************************************************/ |
| 183 | typedef struct |
| 184 | { |
| 185 | kal_bool is_3g_fdd; |
| 186 | kal_bool is_3g_tdd; |
| 187 | kal_bool is_4g_fdd; |
| 188 | kal_bool is_4g_tdd; |
| 189 | } gmss_duplex_mode_type_struct; |
| 190 | |
| 191 | #if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__))) |
| 192 | typedef struct |
| 193 | { |
| 194 | plmn_id_struct plmn; |
| 195 | kal_bool is_available_timer_running; |
| 196 | kal_uint32 remain_tick; |
| 197 | } gmss_mcc_item_struct; |
| 198 | #endif |
| 199 | |
| 200 | typedef struct { |
| 201 | double lon; |
| 202 | double lat; |
| 203 | } geo_point_struct; |
| 204 | |
| 205 | typedef struct { |
| 206 | geo_point_struct s; //start point |
| 207 | geo_point_struct e; //end point |
| 208 | } geo_line_struct; |
| 209 | |
| 210 | typedef struct { |
| 211 | kal_uint8 point_num; |
| 212 | geo_point_struct point[MAX_SIDE_NUM]; |
| 213 | } geo_zone_struct; |
| 214 | |
| 215 | typedef struct |
| 216 | { |
| 217 | kal_uint8 zone_num; |
| 218 | geo_zone_struct zone[MAX_ZONE_NUM]; |
| 219 | } geo_area_struct; |
| 220 | |
| 221 | typedef struct |
| 222 | { |
| 223 | geo_service_enum service_type; |
| 224 | geo_area_struct area; |
| 225 | kal_uint32 distance; |
| 226 | kal_uint8 sim_interface; |
| 227 | geo_event_enum event; |
| 228 | gmss_geo_sub_id sub_id; |
| 229 | } gmss_geo_data_event_container_struct; |
| 230 | |
| 231 | #if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__))) |
| 232 | typedef struct |
| 233 | { |
| 234 | rat_enum rat; |
| 235 | plmn_id_struct plmn_id; |
| 236 | kal_uint64 cell_id; |
| 237 | } gmss_cell_global_id_struct; |
| 238 | |
| 239 | typedef struct |
| 240 | { |
| 241 | nr_avail_enum level1; |
| 242 | nr_avail_enum level2; |
| 243 | } gmss_nr_avail_struct; |
| 244 | |
| 245 | typedef struct |
| 246 | { |
| 247 | LOCAL_PARA_HDR |
| 248 | gmss_nr_avail_struct nr_avail; |
| 249 | } gmss_nr_avail_update_req_struct; |
| 250 | |
| 251 | typedef struct |
| 252 | { |
| 253 | LOCAL_PARA_HDR |
| 254 | nr_avail_enum level2; |
| 255 | kal_uint8 plmn_id_list_num; |
| 256 | plmn_id_struct plmn_id[MAX_NUM_MULTI_PLMN]; |
| 257 | kal_uint8 cell_id[MAX_NUM_MULTI_PLMN][5]; |
| 258 | } gmss_nrrc_nr_avail_update_ind_struct; |
| 259 | #endif |
| 260 | |
| 261 | /*************************** |
| 262 | Function Pointer Delarations |
| 263 | ****************************/ |
| 264 | typedef void (*gmss_geo_callback_func)(gmss_geo_data_event_container_struct); |
| 265 | |
| 266 | /*************************** |
| 267 | Exported Function Prototypes |
| 268 | ****************************/ |
| 269 | kal_bool gmss_is_wcdma_mode_activated(kal_uint8 sim_index); |
| 270 | kal_bool gmss_is_tdscdma_mode_activated(kal_uint8 sim_index); |
| 271 | kal_bool gmss_is_ltefdd_mode_activated(void); |
| 272 | kal_bool gmss_is_ltetdd_mode_activated(void); |
| 273 | |
| 274 | extern void gmss_set_duplex_mode(umts_duplex_mode_type mode_3g, lte_duplex_mode_type mode_4g, kal_uint8 sim_index); |
| 275 | |
| 276 | kal_bool gmss_is_cdma2000_supported(); |
| 277 | |
| 278 | kal_bool gmss_is_cdma2000_supported_public(); |
| 279 | |
| 280 | kal_bool gmss_is_mode_switch_for_cmcc_mt_csfb_required(kal_uint8 sim_idx); |
| 281 | |
| 282 | kal_bool gmss_is_3gpp_mpsr_ongoing(kal_uint8 sim_idx); |
| 283 | |
| 284 | extern kal_bool gmss_is_ct_operation(kal_uint8 sim_index); |
| 285 | |
| 286 | #if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__))) |
| 287 | /** |
| 288 | * @brief Get the MCC list stored in MCC pool maintained by GMSS |
| 289 | * @param[in] ps_id is the protocol ID of target protocol |
| 290 | * @param[out] mcc_num is the number of MCCs |
| 291 | * @param[out] mcc_list is the list of MCCs (sorted by available timer: Not running > long remain tick > short remain tick) |
| 292 | */ |
| 293 | void gmss_get_mcc_list(protocol_id_enum ps_id, kal_uint32 *mcc_num, gmss_mcc_item_struct mcc_list[]); |
| 294 | #endif |
| 295 | |
| 296 | /** |
| 297 | * @brief Check if current location data is in current geographic area of assigned geo area |
| 298 | * @param[in] assigned geo_area |
| 299 | * @param[out] IN: in geo area; OUT: not in geo area, UNKOWN: unknown(e.g. gps invalid). |
| 300 | */ |
| 301 | extern geo_area_status_enum gmss_is_in_geo_area(geo_area_struct *geo_area); |
| 302 | |
| 303 | /** |
| 304 | * @brief Subscribe geographic service notifications |
| 305 | * @param[in] subscription name |
| 306 | * @param[in] callback function |
| 307 | * @param[in] subscription information |
| 308 | * @param[out] GMSS will provide unique Subscription ID. It is used to un-subscription. |
| 309 | */ |
| 310 | extern void gmss_geo_service_sub(kal_char *sub_name, gmss_geo_callback_func callback_func, const gmss_geo_data_event_container_struct sub_info, gmss_geo_sub_id *sub_id); |
| 311 | |
| 312 | /** |
| 313 | * @brief Modify geographic service notifications |
| 314 | * @param[in] Subscription ID |
| 315 | * @param[in] callback function |
| 316 | * @param[in] subscription information |
| 317 | * @param[out] TRUE: modification success. FALSE: modification fail. |
| 318 | */ |
| 319 | extern kal_bool gmss_geo_service_modify(gmss_geo_sub_id *sub_id, gmss_geo_callback_func callback_func, const gmss_geo_data_event_container_struct sub_info); |
| 320 | |
| 321 | /** |
| 322 | * @brief Unsubscribe geographic service notifications |
| 323 | * @param[in] Subscription ID |
| 324 | * @param[out] Should be NULL(Invalid Subscription ID) |
| 325 | */ |
| 326 | extern void gmss_geo_service_unsub(gmss_geo_sub_id *sub_id); |
| 327 | |
| 328 | /** |
| 329 | * @brief Get the latest GPS location in record. |
| 330 | * @param[out] GPS location |
| 331 | * @param[out] TRUE: The latest location exists. FALSE: No location exists. |
| 332 | */ |
| 333 | extern kal_bool gmss_geo_get_latest_loc(geo_point_struct *loc); |
| 334 | |
| 335 | /** |
| 336 | * @brief Get the distance between two GPS locations |
| 337 | * @param[in] GPS location A |
| 338 | * @param[in] GPS location B |
| 339 | * @param[out] The geographic distance between A and B in kilometers. |
| 340 | */ |
| 341 | extern double gmss_geo_get_distance_in_kilometers(const geo_point_struct *loc_a, const geo_point_struct *loc_b); |
| 342 | |
| 343 | #ifdef __cplusplus |
| 344 | } |
| 345 | #endif |
| 346 | |
| 347 | #if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__))) |
| 348 | extern void gmss_nr_map_nr_avail_query(const gmss_cell_global_id_struct *cell_global_id, kal_uint8 sim_interface, gmss_nr_avail_struct *nr_avail); |
| 349 | #endif |
| 350 | |
| 351 | #endif /* _GMSS_PUBLIC_H_ */ |
| 352 | |