diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts old mode 100755 new mode 100644 index a6d8fe57e08ff0926d2af2250d7a9f6fe16d28f8..25680a731fc83f8fdd50388c98518d1fd6a12325 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -1,83 +1,338 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides methods related to call management. - * - * @since 6 - */ -declare namespace call { - /** - * Makes a call. - * - *

Applications must have the {@code ohos.permission.PLACE_CALL} permission to call this method. - * - * @param phoneNumber Indicates the called number. - * @param options Indicates additional information carried in the call. - * @param callback Returns {@code true} if the call request is successful; returns {@code false} otherwise. - * Note that the value {@code true} indicates only the successful processing of the request; it does not mean - * that the call is or can be connected. - */ - function dial(phoneNumber: string, callback: AsyncCallback): void; - function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; - function dial(phoneNumber: string, options?: DialOptions): Promise; - - /** - * Obtains the call state. - * - *

If an incoming call is ringing or waiting, the system returns {@code CallState#CALL_STATE_RINGING}. - * If at least one call is in the active, hold, or dialing state, the system returns - * {@code CallState#CALL_STATE_OFFHOOK}. - * In other cases, the system returns {@code CallState#CALL_STATE_IDLE}. - * - * @param callback Returns the call state. - */ - function getCallState(callback: AsyncCallback): void; - function getCallState(): Promise; - - export enum CallState { - /** - * Indicates an invalid state, which is used when the call state fails to be obtained. - */ - CALL_STATE_UNKNOWN = -1, - - /** - * Indicates that there is no ongoing call. - */ - CALL_STATE_IDLE = 0, - - /** - * Indicates that an incoming call is ringing or waiting. - */ - CALL_STATE_RINGING = 1, - - /** - * Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call - * ringing or waiting. - */ - CALL_STATE_OFFHOOK = 2 - } - - export interface DialOptions { - /** - * boolean means whether the call to be made is a video call. The value {@code false} indicates a voice call. - */ - extras?: boolean; - } -} - +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback, Callback} from "./basic"; + +/** + * Provides methods related to call management. + * + * @since 6 + * @sysCap SystemCapability.Telephony.DCall + */ +declare namespace call { + /** + * Makes a call. + * + *

Applications must have the {@code ohos.permission.PLACE_CALL} permission to call this method. + * + * @param phoneNumber Indicates the called number. + * @param options Indicates additional information carried in the call. + * @param callback Returns {@code true} if the call request is successful; returns {@code false} otherwise. + * Note that the value {@code true} indicates only the successful processing of the request; it does not mean + * that the call is or can be connected. + * @permission ohos.permission.PLACE_CALL + */ + function dial(phoneNumber: string, callback: AsyncCallback): void; + function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; + function dial(phoneNumber: string, options?: DialOptions): Promise; + + /** + * Checks whether a call is ongoing. + * + * @param callback Returns {@code true} if at least one call is not in the {@link CallState#CALL_STATE_IDLE} + * state; returns {@code false} otherwise. + */ + function hasCall(callback: AsyncCallback): void; + function hasCall(): Promise; + + /** + * Obtains the call state. + * + *

If an incoming call is ringing or waiting, the system returns {@code CallState#CALL_STATE_RINGING}. + * If at least one call is in the active, hold, or dialing state, the system returns + * {@code CallState#CALL_STATE_OFFHOOK}. + * In other cases, the system returns {@code CallState#CALL_STATE_IDLE}. + * + * @param callback Returns the call state. + */ + function getCallState(callback: AsyncCallback): void; + function getCallState(): Promise; + + /** + * Checks whether a phone number is on the emergency number list. + * + * @param phoneNumber Indicates the phone number to check. + * @param callback Returns {@code true} if the phone number is on the emergency number list; + * returns {@code false} otherwise. + * @since 7 + */ + function isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback): void; + function isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback): void; + function isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise; + + /** + * Formats a phone number according to the Chinese Telephone Code Plan. Before the formatting, + * a phone number is in the format of country code (if any) + 3-digit service provider code + * + 4-digit area code + 4-digit subscriber number. After the formatting, + * each part is separated by a space. + * + * @param phoneNumber Indicates the phone number to format. + * @param callback Returns the phone number after being formatted; returns an empty string + * if the input phone number is invalid. + * @since 7 + */ + function formatPhoneNumber(phoneNumber: string, callback: AsyncCallback): void; + function formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback): void; + function formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise; + + /** + * Formats a phone number into an E.164 representation. + * + * @param phoneNumber Indicates the phone number to format. + * @param countryCode Indicates a two-digit country code defined in ISO 3166-1. + * @param callback Returns an E.164 number; returns an empty string if the input phone number is invalid. + * @since 7 + */ + function formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback): void; + function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function answer(callId: number, callback: AsyncCallback): void; + function answer(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function hangup(callId: number, callback: AsyncCallback): void; + function hangup(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function reject(callId: number, callback: AsyncCallback): void; + function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; + function reject(callId: number, options?: RejectMessageOptions): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function holdCall(callId: number, callback: AsyncCallback): void; + function holdCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function unHoldCall(callId: number, callback: AsyncCallback): void; + function unHoldCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function switchCall(callId: number, callback: AsyncCallback): void; + function switchCall(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function combineConference(callId: number, callback: AsyncCallback): void; + function combineConference(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getMainCallId(callId: number, callback: AsyncCallback): void; + function getMainCallId(callId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getSubCallIdList(callId: number, callback: AsyncCallback>): void; + function getSubCallIdList(callId: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getCallIdListForConference(callId: number, callback: AsyncCallback>): void; + function getCallIdListForConference(callId: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function getCallWaitingStatus(slotId: number, callback: AsyncCallback): void; + function getCallWaitingStatus(slotId: number): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback): void; + function setCallWaiting(slotId: number, activate: boolean): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function startDTMF(callId: number, character: string, callback: AsyncCallback): void; + function startDTMF(callId: number, character: string): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function stopDTMF(callId: number, callback: AsyncCallback): void; + function stopDTMF(callId: number): Promise; + + /** + * @permission ohos.permission.SET_TELEPHONY_STATE + * @systemapi Hide this for inner system use. + * @since 7 + */ + function isInEmergencyCall(callback: AsyncCallback): void; + function isInEmergencyCall(): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + function on(type: 'callDetailsChange', callback: Callback): void; + function off(type: 'callDetailsChange', callback?: Callback): void; + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface CallAttributeOptions { + accountNumber: string, + speakerphoneOn: boolean, + accountId: number, + videoState: VideoStateType, + startTime: number, + isEcc: boolean, + callType: CallType, + callId: number, + callState: DetailedCallState, + conferenceState: ConferenceState, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum ConferenceState { + TEL_CONFERENCE_IDLE = 0, + TEL_CONFERENCE_ACTIVE, + TEL_CONFERENCE_DISCONNECTING, + TEL_CONFERENCE_DISCONNECTED, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum CallType { + TYPE_CS = 0, // CS + TYPE_IMS = 1, // IMS + TYPE_OTT = 2, // OTT + TYPE_ERR_CALL = 3, // OTHER + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum VideoStateType { + TYPE_VOICE = 0, // Voice + TYPE_VIDEO, // Video + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum DetailedCallState { + CALL_STATUS_ACTIVE = 0, + CALL_STATUS_HOLDING, + CALL_STATUS_DIALING, + CALL_STATUS_ALERTING, + CALL_STATUS_INCOMING, + CALL_STATUS_WAITING, + CALL_STATUS_DISCONNECTED, + CALL_STATUS_DISCONNECTING, + CALL_STATUS_IDLE, + } + + export enum CallState { + /** + * Indicates an invalid state, which is used when the call state fails to be obtained. + */ + CALL_STATE_UNKNOWN = -1, + + /** + * Indicates that there is no ongoing call. + */ + CALL_STATE_IDLE = 0, + + /** + * Indicates that an incoming call is ringing or waiting. + */ + CALL_STATE_RINGING = 1, + + /** + * Indicates that a least one call is in the dialing, active, or hold state, and there is no new incoming call + * ringing or waiting. + */ + CALL_STATE_OFFHOOK = 2 + } + + export interface DialOptions { + /** + * boolean means whether the call to be made is a video call. The value {@code false} indicates a voice call. + */ + extras?: boolean; + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export interface RejectMessageOptions { + messageContent: string, + } + + /** + * @systemapi Hide this for inner system use. + * @since 7 + */ + export enum CallWaitingStatus { + CALL_WAITING_DISABLE = 0, + CALL_WAITING_ENABLE = 1 + } + + /** + * @since 7 + */ + export interface EmergencyNumberOptions { + slotId?: number; + } + + /** + * @since 7 + */ + export interface NumberFormatOptions { + countryCode?: string; + } +} + export default call; \ No newline at end of file diff --git a/api/@ohos.telephony.data.d.ts b/api/@ohos.telephony.data.d.ts deleted file mode 100755 index ffa1a3f853a26c3178010eae8a548385f516f617..0000000000000000000000000000000000000000 --- a/api/@ohos.telephony.data.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides methods related to cellular data services. - * - * @since 6 - */ -declare namespace data { - /** - * Obtains the connection state of the PS domain. - * - * @param slotId Indicates the ID of a card slot. - * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. - * @param callback Returns the connection state, which can be any of the following: - *

- */ - function getCellularDataState(callback: AsyncCallback): void; - function getCellularDataState(): Promise; - - /** - * Checks whether cellular data services are enabled. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @param callback Returns {@code true} if cellular data services are enabled; returns {@code false} otherwise. - */ - function isCellularDataEnabled(callback: AsyncCallback): void; - function isCellularDataEnabled(): Promise; - - /** - * Enables cellular data services. - * - * @hide Used for system app. - */ - function enableCellularData(callback: AsyncCallback): void; - function enableCellularData(): Promise; - - /** - * Diables cellular data services. - * - * @hide Used for system app. - */ - function disableCellularData(callback: AsyncCallback): void; - function disableCellularData(): Promise; - - /** - * Describes the cellular data link connection state. - */ - export enum DataConnectState { - /** - * Indicates that a cellular data link is unknown. - */ - DATA_STATE_UNKNOWN = -1, - - /** - * Indicates that a cellular data link is disconnected. - */ - DATA_STATE_DISCONNECTED = 0, - - /** - * Indicates that a cellular data link is being connected. - */ - DATA_STATE_CONNECTING = 1, - - /** - * Indicates that a cellular data link is connected. - */ - DATA_STATE_CONNECTED = 2, - - /** - * Indicates that a cellular data link is suspended. - */ - DATA_STATE_SUSPENDED = 3 - } -} - -export default data; \ No newline at end of file diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index 2e07a4b7b3606a63a362217e06cd64252c0cdde2..d1c0fe0b187625e47654b52e43e97561fd44b2b1 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -15,7 +15,6 @@ import {AsyncCallback} from "./basic"; import radio from "./@ohos.telephony.radio"; -import data from "./@ohos.telephony.data"; import call from "./@ohos.telephony.call"; /** @@ -25,13 +24,9 @@ import call from "./@ohos.telephony.call"; * @since 6 */ declare namespace observer { - export import NetworkState = radio.NetworkState; - export import SignalInformation = radio.SignalInformation; - export import CellInformation = radio.CellInformation; - export import DataConnectState = data.DataConnectState; - export import RatType = radio.RatType; - export import DataFlowType = data.DataFlowType; - export import CallState = call.CallState; + type NetworkState = radio.NetworkState; + type SignalInformation = radio.SignalInformation; + type CallState = call.CallState; /** * Called when the network state corresponding to a monitored {@code slotId} updates. @@ -70,28 +65,6 @@ declare namespace observer { function off(type: 'signalInfoChange', callback?: AsyncCallback>): void; - /** - * Called when the cellular data link connection state updates. - * - * @param type cellularDataConnectionStateChange - * @param options including slotId Indicates the ID of the target card slot. - * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2. - * @param callback including state Indicates the cellular data link connection state, - * and networkType Indicates the radio access technology for cellular data services. - */ - function on(type: 'cellularDataConnectionStateChange', - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - function on(type: 'cellularDataConnectionStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - - function once(type: 'cellularDataConnectionStateChange', - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - function once(type: 'cellularDataConnectionStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - - function off(type: 'cellularDataConnectionStateChange', - callback?: AsyncCallback<{ state: DataConnectState, network: RatType }>): void; - /** * Receives a call state change. This callback is invoked when the call state of a specified card updates * and the observer is added to monitor the updates. diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts old mode 100755 new mode 100644 index 139ae0be8bdb25baac28f7465136e55e300c2d59..bbc4dcfc71deb04e96e1e5bf2e8328c822a6f7b7 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -1,330 +1,453 @@ -/* -* Copyright (C) 2021 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import {AsyncCallback} from "./basic"; - -/** - * Provides interfaces for applications to obtain the radio access technology (RAT), network state, - * and signal information of the wireless cellular network (WCN). - * - * @since 6 - */ -declare namespace radio { - /** - * Obtains radio access technology (RAT) of the registered network. The system preferentially - * returns RAT of the packet service (PS) domain. If the device has not registered with the - * PS domain, the system returns RAT of the circuit service (CS) domain. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @param slotId Indicates the card slot index number, - * ranging from 0 to the maximum card slot index number supported by the device. - * @param callback Returns an integer indicating the RAT in use. The values are as follows: - *

- */ - function getRadioTech(slotId: number, - callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; - function getRadioTech(slotId: number): Promise<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>; - - /** - * Obtains the network state of the registered network. - * - *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * - * @param slotId Indicates the card slot index number, - * ranging from 0 to the maximum card slot index number supported by the device. - * @param callback Returns a {@code NetworkState} object. - */ - function getNetworkState(callback: AsyncCallback): void; - function getNetworkState(slotId: number, callback: AsyncCallback): void; - function getNetworkState(slotId?: number): Promise; - - /** - * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. - * - * @param slotId Indicates the card slot index number, ranging from 0 to the maximum card slot index number - * supported by the device. - * @param callback Returns the instance list of the child classes derived from {@link SignalInformation}. - */ - function getSignalInformation(slotId: number, callback: AsyncCallback>): void; - function getSignalInformation(slotId: number): Promise>; - - /** - * Describes the radio access technology. - */ - export enum RadioTechnology { - /** - * Indicates unknown radio access technology (RAT). - */ - RADIO_TECHNOLOGY_UNKNOWN = 0, - - /** - * Indicates that RAT is global system for mobile communications (GSM), including GSM, general packet - * radio system (GPRS), and enhanced data rates for GSM evolution (EDGE). - */ - RADIO_TECHNOLOGY_GSM = 1, - - /** - * Indicates that RAT is code division multiple access (CDMA), including Interim Standard 95 (IS95) and - * Single-Carrier Radio Transmission Technology (1xRTT). - */ - RADIO_TECHNOLOGY_1XRTT = 2, - - /** - * Indicates that RAT is wideband code division multiple address (WCDMA). - */ - RADIO_TECHNOLOGY_WCDMA = 3, - - /** - * Indicates that RAT is high-speed packet access (HSPA), including HSPA, high-speed downlink packet - * access (HSDPA), and high-speed uplink packet access (HSUPA). - */ - RADIO_TECHNOLOGY_HSPA = 4, - - /** - * Indicates that RAT is evolved high-speed packet access (HSPA+), including HSPA+ and dual-carrier - * HSPA+ (DC-HSPA+). - */ - RADIO_TECHNOLOGY_HSPAP = 5, - - /** - * Indicates that RAT is time division-synchronous code division multiple access (TD-SCDMA). - */ - RADIO_TECHNOLOGY_TD_SCDMA = 6, - - /** - * Indicates that RAT is evolution data only (EVDO), including EVDO Rev.0, EVDO Rev.A, and EVDO Rev.B. - */ - RADIO_TECHNOLOGY_EVDO = 7, - - /** - * Indicates that RAT is evolved high rate packet data (EHRPD). - */ - RADIO_TECHNOLOGY_EHRPD = 8, - - /** - * Indicates that RAT is long term evolution (LTE). - */ - RADIO_TECHNOLOGY_LTE = 9, - - /** - * Indicates that RAT is LTE carrier aggregation (LTE-CA). - */ - RADIO_TECHNOLOGY_LTE_CA = 10, - - /** - * Indicates that RAT is interworking WLAN (I-WLAN). - */ - RADIO_TECHNOLOGY_IWLAN = 11, - - /** - * Indicates that RAT is 5G new radio (NR). - */ - RADIO_TECHNOLOGY_NR = 12 - } - - export interface SignalInformation { - /** - * Obtains the network type corresponding to the signal. - */ - signalType: NetworkType; - - /** - * Obtains the signal level of the current network. - */ - signalLevel: number; - } - - /** - * Describes the network type. - */ - export enum NetworkType { - /** - * Indicates unknown network type. - */ - NETWORK_TYPE_UNKNOWN, - - /** - * Indicates that the network type is GSM. - */ - NETWORK_TYPE_GSM, - - /** - * Indicates that the network type is CDMA. - */ - NETWORK_TYPE_CDMA, - - /** - * Indicates that the network type is WCDMA. - */ - NETWORK_TYPE_WCDMA, - - /** - * Indicates that the network type is TD-SCDMA. - */ - NETWORK_TYPE_TDSCDMA, - - /** - * Indicates that the network type is LTE. - */ - NETWORK_TYPE_LTE, - - /** - * Indicates that the network type is 5G NR. - */ - NETWORK_TYPE_NR - } - - /** - * Describes the network registration state. - */ - export interface NetworkState { - /** - * Obtains the operator name in the long alphanumeric format of the registered network. - * - * @return Returns the operator name in the long alphanumeric format as a string; - * returns an empty string if no operator name is obtained. - */ - longOperatorName: string; - - /** - * Obtains the operator name in the short alphanumeric format of the registered network. - * - * @return Returns the operator name in the short alphanumeric format as a string; - * returns an empty string if no operator name is obtained. - */ - shortOperatorName: string; - - /** - * Obtains the PLMN code of the registered network. - * - * @return Returns the PLMN code as a string; returns an empty string if no operator name is obtained. - */ - plmnNumeric: string; - - /** - * Checks whether the device is roaming. - * - * @return Returns {@code true} if the device is roaming; returns {@code false} otherwise. - */ - isRoaming: boolean; - - /** - * Obtains the network registration status of the device. - * - * @return Returns the network registration status {@code RegState}. - */ - regState: RegState; - - /** - * Obtains the NSA network registration status of the device. - * - * @return Returns the NSA network registration status {@code NsaState}. - */ - nsaState: NsaState; - - /** - * Obtains the status of CA. - * - * @return Returns {@code true} if CA is actived; returns {@code false} otherwise. - */ - isCaActive: boolean; - - /** - * Checks whether this device is allowed to make emergency calls only. - * - * @return Returns {@code true} if this device is allowed to make emergency calls only; - * returns {@code false} otherwise. - */ - isEmergency: boolean; - } - - /** - * Describes the network registration state. - */ - export enum RegState { - /** - * Indicates a state in which a device cannot use any service. - */ - REG_STATE_NO_SERVICE = 0, - - /** - * Indicates a state in which a device can use services properly. - */ - REG_STATE_IN_SERVICE = 1, - - /** - * Indicates a state in which a device can use only the emergency call service. - */ - REG_STATE_EMERGENCY_CALL_ONLY = 2, - - /** - * Indicates that the cellular radio is powered off. - */ - REG_STATE_POWER_OFF = 3 - } - - /** - * Describes the nsa state. - */ - export enum NsaState { - /** - * Indicates that a device is idle under or is connected to an LTE cell that does not support NSA. - */ - NSA_STATE_NOT_SUPPORT = 1, - - /** - * Indicates that a device is idle under an LTE cell supporting NSA but not NR coverage detection. - */ - NSA_STATE_NO_DETECT = 2, - - /** - * Indicates that a device is connected to an LTE network under an LTE cell - * that supports NSA and NR coverage detection. - */ - NSA_STATE_CONNECTED_DETECT = 3, - - /** - * Indicates that a device is idle under an LTE cell supporting NSA and NR coverage detection. - */ - NSA_STATE_IDLE_DETECT = 4, - - /** - * Indicates that a device is connected to an LTE + NR network under an LTE cell that supports NSA. - */ - NSA_STATE_DUAL_CONNECTED = 5, - - /** - * Indicates that a device is idle under or is connected to an NG-RAN cell while being attached to 5GC. - */ - NSA_STATE_SA_ATTACHED = 6 - } -} - +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import {AsyncCallback} from "./basic"; + +/** + * Provides interfaces for applications to obtain the network state, cell information, signal information, + * and device ID of the wireless cellular network (WCN), and provides a callback registration mechanism to + * listen for changes of the network, cell, and signal status of the WCN. + * + * @since 6 + * @sysCap SystemCapability.Telephony.Telephony + */ +declare namespace radio { + /** + * Obtains radio access technology (RAT) of the registered network. The system + * returns RAT of the packet service (PS) and circuit service (CS) domain. + * + *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. + * + * @param slotId Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param callback Returns an integer indicating the RAT in use. The values are as follows: + *

+ * @permission ohos.permission.GET_NETWORK_INFO + */ + function getRadioTech(slotId: number, + callback: AsyncCallback<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void; + function getRadioTech(slotId: number): Promise<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>; + + /** + * Obtains the network state of the registered network. + * + *

Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. + * + * @param slotId Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param callback Returns a {@code NetworkState} object. + * @permission ohos.permission.GET_NETWORK_INFO + */ + function getNetworkState(callback: AsyncCallback): void; + function getNetworkState(slotId: number, callback: AsyncCallback): void; + function getNetworkState(slotId?: number): Promise; + + /** + * Obtains the network search mode of the SIM card in a specified slot. + * + * @param slotId Indicates the ID of the SIM card slot. + * @param callback Returns the network search mode of the SIM card. Available values are as follows: + *