1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NETWORK_SEARCH_TYPES_H 17 #define NETWORK_SEARCH_TYPES_H 18 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace Telephony { 23 #define MSG_NS_SPN_UPDATED 0xF1 24 const std::string SPN_INFO_UPDATED_ACTION = "ohos.action.telephonySpnInfoUpdated"; 25 const std::string CUR_PLMN = "CUR_PLMN"; 26 const std::string CUR_PLMN_SHOW = "CUR_PLMN_SHOW"; 27 const std::string CUR_SPN = "CUR_SPN"; 28 const std::string CUR_SPN_SHOW = "CUR_SPN_SHOW"; 29 const std::string CUR_REG_STATE = "CUR_REG_STATE"; 30 const std::string CUR_SPN_SHOW_RULE = "CUR_SPN_SHOW_RULE"; 31 32 enum class DomainType { 33 DOMAIN_TYPE_PS, 34 DOMAIN_TYPE_CS, 35 }; 36 37 enum class RegServiceState { 38 REG_STATE_UNKNOWN, 39 REG_STATE_IN_SERVICE, 40 REG_STATE_NO_SERVICE, 41 REG_STATE_EMERGENCY_ONLY, 42 REG_STATE_SEARCH 43 }; 44 45 enum class RoamingType { 46 ROAMING_STATE_UNKNOWN, 47 ROAMING_STATE_UNSPEC, 48 ROAMING_STATE_DOMESTIC, 49 ROAMING_STATE_INTERNATIONAL 50 }; 51 52 /** 53 * Describes the radio access technology. 54 */ 55 enum class RadioTech { 56 /** 57 * Indicates unknown radio access technology (RAT). 58 */ 59 RADIO_TECHNOLOGY_UNKNOWN = 0, 60 61 /** 62 * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet 63 * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). 64 */ 65 RADIO_TECHNOLOGY_GSM = 1, 66 67 /** 68 * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and 69 * Single-Carrier Radio Transmission Technology (1xRTT). 70 */ 71 RADIO_TECHNOLOGY_1XRTT = 2, 72 73 /** 74 * Indicates that RAT is wideband code division multiple address (WCDMA). 75 */ 76 RADIO_TECHNOLOGY_WCDMA = 3, 77 78 /** 79 * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet 80 * access (HSDPA), and high-speed uplink packet access (HSUPA). 81 */ 82 RADIO_TECHNOLOGY_HSPA = 4, 83 84 /** 85 * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier 86 * HSPA+ (DC-HSPA+). 87 */ 88 RADIO_TECHNOLOGY_HSPAP = 5, 89 90 /** 91 * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). 92 */ 93 RADIO_TECHNOLOGY_TD_SCDMA = 6, 94 95 /** 96 * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. 97 */ 98 RADIO_TECHNOLOGY_EVDO = 7, 99 100 /** 101 * Indicates that RAT is evolved high rate packet data (EHRPD). 102 */ 103 RADIO_TECHNOLOGY_EHRPD = 8, 104 105 /** 106 * Indicates that RAT is long term evolution (LTE). 107 */ 108 RADIO_TECHNOLOGY_LTE = 9, 109 110 /** 111 * Indicates that RAT is LTE carrier aggregation (LTE-CA). 112 */ 113 RADIO_TECHNOLOGY_LTE_CA = 10, 114 115 /** 116 * Indicates that RAT is interworking WLAN (I-WLAN). 117 */ 118 RADIO_TECHNOLOGY_IWLAN = 11, 119 120 /** 121 * Indicates that RAT is 5G new radio (NR). 122 */ 123 RADIO_TECHNOLOGY_NR = 12 124 }; 125 126 /** 127 * Describes the nsa sa state. 128 */ 129 enum class NrState { 130 /** 131 * Indicates that a device is idle under or is connected to an LTE cell that does not support NSA. 132 */ 133 NR_STATE_NOT_SUPPORT = 1, 134 135 /** 136 * Indicates that a device is idle under an LTE cell supporting NSA but not NR coverage detection. 137 */ 138 NR_NSA_STATE_NO_DETECT = 2, 139 140 /** 141 * Indicates that a device is connected to an LTE network under an LTE cell 142 * that supports NSA and NR coverage detection. 143 */ 144 NR_NSA_STATE_CONNECTED_DETECT = 3, 145 146 /** 147 * Indicates that a device is idle under an LTE cell supporting NSA and NR coverage detection. 148 */ 149 NR_NSA_STATE_IDLE_DETECT = 4, 150 151 /** 152 * Indicates that a device is connected to an LTE + NR network under an LTE cell that supports NSA. 153 */ 154 NR_NSA_STATE_DUAL_CONNECTED = 5, 155 156 /** 157 * Indicates that a device is idle under or is connected to an NG-RAN cell while being attached to 5GC. 158 */ 159 NR_NSA_STATE_SA_ATTACHED = 6 160 }; 161 162 enum class NrMode { 163 /** Indicates unknown NR networking mode. */ 164 NR_MODE_UNKNOWN, 165 166 /** Indicates that the NR networking mode is NSA only. */ 167 NR_MODE_NSA_ONLY, 168 169 /** Indicates that the NR networking mode is SA only. */ 170 NR_MODE_SA_ONLY, 171 172 /** Indicates that the NR networking mode is NSA and SA. */ 173 NR_MODE_NSA_AND_SA, 174 }; 175 176 enum class FrequencyType { 177 FREQ_TYPE_UNKNOWN = 0, 178 FREQ_TYPE_MMWAVE 179 }; 180 181 enum class PhoneType { PHONE_TYPE_IS_NONE, PHONE_TYPE_IS_GSM, PHONE_TYPE_IS_CDMA }; 182 183 enum class SelectionMode { MODE_TYPE_UNKNOWN = -1, MODE_TYPE_AUTO = 0, MODE_TYPE_MANUAL = 1 }; 184 185 enum class PreferredNetworkMode { 186 CORE_NETWORK_MODE_AUTO = 0, 187 CORE_NETWORK_MODE_GSM = 1, 188 CORE_NETWORK_MODE_WCDMA = 2, 189 CORE_NETWORK_MODE_LTE = 3, 190 CORE_NETWORK_MODE_LTE_WCDMA = 4, 191 CORE_NETWORK_MODE_LTE_WCDMA_GSM = 5, 192 CORE_NETWORK_MODE_WCDMA_GSM = 6, 193 CORE_NETWORK_MODE_CDMA = 7, 194 CORE_NETWORK_MODE_EVDO = 8, 195 CORE_NETWORK_MODE_EVDO_CDMA = 9, 196 CORE_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA = 10, 197 CORE_NETWORK_MODE_LTE_EVDO_CDMA = 11, 198 CORE_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA = 12, 199 CORE_NETWORK_MODE_TDSCDMA = 13, 200 CORE_NETWORK_MODE_TDSCDMA_GSM = 14, 201 CORE_NETWORK_MODE_TDSCDMA_WCDMA = 15, 202 CORE_NETWORK_MODE_TDSCDMA_WCDMA_GSM = 16, 203 CORE_NETWORK_MODE_LTE_TDSCDMA = 17, 204 CORE_NETWORK_MODE_LTE_TDSCDMA_GSM = 18, 205 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA = 19, 206 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM = 20, 207 CORE_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 21, 208 CORE_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 22, 209 CORE_NETWORK_MODE_NR = 31, 210 CORE_NETWORK_MODE_NR_LTE = 32, 211 CORE_NETWORK_MODE_NR_LTE_WCDMA = 33, 212 CORE_NETWORK_MODE_NR_LTE_WCDMA_GSM = 34, 213 CORE_NETWORK_MODE_NR_LTE_EVDO_CDMA = 35, 214 CORE_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA = 36, 215 CORE_NETWORK_MODE_NR_LTE_TDSCDMA = 37, 216 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_GSM = 38, 217 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA = 39, 218 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM = 40, 219 CORE_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 41, 220 CORE_NETWORK_MODE_MAX_VALUE = 99, 221 }; 222 223 struct OperatorInformation { 224 static const int32_t NETWORK_MAX_NAME_LEN = 15; 225 static const int32_t NETWORK_MAX_FULL_NAME_LEN = 31; 226 static const int32_t NETWORK_MAX_PLMN_LEN = 31; 227 char operatorNumeric[NETWORK_MAX_PLMN_LEN + 1]; 228 char fullName[NETWORK_MAX_FULL_NAME_LEN + 1]; 229 char shortName[NETWORK_MAX_NAME_LEN + 1]; 230 }; 231 232 // RadioAccessFamily defines 233 const int32_t RAF_UNKNOWN = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_UNKNOWN); 234 const int32_t RAF_GSM = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_GSM); 235 const int32_t RAF_1XRTT = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_1XRTT); 236 const int32_t RAF_WCDMA = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_WCDMA); 237 const int32_t RAF_HSPA = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_HSPA); 238 const int32_t RAF_HSPAP = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_HSPAP); 239 const int32_t RAF_TD_SCDMA = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_TD_SCDMA); 240 const int32_t RAF_EVDO = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_EVDO); 241 const int32_t RAF_EHRPD = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_EHRPD); 242 const int32_t RAF_LTE = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_LTE); 243 const int32_t RAF_LTE_CA = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_LTE_CA); 244 const int32_t RAF_NR = 1 << static_cast<int32_t>(RadioTech::RADIO_TECHNOLOGY_NR); 245 } // namespace Telephony 246 } // namespace OHOS 247 #endif // NETWORK_SEARCH_TYPES_H 248