blob: b9a79ec1474b4bec0de3a9d48b6019537366c705 [file] [log] [blame]
xjde81d1d2021-11-25 15:01:52 +08001/* 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#include <log/log.h>
37#include "ModemCategory.h"
38#include "WorldPhoneUtil.h"
39#include "RatConfiguration.h"
40#include "Radio_capability_switch_util.h"
41#include "common.h"
42#undef LOG_TAG
43#define LOG_TAG "EM_ModemCategory"
44
45const int ModemCategory::MODEM_FDD = 1;
46const int ModemCategory::MODEM_TD = 2;
47const int ModemCategory::MODEM_NO3G = 3;
48const std::string ModemCategory::FK_SIM_SWITCH = "persist.vendor.radio.simswitch";
49const std::string ModemCategory::FK_CDMA_SLOT = "persist.vendor.radio.cdma_slot";
50
51/**
52 * The property is used to check if the card is cdma 3G dual mode card in the slot.
53 */
54std::vector<std::string> ModemCategory::PROPERTY_RIL_CT3G {
55 "vendor.gsm.ril.ct3g",
56 "vendor.gsm.ril.ct3g.2",
57 "vendor.gsm.ril.ct3g.3",
58 "vendor.gsm.ril.ct3g.4",
59};
60
61/**
62 * The property is used to get supported card type of each SIM card in the slot.
63 */
64std::vector<std::string> ModemCategory::PROPERTY_RIL_FULL_UICC_TYPE {
65 "vendor.gsm.ril.fulluicctype",
66 "vendor.gsm.ril.fulluicctype.2",
67 "vendor.gsm.ril.fulluicctype.3",
68 "vendor.gsm.ril.fulluicctype.4"};
69
70ModemCategory::ModemCategory() {
71 // TODO Auto-generated constructor stub
72
73}
74
75ModemCategory::~ModemCategory() {
76 // TODO Auto-generated destructor stub
77}
78
79int ModemCategory::getModemType() {
80 int mode = MODEM_NO3G;
81 int mask = WorldPhoneUtil::get3GDivisionDuplexMode();
82 if ((1 == mask) || (2 == mask)) {
83 mode = mask;
84 }
85 RLOGD("mode = %d", mode);
86 return mode;
87}
88
89bool ModemCategory::isCdma() {
90 return RatConfiguration::isC2kSupported();
91}
92
93bool ModemCategory::isLteSupport() {
94 return (RatConfiguration::isLteFddSupported() || RatConfiguration::isLteTddSupported());
95}
96
97bool ModemCategory::isGsmSupport() {
98 return (RatConfiguration::isGsmSupported());
99}
100
101bool ModemCategory::isWcdmaSupport() {
102 return (RatConfiguration::isWcdmaSupported());
103}
104
105bool ModemCategory::isTdscdmaSupport() {
106 return (RatConfiguration::isTdscdmaSupported());
107}
108
109bool ModemCategory::isCapabilitySim(int type) {
110 int mainCard = Radio_capability_switch_util::get_main_capability_phone_id();
111 bool isCapability = (type == mainCard) ? true : false;
112 RLOGD("The card(%d) is main card = %d", type, isCapability);
113 return isCapability;
114}
115
116bool ModemCategory::checkViceSimCapability(int simType, int capability) {
117 int rat = get_radio_capa(simType).rat;
118 if ((rat & capability) > 0) {
119 RLOGD("SIM has checked capability. rat: %d, cap: %d", rat , capability);
120 return true;
121 }
122 return false;
123}