1/* 2 * Copyright (C) 2021-2022 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 16import {AsyncCallback, Callback} from "./basic"; 17 18/** 19 * Provides interfaces for applications to obtain the network state, cell information, signal information, 20 * and device ID of the wireless cellular network (WCN), and provides a callback registration mechanism to 21 * listen for changes of the network, cell, and signal status of the WCN. 22 * 23 * @since 6 24 * @syscap SystemCapability.Telephony.CoreService 25 */ 26declare namespace radio { 27 /** 28 * Obtains radio access technology (RAT) of the registered network. The system 29 * returns RAT of the packet service (PS) and circuit service (CS) domain. 30 * 31 * @param slotId Indicates the card slot index number, 32 * ranging from 0 to the maximum card slot index number supported by the device. 33 * @param callback Returns an integer indicating the RAT in use. The values are as follows: 34 * <ul> 35 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_UNKNOWN} 36 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_GSM} 37 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_1XRTT} 38 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_WCDMA} 39 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_HSPA} 40 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_HSPAP} 41 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_TD_SCDMA} 42 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_EVDO} 43 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_EHRPD} 44 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_LTE} 45 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_LTE_CA} 46 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_IWLAN} 47 * <li>{@code RadioTechnology#RADIO_TECHNOLOGY_NR} 48 * </ul> 49 * @permission ohos.permission.GET_NETWORK_INFO 50 * @throws {BusinessError} 201 - Permission denied. 51 * @throws {BusinessError} 401 - Parameter error. 52 * @throws {BusinessError} 8300001 - Invalid parameter value. 53 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 54 * @throws {BusinessError} 8300003 - System internal error. 55 * @throws {BusinessError} 8300999 - Unknown error code. 56 */ 57 function getRadioTech(slotId: number, 58 callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; 59 function getRadioTech(slotId: number): Promise<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>; 60 61 /** 62 * Obtains the network state of the registered network. 63 * 64 * @param slotId Indicates the card slot index number, 65 * ranging from 0 to the maximum card slot index number supported by the device. 66 * @param callback Returns a {@code NetworkState} object. 67 * @permission ohos.permission.GET_NETWORK_INFO 68 * @throws {BusinessError} 201 - Permission denied. 69 * @throws {BusinessError} 401 - Parameter error. 70 * @throws {BusinessError} 8300001 - Invalid parameter value. 71 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 72 * @throws {BusinessError} 8300003 - System internal error. 73 * @throws {BusinessError} 8300999 - Unknown error code. 74 */ 75 function getNetworkState(callback: AsyncCallback<NetworkState>): void; 76 function getNetworkState(slotId: number, callback: AsyncCallback<NetworkState>): void; 77 function getNetworkState(slotId?: number): Promise<NetworkState>; 78 79 /** 80 * Actively requests to update location information. 81 * 82 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 83 * supported by the device. 84 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 85 * @throws {BusinessError} 201 - Permission denied. 86 * @throws {BusinessError} 401 - Parameter error. 87 * @throws {BusinessError} 8300001 - Invalid parameter value. 88 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 89 * @throws {BusinessError} 8300003 - System internal error. 90 * @throws {BusinessError} 8300999 - Unknown error code. 91 * @param { number } [ slotId ] - indicates the card slot index number. 92 * @param { AsyncCallback<void> } callback - the callback of sendUpdateCellLocationRequest. 93 * @systemapi Hide this for inner system use. 94 * @since 8 95 */ 96 function sendUpdateCellLocationRequest(callback: AsyncCallback<void>): void; 97 function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback<void>): void; 98 99 /** 100 * Actively requests to update location information. 101 * 102 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 103 * supported by the device. 104 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 105 * @throws {BusinessError} 201 - Permission denied. 106 * @throws {BusinessError} 401 - Parameter error. 107 * @throws {BusinessError} 8300001 - Invalid parameter value. 108 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 109 * @throws {BusinessError} 8300003 - System internal error. 110 * @throws {BusinessError} 8300999 - Unknown error code. 111 * @param { number } [ slotId ] - indicates the card slot index number. 112 * @returns { Promise<void> } the promise returned by the function. 113 * @systemapi Hide this for inner system use. 114 * @since 8 115 */ 116 function sendUpdateCellLocationRequest(slotId?: number): Promise<void>; 117 118 /** 119 * Get the current cell information. 120 * 121 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 122 * supported by the device. 123 * @param callback Return cell information. 124 * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION 125 * @throws {BusinessError} 201 - Permission denied. 126 * @throws {BusinessError} 401 - Parameter error. 127 * @throws {BusinessError} 8300001 - Invalid parameter value. 128 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 129 * @throws {BusinessError} 8300003 - System internal error. 130 * @throws {BusinessError} 8300999 - Unknown error code. 131 * @systemapi Hide this for inner system use. 132 * @since 8 133 */ 134 function getCellInformation(callback: AsyncCallback<Array<CellInformation>>): void; 135 function getCellInformation(slotId: number, callback: AsyncCallback<Array<CellInformation>>): void; 136 function getCellInformation(slotId?: number): Promise<Array<CellInformation>>; 137 138 /** 139 * Obtains the network search mode of the SIM card in a specified slot. 140 * 141 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 142 * supported by the device. 143 * @param callback Returns the network search mode of the SIM card. Available values are as follows: 144 * <ul> 145 * <li>{@link NetworkSelectionMode#NETWORK_SELECTION_UNKNOWN} 146 * <li>{@link NetworkSelectionMode#NETWORK_SELECTION_AUTOMATIC} 147 * <li>{@link NetworkSelectionMode#NETWORK_SELECTION_MANUAL} 148 * <ul> 149 * @throws {BusinessError} 401 - Parameter error. 150 * @throws {BusinessError} 8300001 - Invalid parameter value. 151 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 152 * @throws {BusinessError} 8300003 - System internal error. 153 * @throws {BusinessError} 8300999 - Unknown error code. 154 */ 155 function getNetworkSelectionMode(slotId: number, callback: AsyncCallback<NetworkSelectionMode>): void; 156 function getNetworkSelectionMode(slotId: number): Promise<NetworkSelectionMode>; 157 158 /** 159 * Set the current network selection mode. 160 * 161 * @param options Indicates the network selection mode option. 162 * @permission ohos.permission.SET_TELEPHONY_STATE 163 * @throws {BusinessError} 201 - Permission denied. 164 * @throws {BusinessError} 401 - Parameter error. 165 * @throws {BusinessError} 8300001 - Invalid parameter value. 166 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 167 * @throws {BusinessError} 8300003 - System internal error. 168 * @throws {BusinessError} 8300999 - Unknown error code. 169 * @systemapi Hide this for inner system use. 170 */ 171 function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback<void>): void; 172 function setNetworkSelectionMode(options: NetworkSelectionModeOptions): Promise<void>; 173 174 /** 175 * Get network search information. 176 * 177 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 178 * supported by the device. 179 * @param callback Returns the search results of the network. 180 * @permission ohos.permission.GET_TELEPHONY_STATE 181 * @throws {BusinessError} 201 - Permission denied. 182 * @throws {BusinessError} 401 - Parameter error. 183 * @throws {BusinessError} 8300001 - Invalid parameter value. 184 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 185 * @throws {BusinessError} 8300003 - System internal error. 186 * @throws {BusinessError} 8300999 - Unknown error code. 187 * @systemapi Hide this for inner system use. 188 */ 189 function getNetworkSearchInformation(slotId: number, callback: AsyncCallback<NetworkSearchResult>): void; 190 function getNetworkSearchInformation(slotId: number): Promise<NetworkSearchResult>; 191 192 /** 193 * Obtains the ISO-defined country code of the country where the registered network is deployed. 194 * 195 * @param slotId Indicates the card slot index number, 196 * ranging from 0 to the maximum card slot index number supported by the device. 197 * @param callback Returns the country code defined in ISO 3166-2; 198 * returns an empty string if the device is not registered with any network. 199 * @throws {BusinessError} 401 - Parameter error. 200 * @throws {BusinessError} 8300001 - Invalid parameter value. 201 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 202 * @throws {BusinessError} 8300003 - System internal error. 203 * @throws {BusinessError} 8300999 - Unknown error code. 204 * @since 7 205 */ 206 function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback<string>): void; 207 function getISOCountryCodeForNetwork(slotId: number): Promise<string>; 208 209 /** 210 * Get the option mode of NR. 211 * 212 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 213 * supported by the device. 214 * @param callback Returns the selection mode of NR. 215 * @throws {BusinessError} 401 - Parameter error. 216 * @throws {BusinessError} 8300001 - Invalid parameter value. 217 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 218 * @throws {BusinessError} 8300003 - System internal error. 219 * @throws {BusinessError} 8300999 - Unknown error code. 220 * @systemapi Hide this for inner system use. 221 * @since 8 222 */ 223 function getNrOptionMode(callback: AsyncCallback<NrOptionMode>): void; 224 function getNrOptionMode(slotId: number, callback: AsyncCallback<NrOptionMode>): void; 225 function getNrOptionMode(slotId?: number): Promise<NrOptionMode>; 226 227 /** 228 * Obtains the IMEI of a specified card slot of the device. 229 * 230 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 231 * supported by the device. 232 * @param callback Returns the IMEI; returns an empty string if the IMEI does not exist. 233 * @permission ohos.permission.GET_TELEPHONY_STATE 234 * @throws {BusinessError} 201 - Permission denied. 235 * @throws {BusinessError} 401 - Parameter error. 236 * @throws {BusinessError} 8300001 - Invalid parameter value. 237 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 238 * @throws {BusinessError} 8300003 - System internal error. 239 * @throws {BusinessError} 8300999 - Unknown error code. 240 * @systemapi Hide this for inner system use. 241 * @since 8 242 */ 243 function getIMEI(callback: AsyncCallback<string>): void; 244 function getIMEI(slotId: number, callback: AsyncCallback<string>): void; 245 function getIMEI(slotId?: number): Promise<string>; 246 247 /** 248 * Obtains the MEID of a specified card slot of the device. 249 * 250 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 251 * supported by the device. 252 * @param callback Returns the MEID; returns an empty string if the MEID does not exist. 253 * @permission ohos.permission.GET_TELEPHONY_STATE 254 * @throws {BusinessError} 201 - Permission denied. 255 * @throws {BusinessError} 401 - Parameter error. 256 * @throws {BusinessError} 8300001 - Invalid parameter value. 257 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 258 * @throws {BusinessError} 8300003 - System internal error. 259 * @throws {BusinessError} 8300999 - Unknown error code. 260 * @systemapi Hide this for inner system use. 261 * @since 8 262 */ 263 function getMEID(callback: AsyncCallback<string>): void; 264 function getMEID(slotId: number, callback: AsyncCallback<string>): void; 265 function getMEID(slotId?: number): Promise<string>; 266 267 /** 268 * Obtains the unique device ID of a specified card slot of the device. 269 * 270 * <p>If the device is registered with a 3GPP-compliant network, the international mobile equipment identity 271 * (IMEI) is returned. If the device is registered with a 3GPP2-compliant network, the mobile equipment identifier 272 * (MEID) is returned. 273 * 274 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 275 * supported by the device. 276 * @param callback Returns the unique device ID; returns an empty string if the unique device ID does not exist. 277 * @permission ohos.permission.GET_TELEPHONY_STATE 278 * @throws {BusinessError} 201 - Permission denied. 279 * @throws {BusinessError} 401 - Parameter error. 280 * @throws {BusinessError} 8300001 - Invalid parameter value. 281 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 282 * @throws {BusinessError} 8300003 - System internal error. 283 * @throws {BusinessError} 8300999 - Unknown error code. 284 * @systemapi Hide this for inner system use. 285 * @since 8 286 */ 287 function getUniqueDeviceId(callback: AsyncCallback<string>): void; 288 function getUniqueDeviceId(slotId: number, callback: AsyncCallback<string>): void; 289 function getUniqueDeviceId(slotId?: number): Promise<string>; 290 291 /** 292 * Obtains the index number of the card slot where the primary card is located if multiple SIM cards are inserted. 293 * 294 * <p>The primary card is the SIM card inserted in the card slot that uses data services by default. 295 * 296 * @param callback Returns the index number of the primary card slot. 297 * @throws {BusinessError} 8300001 - Invalid parameter value. 298 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 299 * @throws {BusinessError} 8300003 - System internal error. 300 * @throws {BusinessError} 8300999 - Unknown error code. 301 * @since 7 302 */ 303 function getPrimarySlotId(callback: AsyncCallback<number>): void; 304 function getPrimarySlotId(): Promise<number>; 305 306 /** 307 * Set the index number of the main SIM card slot. 308 * 309 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 310 * supported by the device. 311 * @permission ohos.permission.SET_TELEPHONY_STATE 312 * @throws {BusinessError} 201 - Permission denied. 313 * @throws {BusinessError} 401 - Parameter error. 314 * @throws {BusinessError} 8300001 - Invalid parameter value. 315 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 316 * @throws {BusinessError} 8300003 - System internal error. 317 * @throws {BusinessError} 8300004 - Do not have sim card. 318 * @throws {BusinessError} 8300999 - Unknown error code. 319 * @systemapi Hide this for inner system use. 320 * @since 8 321 */ 322 function setPrimarySlotId(slotId: number, callback: AsyncCallback<void>): void; 323 function setPrimarySlotId(slotId: number): Promise<void>; 324 325 /** 326 * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. 327 * 328 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 329 * supported by the device. 330 * @param callback Returns the instance list of the child classes derived from {@link SignalInformation}. 331 * @throws {BusinessError} 401 - Parameter error. 332 * @throws {BusinessError} 8300001 - Invalid parameter value. 333 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 334 * @throws {BusinessError} 8300003 - System internal error. 335 * @throws {BusinessError} 8300999 - Unknown error code. 336 * @since 7 337 */ 338 function getSignalInformation(slotId: number, callback: AsyncCallback<Array<SignalInformation>>): void; 339 function getSignalInformation(slotId: number): Promise<Array<SignalInformation>>; 340 341 /** 342 * Checks whether the device supports 5G New Radio (NR). 343 * 344 * @returns Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. 345 * @since 7 346 * @deprecated since 9 347 * @useinstead telephony.radio#isNRSupported 348 */ 349 function isNrSupported(): boolean; 350 351 /** 352 * Checks whether the device supports 5G New Radio (NR) by according card slot. 353 * 354 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 355 * supported by the device. 356 * @returns Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. 357 * @since 8 358 * @deprecated since 9 359 * @useinstead telephony.radio#isNRSupported 360 */ 361 function isNrSupported(slotId: number): boolean; 362 363 /** 364 * Checks whether the device supports 5G New Radio (NR). 365 * 366 * @returns Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. 367 * @since 9 368 */ 369 function isNRSupported(): boolean; 370 371 /** 372 * Checks whether the device supports 5G New Radio (NR) by according card slot. 373 * 374 * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number 375 * supported by the device. 376 * @returns Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. 377 * @since 9 378 */ 379 function isNRSupported(slotId: number): boolean; 380 381 /** 382 * Checks whether the radio service is enabled. 383 * 384 * @param slotId Indicates the card slot index number, 385 * ranging from 0 to the maximum card slot index number supported by the device. 386 * @param callback Returns {@code true} If the radio service is enabled; returns {@code false} otherwise. 387 * @permission ohos.permission.GET_NETWORK_INFO 388 * @throws {BusinessError} 201 - Permission denied. 389 * @throws {BusinessError} 401 - Parameter error. 390 * @throws {BusinessError} 8300001 - Invalid parameter value. 391 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 392 * @throws {BusinessError} 8300003 - System internal error. 393 * @throws {BusinessError} 8300999 - Unknown error code. 394 * @since 7 395 */ 396 function isRadioOn(callback: AsyncCallback<boolean>): void; 397 function isRadioOn(slotId: number, callback: AsyncCallback<boolean>): void; 398 function isRadioOn(slotId?: number): Promise<boolean>; 399 400 /** 401 * Turn on the radio service. 402 * 403 * @param slotId Indicates the card slot index number, 404 * ranging from 0 to the maximum card slot index number supported by the device. 405 * @permission ohos.permission.SET_TELEPHONY_STATE 406 * @throws {BusinessError} 201 - Permission denied. 407 * @throws {BusinessError} 401 - Parameter error. 408 * @throws {BusinessError} 8300001 - Invalid parameter value. 409 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 410 * @throws {BusinessError} 8300003 - System internal error. 411 * @throws {BusinessError} 8300999 - Unknown error code. 412 * @systemapi Hide this for inner system use. 413 * @since 7 414 */ 415 function turnOnRadio(callback: AsyncCallback<void>): void; 416 function turnOnRadio(slotId: number, callback: AsyncCallback<void>): void; 417 function turnOnRadio(slotId?: number): Promise<void>; 418 419 /** 420 * Turn off the radio service. 421 * 422 * @param slotId Indicates the card slot index number, 423 * ranging from 0 to the maximum card slot index number supported by the device. 424 * @permission ohos.permission.SET_TELEPHONY_STATE 425 * @throws {BusinessError} 201 - Permission denied. 426 * @throws {BusinessError} 401 - Parameter error. 427 * @throws {BusinessError} 8300001 - Invalid parameter value. 428 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 429 * @throws {BusinessError} 8300003 - System internal error. 430 * @throws {BusinessError} 8300999 - Unknown error code. 431 * @systemapi Hide this for inner system use. 432 * @since 7 433 */ 434 function turnOffRadio(callback: AsyncCallback<void>): void; 435 function turnOffRadio(slotId: number, callback: AsyncCallback<void>): void; 436 function turnOffRadio(slotId?: number): Promise<void>; 437 438 /** 439 * Get the operator name of the specified SIM card slot. 440 * 441 * @param slotId Indicates the card slot index number, 442 * ranging from 0 to the maximum card slot index number supported by the device. 443 * @param callback Returns operator name. 444 * @throws {BusinessError} 401 - Parameter error. 445 * @throws {BusinessError} 8300001 - Invalid parameter value. 446 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 447 * @throws {BusinessError} 8300003 - System internal error. 448 * @throws {BusinessError} 8300999 - Unknown error code. 449 * @since 7 450 */ 451 function getOperatorName(slotId: number, callback: AsyncCallback<string>): void; 452 function getOperatorName(slotId: number): Promise<string>; 453 454 /** 455 * Set the preferred network for the specified SIM card slot. 456 * 457 * @param slotId Indicates the card slot index number, 458 * ranging from 0 to the maximum card slot index number supported by the device. 459 * @param networkMode Indicates that you want to set the preferred network mode. 460 * @permission ohos.permission.SET_TELEPHONY_STATE 461 * @throws {BusinessError} 201 - Permission denied. 462 * @throws {BusinessError} 401 - Parameter error. 463 * @throws {BusinessError} 8300001 - Invalid parameter value. 464 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 465 * @throws {BusinessError} 8300003 - System internal error. 466 * @throws {BusinessError} 8300999 - Unknown error code. 467 * @systemapi Hide this for inner system use. 468 * @since 8 469 */ 470 function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback<void>): void; 471 function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise<void>; 472 473 /** 474 * Get the preferred network for the specified SIM card slot. 475 * 476 * @param slotId Indicates the card slot index number, 477 * ranging from 0 to the maximum card slot index number supported by the device. 478 * @param callback Returns the preferred network mode to obtain. 479 * @permission ohos.permission.GET_TELEPHONY_STATE 480 * @throws {BusinessError} 201 - Permission denied. 481 * @throws {BusinessError} 401 - Parameter error. 482 * @throws {BusinessError} 8300001 - Invalid parameter value. 483 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 484 * @throws {BusinessError} 8300003 - System internal error. 485 * @throws {BusinessError} 8300999 - Unknown error code. 486 * @systemapi Hide this for inner system use. 487 * @since 8 488 */ 489 function getPreferredNetwork(slotId: number, callback: AsyncCallback<PreferredNetworkMode>): void; 490 function getPreferredNetwork(slotId: number): Promise<PreferredNetworkMode>; 491 492 /** 493 * Get the IMS registration state info of specified IMS service type. 494 * 495 * @param slotId Indicates the card slot index number, 496 * ranging from 0 to the maximum card slot index number supported by the device. 497 * @param imsType Indicates the ims service type of the {@link ImsServiceType}. 498 * @param callback Returns an instance of the {@link ImsRegInfo} class. 499 * @permission ohos.permission.GET_TELEPHONY_STATE 500 * @throws {BusinessError} 201 - Permission denied. 501 * @throws {BusinessError} 401 - Parameter error. 502 * @throws {BusinessError} 8300001 - Invalid parameter value. 503 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 504 * @throws {BusinessError} 8300003 - System internal error. 505 * @throws {BusinessError} 8300999 - Unknown error code. 506 * @systemapi Hide this for inner system use. 507 * @since 9 508 */ 509 function getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback<ImsRegInfo>): void; 510 function getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise<ImsRegInfo>; 511 512 /** 513 * Called when the IMS registration state of specified IMS service type corresponding 514 * to a monitored {@code slotId} updates. 515 * 516 * @param slotId Indicates the card slot index number, 517 * ranging from 0 to the maximum card slot index number supported by the device. 518 * @param imsType Indicates the ims service type of the {@link ImsServiceType}. 519 * @param callback including an instance of the {@link ImsRegInfo} class. 520 * @permission ohos.permission.GET_TELEPHONY_STATE 521 * @throws {BusinessError} 201 - Permission denied. 522 * @throws {BusinessError} 401 - Parameter error. 523 * @throws {BusinessError} 8300001 - Invalid parameter value. 524 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 525 * @throws {BusinessError} 8300003 - System internal error. 526 * @throws {BusinessError} 8300999 - Unknown error code. 527 * @systemapi Hide this for inner system use. 528 * @since 9 529 */ 530 function on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback<ImsRegInfo>): void; 531 532 533 /** 534 * Unsubscribe from imsRegStateChange event. 535 * 536 * @param slotId Indicates the card slot index number, 537 * ranging from 0 to the maximum card slot index number supported by the device. 538 * @param imsType Indicates the ims service type of the {@link ImsServiceType}. 539 * @param callback including an instance of the {@link ImsRegInfo} class. 540 * @permission ohos.permission.GET_TELEPHONY_STATE 541 * @throws {BusinessError} 201 - Permission denied. 542 * @throws {BusinessError} 401 - Parameter error. 543 * @throws {BusinessError} 8300001 - Invalid parameter value. 544 * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. 545 * @throws {BusinessError} 8300003 - System internal error. 546 * @throws {BusinessError} 8300999 - Unknown error code. 547 * @systemapi Hide this for inner system use. 548 * @since 9 549 */ 550 function off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback<ImsRegInfo>): void; 551 552 /** 553 * @systemapi Hide this for inner system use. 554 * @since 8 555 */ 556 export enum PreferredNetworkMode { 557 PREFERRED_NETWORK_MODE_GSM = 1, 558 PREFERRED_NETWORK_MODE_WCDMA = 2, 559 PREFERRED_NETWORK_MODE_LTE = 3, 560 PREFERRED_NETWORK_MODE_LTE_WCDMA = 4, 561 PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM = 5, 562 PREFERRED_NETWORK_MODE_WCDMA_GSM = 6, 563 PREFERRED_NETWORK_MODE_CDMA = 7, 564 PREFERRED_NETWORK_MODE_EVDO = 8, 565 PREFERRED_NETWORK_MODE_EVDO_CDMA = 9, 566 PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA = 10, 567 PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA = 11, 568 PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA = 12, 569 PREFERRED_NETWORK_MODE_TDSCDMA = 13, 570 PREFERRED_NETWORK_MODE_TDSCDMA_GSM = 14, 571 PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA = 15, 572 PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM = 16, 573 PREFERRED_NETWORK_MODE_LTE_TDSCDMA = 17, 574 PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM = 18, 575 PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA = 19, 576 PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM = 20, 577 PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 21, 578 PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 22, 579 PREFERRED_NETWORK_MODE_NR = 31, 580 PREFERRED_NETWORK_MODE_NR_LTE = 32, 581 PREFERRED_NETWORK_MODE_NR_LTE_WCDMA = 33, 582 PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM = 34, 583 PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA = 35, 584 PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA = 36, 585 PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA = 37, 586 PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM = 38, 587 PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA = 39, 588 PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM = 40, 589 PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA = 41, 590 PREFERRED_NETWORK_MODE_MAX_VALUE = 99, 591 } 592 593 /** 594 * Describes the radio access technology. 595 */ 596 export enum RadioTechnology { 597 /** 598 * Indicates unknown radio access technology (RAT). 599 */ 600 RADIO_TECHNOLOGY_UNKNOWN = 0, 601 602 /** 603 * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet 604 * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). 605 */ 606 RADIO_TECHNOLOGY_GSM = 1, 607 608 /** 609 * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and 610 * Single-Carrier Radio Transmission Technology (1xRTT). 611 */ 612 RADIO_TECHNOLOGY_1XRTT = 2, 613 614 /** 615 * Indicates that RAT is wideband code division multiple address (WCDMA). 616 */ 617 RADIO_TECHNOLOGY_WCDMA = 3, 618 619 /** 620 * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet 621 * access (HSDPA), and high-speed uplink packet access (HSUPA). 622 */ 623 RADIO_TECHNOLOGY_HSPA = 4, 624 625 /** 626 * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier 627 * HSPA+ (DC-HSPA+). 628 */ 629 RADIO_TECHNOLOGY_HSPAP = 5, 630 631 /** 632 * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). 633 */ 634 RADIO_TECHNOLOGY_TD_SCDMA = 6, 635 636 /** 637 * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. 638 */ 639 RADIO_TECHNOLOGY_EVDO = 7, 640 641 /** 642 * Indicates that RAT is evolved high rate packet data (EHRPD). 643 */ 644 RADIO_TECHNOLOGY_EHRPD = 8, 645 646 /** 647 * Indicates that RAT is long term evolution (LTE). 648 */ 649 RADIO_TECHNOLOGY_LTE = 9, 650 651 /** 652 * Indicates that RAT is LTE carrier aggregation (LTE-CA). 653 */ 654 RADIO_TECHNOLOGY_LTE_CA = 10, 655 656 /** 657 * Indicates that RAT is interworking WLAN (I-WLAN). 658 */ 659 RADIO_TECHNOLOGY_IWLAN = 11, 660 661 /** 662 * Indicates that RAT is 5G new radio (NR). 663 */ 664 RADIO_TECHNOLOGY_NR = 12 665 } 666 667 export interface SignalInformation { 668 /** 669 * Obtains the network type corresponding to the signal. 670 */ 671 signalType: NetworkType; 672 673 /** 674 * Obtains the signal level of the current network. 675 */ 676 signalLevel: number; 677 678 /** 679 * rsrp for LTE and NR; dbm for CDMA and EVDO; rscp for WCDMA; rssi for GSM. 680 * @since 9 681 */ 682 dBm: number; 683 } 684 685 /** 686 * Describes the network type. 687 */ 688 export enum NetworkType { 689 /** 690 * Indicates unknown network type. 691 */ 692 NETWORK_TYPE_UNKNOWN, 693 694 /** 695 * Indicates that the network type is GSM. 696 */ 697 NETWORK_TYPE_GSM, 698 699 /** 700 * Indicates that the network type is CDMA. 701 */ 702 NETWORK_TYPE_CDMA, 703 704 /** 705 * Indicates that the network type is WCDMA. 706 */ 707 NETWORK_TYPE_WCDMA, 708 709 /** 710 * Indicates that the network type is TD-SCDMA. 711 */ 712 NETWORK_TYPE_TDSCDMA, 713 714 /** 715 * Indicates that the network type is LTE. 716 */ 717 NETWORK_TYPE_LTE, 718 719 /** 720 * Indicates that the network type is 5G NR. 721 */ 722 NETWORK_TYPE_NR 723 } 724 725 /** 726 * Describes the network registration state. 727 */ 728 export interface NetworkState { 729 /** 730 * Obtains the operator name in the long alphanumeric format of the registered network. 731 * 732 * @returns Returns the operator name in the long alphanumeric format as a string; 733 * returns an empty string if no operator name is obtained. 734 */ 735 longOperatorName: string; 736 737 /** 738 * Obtains the operator name in the short alphanumeric format of the registered network. 739 * 740 * @returns Returns the operator name in the short alphanumeric format as a string; 741 * returns an empty string if no operator name is obtained. 742 */ 743 shortOperatorName: string; 744 745 /** 746 * Obtains the PLMN code of the registered network. 747 * 748 * @returns Returns the PLMN code as a string; returns an empty string if no operator name is obtained. 749 */ 750 plmnNumeric: string; 751 752 /** 753 * Checks whether the device is roaming. 754 * 755 * @returns Returns {@code true} if the device is roaming; returns {@code false} otherwise. 756 */ 757 isRoaming: boolean; 758 759 /** 760 * Obtains the network registration status of the device. 761 * 762 * @returns Returns the network registration status {@code RegState}. 763 */ 764 regState: RegState; 765 766 /** 767 * Obtains the radio Access technology after config conversion. 768 * 769 * @returns Returns the radio Access technology {@code RadioTechnology}. 770 * @since 8 771 */ 772 cfgTech: RadioTechnology; 773 774 /** 775 * Obtains the NSA network registration status of the device. 776 * 777 * @returns Returns the NSA network registration status {@code NsaState}. 778 */ 779 nsaState: NsaState; 780 781 /** 782 * Obtains the status of CA. 783 * 784 * @returns Returns {@code true} if CA is actived; returns {@code false} otherwise. 785 */ 786 isCaActive: boolean; 787 788 /** 789 * Checks whether this device is allowed to make emergency calls only. 790 * 791 * @returns Returns {@code true} if this device is allowed to make emergency calls only; 792 * returns {@code false} otherwise. 793 */ 794 isEmergency: boolean; 795 } 796 797 /** 798 * Describes the network registration state. 799 */ 800 export enum RegState { 801 /** 802 * Indicates a state in which a device cannot use any service. 803 */ 804 REG_STATE_NO_SERVICE = 0, 805 806 /** 807 * Indicates a state in which a device can use services properly. 808 */ 809 REG_STATE_IN_SERVICE = 1, 810 811 /** 812 * Indicates a state in which a device can use only the emergency call service. 813 */ 814 REG_STATE_EMERGENCY_CALL_ONLY = 2, 815 816 /** 817 * Indicates that the cellular radio is powered off. 818 */ 819 REG_STATE_POWER_OFF = 3 820 } 821 822 /** 823 * Describes the nsa state. 824 */ 825 export enum NsaState { 826 /** 827 * Indicates that a device is idle under or is connected to an LTE cell that does not support NSA. 828 */ 829 NSA_STATE_NOT_SUPPORT = 1, 830 831 /** 832 * Indicates that a device is idle under an LTE cell supporting NSA but not NR coverage detection. 833 */ 834 NSA_STATE_NO_DETECT = 2, 835 836 /** 837 * Indicates that a device is connected to an LTE network under an LTE cell 838 * that supports NSA and NR coverage detection. 839 */ 840 NSA_STATE_CONNECTED_DETECT = 3, 841 842 /** 843 * Indicates that a device is idle under an LTE cell supporting NSA and NR coverage detection. 844 */ 845 NSA_STATE_IDLE_DETECT = 4, 846 847 /** 848 * Indicates that a device is connected to an LTE + NR network under an LTE cell that supports NSA. 849 */ 850 NSA_STATE_DUAL_CONNECTED = 5, 851 852 /** 853 * Indicates that a device is idle under or is connected to an NG-RAN cell while being attached to 5GC. 854 */ 855 NSA_STATE_SA_ATTACHED = 6 856 } 857 858 /** 859 * @systemapi Hide this for inner system use. 860 * @since 8 861 */ 862 export interface CellInformation { 863 /** 864 * Obtains the network type of the serving cell. 865 * 866 * <p>An application can call this method to determine the network type that the child class uses. 867 * 868 * @returns Returns the the network type of the serving cell. 869 */ 870 networkType: NetworkType; 871 872 /** 873 * Obtains the camp-on status of the serving cell. 874 * 875 * @returns Returns {@code true} if the user equipment (UE) is camped on the cell; returns 876 * {@code false} otherwise. 877 */ 878 isCamped: boolean; 879 880 /** 881 * Obtains the timestamp when the cell information is obtained. 882 * 883 * @returns Returns a timestamp since boot, in nanoseconds. 884 */ 885 timeStamp: number; 886 887 /** 888 * An abstract method of the parent class whose implementation depends on the child classes. 889 * Returned child class objects vary according to the network type. 890 * 891 * @returns Returns child class objects specific to the network type. 892 */ 893 signalInformation: SignalInformation; 894 895 data: CdmaCellInformation | GsmCellInformation | LteCellInformation | NrCellInformation | TdscdmaCellInformation 896 | WcdmaCellInformation; 897 } 898 899 /** 900 * @systemapi Hide this for inner system use. 901 * @since 8 902 */ 903 export interface CdmaCellInformation { 904 baseId: number; 905 latitude: number; 906 longitude: number; 907 nid: number; 908 sid: number; 909 } 910 911 /** 912 * @systemapi Hide this for inner system use. 913 * @since 8 914 */ 915 export interface GsmCellInformation { 916 lac: number; 917 cellId: number; 918 arfcn: number; 919 bsic: number; 920 mcc: string; 921 mnc: string; 922 } 923 924 /** 925 * @systemapi Hide this for inner system use. 926 * @since 8 927 */ 928 export interface LteCellInformation { 929 cgi: number; 930 pci: number; 931 tac: number; 932 earfcn: number; 933 bandwidth: number; 934 mcc: string; 935 mnc: string; 936 isSupportEndc: boolean; 937 } 938 939 /** 940 * @systemapi Hide this for inner system use. 941 * @since 8 942 */ 943 export interface NrCellInformation { 944 nrArfcn: number; 945 pci: number; 946 tac: number; 947 nci: number; 948 mcc: string; 949 mnc: string; 950 } 951 952 /** 953 * @systemapi Hide this for inner system use. 954 * @since 8 955 */ 956 export interface TdscdmaCellInformation { 957 lac: number; 958 cellId: number; 959 cpid: number; 960 uarfcn: number; 961 mcc: string; 962 mnc: string; 963 } 964 965 /** 966 * @systemapi Hide this for inner system use. 967 * @since 8 968 */ 969 export interface WcdmaCellInformation { 970 lac: number; 971 cellId: number; 972 psc: number; 973 uarfcn: number; 974 mcc: string; 975 mnc: string; 976 } 977 978 /** 979 * @systemapi Hide this for inner system use. 980 * @since 8 981 */ 982 export enum NrOptionMode { 983 /** Indicates unknown NR networking mode. */ 984 NR_OPTION_UNKNOWN, 985 986 /** Indicates that the NR networking mode is NSA only. */ 987 NR_OPTION_NSA_ONLY, 988 989 /** Indicates that the NR networking mode is SA only. */ 990 NR_OPTION_SA_ONLY, 991 992 /** Indicates that the NR networking mode is NSA and SA. */ 993 NR_OPTION_NSA_AND_SA, 994 } 995 996 /** 997 * @systemapi Hide this for inner system use. 998 */ 999 export interface NetworkSearchResult { 1000 isNetworkSearchSuccess: boolean; 1001 networkSearchResult: Array<NetworkInformation>; 1002 } 1003 1004 /** 1005 * @systemapi Hide this for inner system use. 1006 */ 1007 export interface NetworkInformation { 1008 operatorName: string; 1009 operatorNumeric: string; 1010 state: NetworkInformationState; 1011 radioTech: string; 1012 } 1013 1014 /** 1015 * @systemapi Hide this for inner system use. 1016 */ 1017 export enum NetworkInformationState { 1018 /** Indicates that the network state is unknown. */ 1019 NETWORK_UNKNOWN, 1020 1021 /** Indicates that the network is available for registration. */ 1022 NETWORK_AVAILABLE, 1023 1024 /** Indicates that you have already registered with the network. */ 1025 NETWORK_CURRENT, 1026 1027 /** Indicates that the network is unavailable for registration. */ 1028 NETWORK_FORBIDDEN 1029 } 1030 1031 /** 1032 * @systemapi Hide this for inner system use. 1033 */ 1034 export interface NetworkSelectionModeOptions { 1035 slotId: number; 1036 selectMode: NetworkSelectionMode; 1037 networkInformation: NetworkInformation; 1038 resumeSelection: boolean; 1039 } 1040 1041 export enum NetworkSelectionMode { 1042 /** Unknown network selection modes. */ 1043 NETWORK_SELECTION_UNKNOWN, 1044 1045 /** Automatic network selection modes. */ 1046 NETWORK_SELECTION_AUTOMATIC, 1047 1048 /** Manual network selection modes. */ 1049 NETWORK_SELECTION_MANUAL 1050 } 1051 1052 /** 1053 * @systemapi Hide this for inner system use. 1054 * @since 9 1055 */ 1056 export enum ImsRegState { 1057 /** Indicates that the ims service is not registered. */ 1058 IMS_UNREGISTERED, 1059 1060 /** Indicates that the ims service has been registered. */ 1061 IMS_REGISTERED, 1062 } 1063 1064 /** 1065 * @systemapi Hide this for inner system use. 1066 * @since 9 1067 */ 1068 export enum ImsRegTech { 1069 /** Indicates that ims has no registered technology. */ 1070 REGISTRATION_TECH_NONE, 1071 1072 /** Indicates that ims registers LTE technology. */ 1073 REGISTRATION_TECH_LTE, 1074 1075 /** Indicates that ims registers IWLAN technology. */ 1076 REGISTRATION_TECH_IWLAN, 1077 1078 /** Indicates that ims registers NR technology. */ 1079 REGISTRATION_TECH_NR, 1080 } 1081 1082 /** 1083 * @systemapi Hide this for inner system use. 1084 * @since 9 1085 */ 1086 export interface ImsRegInfo { 1087 /** Indicates the registration status of the ims service. */ 1088 imsRegState: ImsRegState; 1089 1090 /** Indicates the mode of ims radio technology. */ 1091 imsRegTech: ImsRegTech; 1092 } 1093 1094 /** 1095 * @systemapi Hide this for inner system use. 1096 * @since 9 1097 */ 1098 export enum ImsServiceType { 1099 /** Indicates voice service. */ 1100 TYPE_VOICE, 1101 1102 /** Indicates video service. */ 1103 TYPE_VIDEO, 1104 1105 /** Indicates UT service. */ 1106 TYPE_UT, 1107 1108 /** Indicates SMS service. */ 1109 TYPE_SMS, 1110 } 1111} 1112 1113export default radio; 1114