rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* Copyright Statement: |
| 2 | * |
| 3 | * This software/firmware and related documentation ("MediaTek Software") are |
| 4 | * protected under relevant copyright laws. The information contained herein |
| 5 | * is confidential and proprietary to MediaTek Inc. and/or its licensors. |
| 6 | * Without the prior written permission of MediaTek inc. and/or its licensors, |
| 7 | * any reproduction, modification, use or disclosure of MediaTek Software, |
| 8 | * and information contained herein, in whole or in part, shall be strictly prohibited. |
| 9 | * |
| 10 | * MediaTek Inc. (C) 2016. All rights reserved. |
| 11 | * |
| 12 | * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 13 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 14 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON |
| 15 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 18 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 19 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 20 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH |
| 21 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES |
| 22 | * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES |
| 23 | * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK |
| 24 | * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR |
| 25 | * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND |
| 26 | * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 27 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 28 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO |
| 29 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 30 | * |
| 31 | * The following software/firmware and/or related documentation ("MediaTek Software") |
| 32 | * have been modified by MediaTek Inc. All revisions are subject to any receiver's |
| 33 | * applicable license agreements with MediaTek Inc. |
| 34 | */ |
| 35 | |
| 36 | #ifndef SRC_UTIL_PHONE_UTILS_H_ |
| 37 | #define SRC_UTIL_PHONE_UTILS_H_ |
| 38 | |
| 39 | #include <string> |
| 40 | #include <vendor-ril/telephony/ril.h> |
| 41 | |
| 42 | class Phone_utils { |
| 43 | public: |
| 44 | Phone_utils(); |
| 45 | virtual ~Phone_utils(); |
| 46 | static int get_phone_count(); |
| 47 | static bool isGsm(int radioTechnology); |
| 48 | static bool isCdma(int radioTechnology); |
| 49 | static bool isLte(int radioTechnology); |
| 50 | static int get_enable_sim_for_dsss(); |
| 51 | static int get_phone_type(int slot); |
| 52 | public: |
| 53 | static const int APP_FAM_3GPP; |
| 54 | static const int APP_FAM_3GPP2; |
| 55 | static const int APP_FAM_IMS; |
| 56 | /* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ |
| 57 | static constexpr int NETWORK_MODE_WCDMA_PREF = RIL_PreferredNetworkType::PREF_NET_TYPE_GSM_WCDMA; /* GSM/WCDMA (WCDMA preferred) */ |
| 58 | static constexpr int NETWORK_MODE_GSM_ONLY = RIL_PreferredNetworkType::PREF_NET_TYPE_GSM_ONLY; /* GSM only */ |
| 59 | static constexpr int NETWORK_MODE_WCDMA_ONLY = RIL_PreferredNetworkType::PREF_NET_TYPE_WCDMA; /* WCDMA only */ |
| 60 | static constexpr int NETWORK_MODE_GSM_UMTS = RIL_PreferredNetworkType::PREF_NET_TYPE_GSM_WCDMA_AUTO; /* GSM/WCDMA (auto mode, according to PRL) |
| 61 | AVAILABLE Application Settings menu*/ |
| 62 | static constexpr int NETWORK_MODE_CDMA = RIL_PreferredNetworkType::PREF_NET_TYPE_CDMA_EVDO_AUTO; /* CDMA and EvDo (auto mode, according to PRL) |
| 63 | AVAILABLE Application Settings menu*/ |
| 64 | static constexpr int NETWORK_MODE_CDMA_NO_EVDO = RIL_PreferredNetworkType::PREF_NET_TYPE_CDMA_ONLY; /* CDMA only */ |
| 65 | static constexpr int NETWORK_MODE_EVDO_NO_CDMA = RIL_PreferredNetworkType::PREF_NET_TYPE_EVDO_ONLY; /* EvDo only */ |
| 66 | static constexpr int NETWORK_MODE_GLOBAL = RIL_PreferredNetworkType::PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) |
| 67 | AVAILABLE Application Settings menu*/ |
| 68 | static constexpr int NETWORK_MODE_LTE_CDMA_EVDO = RIL_PreferredNetworkType::PREF_NET_TYPE_LTE_CDMA_EVDO; /* LTE, CDMA and EvDo */ |
| 69 | static constexpr int NETWORK_MODE_LTE_GSM_WCDMA = RIL_PreferredNetworkType::PREF_NET_TYPE_LTE_GSM_WCDMA; /* LTE, GSM/WCDMA */ |
| 70 | static constexpr int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = RIL_PreferredNetworkType::PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA; /* LTE, CDMA, EvDo, GSM/WCDMA */ |
| 71 | static constexpr int NETWORK_MODE_LTE_ONLY = RIL_PreferredNetworkType::PREF_NET_TYPE_LTE_ONLY; /* LTE Only mode. */ |
| 72 | static constexpr int NETWORK_MODE_LTE_WCDMA = RIL_PreferredNetworkType::PREF_NET_TYPE_LTE_WCDMA; /* LTE/WCDMA */ |
| 73 | static constexpr int NETWORK_MODE_TDSCDMA_ONLY = 13; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_ONLY; TD-SCDMA only */ |
| 74 | static constexpr int NETWORK_MODE_TDSCDMA_WCDMA = 14; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_WCDMA; TD-SCDMA and WCDMA */ |
| 75 | static constexpr int NETWORK_MODE_LTE_TDSCDMA = 15; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_LTE; TD-SCDMA and LTE */ |
| 76 | static constexpr int NETWORK_MODE_TDSCDMA_GSM = 16; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_GSM; TD-SCDMA and GSM */ |
| 77 | static constexpr int NETWORK_MODE_LTE_TDSCDMA_GSM = 17; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_GSM_LTE; TD-SCDMA,GSM and LTE */ |
| 78 | static constexpr int NETWORK_MODE_TDSCDMA_GSM_WCDMA = 18; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA; TD-SCDMA, GSM/WCDMA */ |
| 79 | static constexpr int NETWORK_MODE_LTE_TDSCDMA_WCDMA = 19; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_WCDMA_LTE; TD-SCDMA, WCDMA and LTE */ |
| 80 | static constexpr int NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA = 20; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_LTE; TD-SCDMA, GSM/WCDMA and LTE */ |
| 81 | static constexpr int NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 21; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO; TD-SCDMA,EvDo,CDMA,GSM/WCDMA*/ |
| 82 | static constexpr int NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 22; /*RIL_PreferredNetworkType::PREF_NET_TYPE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA; TD-SCDMA/LTE/GSM/WCDMA, CDMA, and EvDo */ |
| 83 | /// M: [Network][C2K]Add the MTK new network type. @{ |
| 84 | static constexpr int NETWORK_MODE_LTE_GSM = 30; /*LTE/GSM */ |
| 85 | static constexpr int NETWORK_MODE_LTE_TDD_ONLY = 31; /* LTE TDD Only mode. */ |
| 86 | static constexpr int NETWORK_MODE_CDMA_GSM = 32; /* CDMA,GSM(2G Global) */ |
| 87 | static constexpr int NETWORK_MODE_CDMA_EVDO_GSM = 33; /* CDMA,EVDO,GSM */ |
| 88 | static constexpr int NETWORK_MODE_LTE_CDMA_EVDO_GSM = 34; /* LTE,CDMA,EVDO,GSM(4G Global, 4M) */ |
| 89 | static const int PHONE_TYPE_NONE; |
| 90 | static const int PHONE_TYPE_GSM; |
| 91 | static const int PHONE_TYPE_CDMA; |
| 92 | static const int PHONE_TYPE_SIP; |
| 93 | static const int PHONE_TYPE_THIRD_PARTY; |
| 94 | static const int PHONE_TYPE_IMS; |
| 95 | /** |
| 96 | * Available radio technologies for GSM, UMTS and CDMA. |
| 97 | * Duplicates the constants from hardware/radio/include/ril.h |
| 98 | * This should only be used by agents working with the ril. Others |
| 99 | * should use the equivalent TelephonyManager.NETWORK_TYPE_* |
| 100 | */ |
| 101 | static constexpr int RIL_RADIO_TECHNOLOGY_UNKNOWN = RIL_RadioTechnology::RADIO_TECH_UNKNOWN; |
| 102 | static constexpr int RIL_RADIO_TECHNOLOGY_GPRS = RIL_RadioTechnology::RADIO_TECH_GPRS; |
| 103 | static constexpr int RIL_RADIO_TECHNOLOGY_EDGE = RIL_RadioTechnology::RADIO_TECH_EDGE; |
| 104 | static constexpr int RIL_RADIO_TECHNOLOGY_UMTS = RIL_RadioTechnology::RADIO_TECH_UMTS; |
| 105 | static constexpr int RIL_RADIO_TECHNOLOGY_IS95A = RIL_RadioTechnology::RADIO_TECH_IS95A; |
| 106 | static constexpr int RIL_RADIO_TECHNOLOGY_IS95B = RIL_RadioTechnology::RADIO_TECH_IS95B; |
| 107 | static constexpr int RIL_RADIO_TECHNOLOGY_1xRTT = RIL_RadioTechnology::RADIO_TECH_1xRTT; |
| 108 | static constexpr int RIL_RADIO_TECHNOLOGY_EVDO_0 = RIL_RadioTechnology::RADIO_TECH_EVDO_0; |
| 109 | static constexpr int RIL_RADIO_TECHNOLOGY_EVDO_A = RIL_RadioTechnology::RADIO_TECH_EVDO_A; |
| 110 | static constexpr int RIL_RADIO_TECHNOLOGY_HSDPA = RIL_RadioTechnology::RADIO_TECH_HSDPA; |
| 111 | static constexpr int RIL_RADIO_TECHNOLOGY_HSUPA = RIL_RadioTechnology::RADIO_TECH_HSUPA; |
| 112 | static constexpr int RIL_RADIO_TECHNOLOGY_HSPA = RIL_RadioTechnology::RADIO_TECH_HSPA; |
| 113 | static constexpr int RIL_RADIO_TECHNOLOGY_EVDO_B = RIL_RadioTechnology::RADIO_TECH_EVDO_B; |
| 114 | static constexpr int RIL_RADIO_TECHNOLOGY_EHRPD = RIL_RadioTechnology::RADIO_TECH_EHRPD; |
| 115 | static constexpr int RIL_RADIO_TECHNOLOGY_LTE = RIL_RadioTechnology::RADIO_TECH_LTE; |
| 116 | static constexpr int RIL_RADIO_TECHNOLOGY_HSPAP = RIL_RadioTechnology::RADIO_TECH_HSPAP; |
| 117 | static constexpr int RIL_RADIO_TECHNOLOGY_GSM = RIL_RadioTechnology::RADIO_TECH_GSM; |
| 118 | static constexpr int RIL_RADIO_TECHNOLOGY_TD_SCDMA = RIL_RadioTechnology::RADIO_TECH_TD_SCDMA; |
| 119 | static constexpr int RIL_RADIO_TECHNOLOGY_IWLAN = RIL_RadioTechnology::RADIO_TECH_IWLAN; |
| 120 | static constexpr int RIL_RADIO_TECHNOLOGY_LTE_CA = 19;//RIL_RadioTechnology::RADIO_TECH_LTE_CA; |
| 121 | |
| 122 | static int PREFERRED_NETWORK_MODE; |
| 123 | private: |
| 124 | static const std::string RADIO_DSSS_SIM_DISABLE; |
| 125 | static int32_t disable_sim; |
| 126 | private: |
| 127 | static int init(); |
| 128 | }; |
| 129 | |
| 130 | #endif /* SRC_UTIL_PHONE_UTILS_H_ */ |