blob: 0eba65693fc5ac89a3c167332a180c8d1713b9ed [file] [log] [blame]
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
#ifndef _GMSS_PUBLIC_H
#define _GMSS_PUBLIC_H
#include "kal_general_types.h"
#if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__)))
#include "mcd_l3_inc_struct.h"
#include "sim_exported_enum.h"
#include "l3_inc_enums_public.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
// bits: 0|N|Lf|Lt|W|C|T|G
#define GMSS_WM_ID_MASK_NR 0x40
#define GMSS_WM_ID_MASK_LTE_FDD 0x20
#define GMSS_WM_ID_MASK_LTE_TDD 0x10
#define GMSS_WM_ID_MASK_LTE (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_LTE_TDD)
#define GMSS_WM_ID_MASK_WCDMA 0x08
#define GMSS_WM_ID_MASK_C2K 0x04
#define GMSS_WM_ID_MASK_TDSCDMA 0x02
#define GMSS_WM_ID_MASK_GSM 0x01
#define GMSS_WM_LTTG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM)
#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)
#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)
#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)
#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)
#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)
#define GMSS_WM_LFWG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_GSM)
#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)
#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)
#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)
#define GMSS_WM_LTWG (GMSS_WM_ID_MASK_LTE_TDD | GMSS_WM_ID_MASK_WCDMA | GMSS_WM_ID_MASK_GSM)
#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)
#define GMSS_WM_LFTG (GMSS_WM_ID_MASK_LTE_FDD | GMSS_WM_ID_MASK_TDSCDMA | GMSS_WM_ID_MASK_GSM)
#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)
#define GMSS_WM_NLTTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTTG)
#define GMSS_WM_NLWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWG)
#define GMSS_WM_NLTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTG)
#define GMSS_WM_NLWTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWTG)
#define GMSS_WM_NLWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWCG)
#define GMSS_WM_NLWCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LWCTG)
#define GMSS_WM_NLFWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFWG)
#define GMSS_WM_NLFWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFWCG)
#define GMSS_WM_NLCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LCTG)
#define GMSS_WM_NLTCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTCTG)
#define GMSS_WM_NLTWG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTWG)
#define GMSS_WM_NLTWCG (GMSS_WM_ID_MASK_NR | GMSS_WM_LTWCG)
#define GMSS_WM_NLFTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFTG)
#define GMSS_WM_NLFCTG (GMSS_WM_ID_MASK_NR | GMSS_WM_LFCTG)
#define GMSS_MAX_MCC_ENTRY_NUM 10
/*************************************************************************
* Area Configuration
* -
* -
*************************************************************************/
#define MAX_SIDE_NUM 10
#define MAX_ZONE_NUM 5
#ifdef UNIT_TEST
#define GMSS_GEO_MAX_SUB_NUM 10
#else
#define GMSS_GEO_MAX_SUB_NUM 256
#endif /* UNIT_TEST */
typedef void *gmss_geo_sub_id;
/****************************************************************************
Enum Declarations
****************************************************************************/
typedef enum
{
UMTS_WCDMA_DUPLEX_MODE,
UMTS_TDSCDMA_DUPLEX_MODE
} umts_duplex_mode_type;
typedef enum
{
LTE_FDD_DUPLEX_MODE,
LTE_TDD_DUPLEX_MODE,
LTE_FDD_TDD_DUPLEX_MODE
} lte_duplex_mode_type;
typedef enum
{
NR_FDD_DUPLEX_MODE,
NR_TDD_DUPLEX_MODE,
NR_FDD_TDD_DUPLEX_MODE
} nr_duplex_mode_type;
typedef enum
{
GMSS_C2K_FLAG_FALSE,
GMSS_C2K_FLAG_TRUE,
GMSS_C2K_FLAG_UNKNOWN
} gmss_c2k_flag_enum;
typedef enum
{
GEO_SERVICE_NONE,
GEO_SERVICE_GPS_DATA_STATUS,
GEO_SERVICE_GEO_AREA_STATUS,
GEO_SERVICE_DISTANCE_STATUS
} geo_service_enum;
typedef enum
{
GEO_EVENT_NONE,
GEO_EVENT_NO_VALID_GPS_DATA,
GEO_EVENT_VALID_GPS_DATA,
GEO_EVENT_ENTER_GEO_AREA,
GEO_EVENT_LEAVE_GEO_AREA,
GEO_EVENT_FAR_DISTANCE,
GEO_EVENT_END
} geo_event_enum;
typedef enum
{
AREA_STATUS_UNKNOWN,
AREA_STATUS_IN,
AREA_STATUS_OUT
} geo_area_status_enum;
typedef enum
{
DATA_STATUS_INVALID,
DATA_STATUS_VALID
} gps_data_status_enum;
typedef enum
{
NR_AVAIL_UNKNOWN,
NR_AVAIL_UNAVAIL,
NR_AVAIL_AVAIL,
NR_AVAIL_MAX
} nr_avail_enum;
/****************************************************************************
Struct Declarations
****************************************************************************/
typedef struct
{
kal_bool is_3g_fdd;
kal_bool is_3g_tdd;
kal_bool is_4g_fdd;
kal_bool is_4g_tdd;
} gmss_duplex_mode_type_struct;
#if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__)))
typedef struct
{
plmn_id_struct plmn;
kal_bool is_available_timer_running;
kal_uint32 remain_tick;
} gmss_mcc_item_struct;
#endif
typedef struct {
double lon;
double lat;
} geo_point_struct;
typedef struct {
geo_point_struct s; //start point
geo_point_struct e; //end point
} geo_line_struct;
typedef struct {
kal_uint8 point_num;
geo_point_struct point[MAX_SIDE_NUM];
} geo_zone_struct;
typedef struct
{
kal_uint8 zone_num;
geo_zone_struct zone[MAX_ZONE_NUM];
} geo_area_struct;
typedef struct
{
geo_service_enum service_type;
geo_area_struct area;
kal_uint32 distance;
kal_uint8 sim_interface;
geo_event_enum event;
gmss_geo_sub_id sub_id;
} gmss_geo_data_event_container_struct;
#if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__)))
typedef struct
{
rat_enum rat;
plmn_id_struct plmn_id;
kal_uint64 cell_id;
} gmss_cell_global_id_struct;
typedef struct
{
nr_avail_enum level1;
nr_avail_enum level2;
} gmss_nr_avail_struct;
typedef struct
{
LOCAL_PARA_HDR
gmss_nr_avail_struct nr_avail;
} gmss_nr_avail_update_req_struct;
typedef struct
{
LOCAL_PARA_HDR
nr_avail_enum level2;
kal_uint8 plmn_id_list_num;
plmn_id_struct plmn_id[MAX_NUM_MULTI_PLMN];
kal_uint8 cell_id[MAX_NUM_MULTI_PLMN][5];
} gmss_nrrc_nr_avail_update_ind_struct;
#endif
/***************************
Function Pointer Delarations
****************************/
typedef void (*gmss_geo_callback_func)(gmss_geo_data_event_container_struct);
/***************************
Exported Function Prototypes
****************************/
kal_bool gmss_is_wcdma_mode_activated(kal_uint8 sim_index);
kal_bool gmss_is_tdscdma_mode_activated(kal_uint8 sim_index);
kal_bool gmss_is_ltefdd_mode_activated(void);
kal_bool gmss_is_ltetdd_mode_activated(void);
extern void gmss_set_duplex_mode(umts_duplex_mode_type mode_3g, lte_duplex_mode_type mode_4g, kal_uint8 sim_index);
kal_bool gmss_is_cdma2000_supported();
kal_bool gmss_is_cdma2000_supported_public();
kal_bool gmss_is_mode_switch_for_cmcc_mt_csfb_required(kal_uint8 sim_idx);
kal_bool gmss_is_3gpp_mpsr_ongoing(kal_uint8 sim_idx);
extern kal_bool gmss_is_ct_operation(kal_uint8 sim_index);
#if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__)))
/**
* @brief Get the MCC list stored in MCC pool maintained by GMSS
* @param[in] ps_id is the protocol ID of target protocol
* @param[out] mcc_num is the number of MCCs
* @param[out] mcc_list is the list of MCCs (sorted by available timer: Not running > long remain tick > short remain tick)
*/
void gmss_get_mcc_list(protocol_id_enum ps_id, kal_uint32 *mcc_num, gmss_mcc_item_struct mcc_list[]);
#endif
/**
* @brief Check if current location data is in current geographic area of assigned geo area
* @param[in] assigned geo_area
* @param[out] IN: in geo area; OUT: not in geo area, UNKOWN: unknown(e.g. gps invalid).
*/
extern geo_area_status_enum gmss_is_in_geo_area(geo_area_struct *geo_area);
/**
* @brief Subscribe geographic service notifications
* @param[in] subscription name
* @param[in] callback function
* @param[in] subscription information
* @param[out] GMSS will provide unique Subscription ID. It is used to un-subscription.
*/
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);
/**
* @brief Modify geographic service notifications
* @param[in] Subscription ID
* @param[in] callback function
* @param[in] subscription information
* @param[out] TRUE: modification success. FALSE: modification fail.
*/
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);
/**
* @brief Unsubscribe geographic service notifications
* @param[in] Subscription ID
* @param[out] Should be NULL(Invalid Subscription ID)
*/
extern void gmss_geo_service_unsub(gmss_geo_sub_id *sub_id);
/**
* @brief Get the latest GPS location in record.
* @param[out] GPS location
* @param[out] TRUE: The latest location exists. FALSE: No location exists.
*/
extern kal_bool gmss_geo_get_latest_loc(geo_point_struct *loc);
/**
* @brief Get the distance between two GPS locations
* @param[in] GPS location A
* @param[in] GPS location B
* @param[out] The geographic distance between A and B in kilometers.
*/
extern double gmss_geo_get_distance_in_kilometers(const geo_point_struct *loc_a, const geo_point_struct *loc_b);
#ifdef __cplusplus
}
#endif
#if (!defined(__MAUI_BASIC__)) && (!(defined(__NR_L1SIM__) || defined(__LTE_L1SIM__)))
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);
#endif
#endif /* _GMSS_PUBLIC_H_ */