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 ENUM_CONVERT_H 17 #define ENUM_CONVERT_H 18 19 #include <stdint.h> 20 21 #include "iosfwd" 22 23 namespace OHOS { 24 namespace Telephony { 25 /** 26 * @brief Indicates the SIM card types. 27 */ 28 enum class TelephonyCardType { 29 /** 30 * Icc card type: unknown type Card. 31 */ 32 UNKNOWN_CARD = -1, 33 /** 34 * Icc card type: Single sim card type. 35 */ 36 SINGLE_MODE_SIM_CARD = 10, 37 /** 38 * Icc card type: Single usim card type. 39 */ 40 SINGLE_MODE_USIM_CARD = 20, 41 /** 42 * Icc card type: Single ruim card type. 43 */ 44 SINGLE_MODE_RUIM_CARD = 30, 45 /** 46 * Icc card type: Double card C+G. 47 */ 48 DUAL_MODE_CG_CARD = 40, 49 /** 50 * Icc card type: China Telecom Internal Roaming Card (Dual Mode). 51 */ 52 CT_NATIONAL_ROAMING_CARD = 41, 53 /** 54 * Icc card type: China Unicom Dual Mode Card. 55 */ 56 CU_DUAL_MODE_CARD = 42, 57 /** 58 * Icc card type: China Telecom LTE Card (Dual Mode). 59 */ 60 DUAL_MODE_TELECOM_LTE_CARD = 43, 61 /** 62 * Icc card type: Double card U+G. 63 */ 64 DUAL_MODE_UG_CARD = 50, 65 /** 66 * Icc card type: Single isim card type. 67 */ 68 SINGLE_MODE_ISIM_CARD = 60, 69 }; 70 71 /** 72 * @brief Indicates the SIM card states. 73 */ 74 enum class TelephonySimState { 75 /** 76 * Indicates unknown SIM card state, the accurate status cannot be obtained. 77 */ 78 SIM_STATE_UNKNOWN, 79 /** 80 * Indicates the SIM card is in not present state, no SIM card is inserted into the card slot. 81 */ 82 SIM_STATE_NOT_PRESENT, 83 /** 84 * Indicates the SIM card is in locked state, the SIM card is locked by 85 * the personal identification number (PIN)/PIN unblocking key (PUK) or network. 86 */ 87 SIM_STATE_LOCKED, 88 /** 89 * Indicates the SIM card is in not ready state, the SIM card is in position but cannot work properly. 90 */ 91 SIM_STATE_NOT_READY, 92 /** 93 * Indicates the SIM card is in the ready state, the SIM card is in position and is working properly. 94 */ 95 SIM_STATE_READY, 96 /** 97 * Indicates the SIM card is in the loaded state, the SIM card is in position and is working properly. 98 */ 99 SIM_STATE_LOADED 100 }; 101 102 /** 103 * @brief Indicates the cellular data link connection state. 104 */ 105 enum class TelephonyDataConnectionStatus { 106 /** 107 * Indicates that a cellular data link is disconnected. 108 */ 109 DATA_STATE_DISCONNECTED = 11, 110 /** 111 * Indicates that a cellular data link is being connected. 112 */ 113 DATA_STATE_CONNECTING = 12, 114 /** 115 * Indicates that a cellular data link is connected. 116 */ 117 DATA_STATE_CONNECTED = 13, 118 /** 119 * Indicates that a cellular data link is suspended. 120 */ 121 DATA_STATE_SUSPENDED = 14 122 }; 123 124 /** 125 * @brief Indicates the state of call. 126 */ 127 enum class TelephonyCallState { 128 /** 129 * Indicates the call is active. 130 */ 131 CALL_STATUS_ACTIVE = 0, 132 /** 133 * Indicates the call is holding. 134 */ 135 CALL_STATUS_HOLDING, 136 /** 137 * Indicates the call is dialing. 138 */ 139 CALL_STATUS_DIALING, 140 /** 141 * Indicates the call is alerting. 142 */ 143 CALL_STATUS_ALERTING, 144 /** 145 * Indicates the call is incoming. 146 */ 147 CALL_STATUS_INCOMING, 148 /** 149 * Indicates the call is waiting. 150 */ 151 CALL_STATUS_WAITING, 152 /** 153 * Indicates the call is disconnected. 154 */ 155 CALL_STATUS_DISCONNECTED, 156 /** 157 * Indicates the call is disconnecting. 158 */ 159 CALL_STATUS_DISCONNECTING, 160 /** 161 * Indicates the call is idle. 162 */ 163 CALL_STATUS_IDLE, 164 }; 165 166 /** 167 * @brief Indicates the radio access technology. 168 */ 169 enum class TelephonyRadioTech { 170 /** 171 * Indicates unknown radio access technology (RAT). 172 */ 173 RADIO_TECHNOLOGY_UNKNOWN = 0, 174 /** 175 * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet 176 * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). 177 */ 178 RADIO_TECHNOLOGY_GSM = 1, 179 /** 180 * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and 181 * Single-Carrier Radio Transmission Technology (1xRTT). 182 */ 183 RADIO_TECHNOLOGY_1XRTT = 2, 184 /** 185 * Indicates that RAT is wideband code division multiple address (WCDMA). 186 */ 187 RADIO_TECHNOLOGY_WCDMA = 3, 188 /** 189 * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet 190 * access (HSDPA), and high-speed uplink packet access (HSUPA). 191 */ 192 RADIO_TECHNOLOGY_HSPA = 4, 193 /** 194 * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier 195 * HSPA+ (DC-HSPA+). 196 */ 197 RADIO_TECHNOLOGY_HSPAP = 5, 198 /** 199 * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). 200 */ 201 RADIO_TECHNOLOGY_TD_SCDMA = 6, 202 /** 203 * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. 204 */ 205 RADIO_TECHNOLOGY_EVDO = 7, 206 /** 207 * Indicates that RAT is evolved high rate packet data (EHRPD). 208 */ 209 RADIO_TECHNOLOGY_EHRPD = 8, 210 /** 211 * Indicates that RAT is long term evolution (LTE). 212 */ 213 RADIO_TECHNOLOGY_LTE = 9, 214 /** 215 * Indicates that RAT is LTE carrier aggregation (LTE-CA). 216 */ 217 RADIO_TECHNOLOGY_LTE_CA = 10, 218 /** 219 * Indicates that RAT is interworking WLAN (I-WLAN). 220 */ 221 RADIO_TECHNOLOGY_IWLAN = 11, 222 /** 223 * Indicates that RAT is 5G new radio (NR). 224 */ 225 RADIO_TECHNOLOGY_NR = 12 226 }; 227 228 /** 229 * @brief Indicates the cellular data flow type. 230 */ 231 enum class TelephonyCellDataFlowType { 232 /** 233 * Indicates that there is no uplink or downlink data. 234 */ 235 DATA_FLOW_TYPE_NONE = 0, 236 /** 237 * Indicates that there is only downlink data. 238 */ 239 DATA_FLOW_TYPE_DOWN = 1, 240 /** 241 * Indicates that there is only uplink data. 242 */ 243 DATA_FLOW_TYPE_UP = 2, 244 /** 245 * Indicates that there is uplink and downlink data. 246 */ 247 DATA_FLOW_TYPE_UP_DOWN = 3, 248 /** 249 * Indicates that there is no uplink or downlink data, and the bottom-layer link is in the dormant state. 250 */ 251 DATA_FLOW_TYPE_DORMANT = 4 252 }; 253 254 /** 255 * @brief Indicates SIM card lock type. 256 */ 257 enum class TelephonyLockReason { 258 /** 259 * Indicates no SIM lock. 260 */ 261 SIM_NONE, 262 /** 263 * Indicates the PIN lock. 264 */ 265 SIM_PIN, 266 /** 267 * Indicates the PUK lock. 268 */ 269 SIM_PUK, 270 /** 271 * Indicates network personalization of PIN lock(refer 3GPP TS 22.022 [33]). 272 */ 273 SIM_PN_PIN, 274 /** 275 * Indicates network personalization of PUK lock(refer 3GPP TS 22.022 [33]). 276 */ 277 SIM_PN_PUK, 278 /** 279 * Indicates network subset personalization of PIN lock(refer 3GPP TS 22.022 [33]). 280 */ 281 SIM_PU_PIN, 282 /** 283 * Indicates network subset personalization of PUK lock(refer 3GPP TS 22.022 [33]). 284 */ 285 SIM_PU_PUK, 286 /** 287 * Indicates service provider personalization of PIN lock(refer 3GPP TS 22.022 [33]). 288 */ 289 SIM_PP_PIN, 290 /** 291 * Indicates service provider personalization of PUK lock(refer 3GPP TS 22.022 [33]). 292 */ 293 SIM_PP_PUK, 294 /** 295 * Indicates corporate personalization of PIN lock(refer 3GPP TS 22.022 [33]). 296 */ 297 SIM_PC_PIN, 298 /** 299 * Indicates corporate personalization of PUK lock(refer 3GPP TS 22.022 [33]). 300 */ 301 SIM_PC_PUK, 302 /** 303 * Indicates SIM/USIM personalization of PIN lock(refer 3GPP TS 22.022 [33]). 304 */ 305 SIM_SIM_PIN, 306 /** 307 * Indicates SIM/USIM personalization of PUK lock(refer 3GPP TS 22.022 [33]). 308 */ 309 SIM_SIM_PUK, 310 }; 311 312 /** 313 * @brief Get the string of bool value. 314 * 315 * @param value 316 * @return Return "FALSE" if the value is {@code 0}, return "TRUE" otherwise. 317 */ 318 std::string GetBoolValue(int32_t value); 319 320 /** 321 * @brief Get the string of SIM state. 322 * 323 * @param state Indicates the state of SIM. 324 * @return Return the string of SIM state. 325 */ 326 std::string GetSimState(int32_t state); 327 328 /** 329 * @brief Get the string of call state. 330 * 331 * @param state Indicates the state of call. 332 * @return Return the string of call state. 333 */ 334 std::string GetCallState(int32_t state); 335 336 /** 337 * @brief Get the string of SIM card type. 338 * 339 * @param type Indicates the type of SIM card. 340 * @return Return the string of SIM card type. 341 */ 342 std::string GetCardType(int32_t type); 343 344 /** 345 * @brief Get the string of cellular data connection state. 346 * 347 * @param state Indicates the state of cellular data connection. 348 * @return Return the string of cellular data connection state. 349 */ 350 std::string GetCellularDataConnectionState(int32_t state); 351 352 /** 353 * @brief Get the string of cellular data flow type. 354 * 355 * @param flowData Indicates the cellular data flow type. 356 * @return Return the string of cellular data flow type. 357 */ 358 std::string GetCellularDataFlow(int32_t flowData); 359 360 /** 361 * @brief Get the string of radio access technology for cellular data. 362 * 363 * @param type Indicates the radio access technology. 364 * @return Return the string of radio access technology. 365 */ 366 std::string GetCellularDataConnectionNetworkType(int32_t type); 367 368 /** 369 * @brief Get the string of SIM lock reason. 370 * 371 * @param reason Indicates the the SIM lock reason. 372 * @return Return the string of SIM lock reason. 373 */ 374 std::string GetLockReason(int32_t reason); 375 } // namespace Telephony 376 } // namespace OHOS 377 378 #endif // ENUM_CONVERT_H 379