diff --git a/@ohos.telephony.call.d.ts b/@ohos.telephony.call.d.ts deleted file mode 100755 index a6d8fe57e08ff0926d2af2250d7a9f6fe16d28f8..0000000000000000000000000000000000000000 --- a/@ohos.telephony.call.d.ts +++ /dev/null @@ -1,83 +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 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; - } -} - -export default call; \ No newline at end of file diff --git a/@ohos.telephony.data.d.ts b/@ohos.telephony.data.d.ts deleted file mode 100755 index ffa1a3f853a26c3178010eae8a548385f516f617..0000000000000000000000000000000000000000 --- a/@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/@ohos.telephony.observer.d.ts b/@ohos.telephony.observer.d.ts deleted file mode 100755 index 2e07a4b7b3606a63a362217e06cd64252c0cdde2..0000000000000000000000000000000000000000 --- a/@ohos.telephony.observer.d.ts +++ /dev/null @@ -1,117 +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"; -import radio from "./@ohos.telephony.radio"; -import data from "./@ohos.telephony.data"; -import call from "./@ohos.telephony.call"; - -/** - * Monitors telephony state updates of a device, including updates of the network state, - * signal strength, call state, the data link connection state and others. - * - * @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; - - /** - * Called when the network state corresponding to a monitored {@code slotId} updates. - * - *

Applications must have the {@code ohos.permission.GET_NETWORK_INFO} permission - * to register this event. - * - * @param type networkStateChange - * @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 an instance of the {@code NetworkState} class. - */ - function on(type: 'networkStateChange', callback: AsyncCallback): void; - function on(type: 'networkStateChange', options: { slotId: number }, callback: AsyncCallback): void; - - function once(type: 'networkStateChange', callback: AsyncCallback): void; - function once(type: 'networkStateChange', options: { slotId: number }, callback: AsyncCallback): void; - - function off(type: 'networkStateChange', callback?: AsyncCallback): void; - - /** - * Called when the signal strength corresponding to a monitored {@code slotId} updates. - * - * @param type signalInfoChange - * @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 an array of instances of the classes derived from {@link SignalInformation}. - */ - function on(type: 'signalInfoChange', callback: AsyncCallback>): void; - function on(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; - - function once(type: 'signalInfoChange', callback: AsyncCallback>): void; - function once(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; - - 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. - * - * @param type callStateChange - * @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 call state, and number Indicates the called number. - * The value of number is an empty string if the application does not have - * the {@code ohos.permission#READ_CALL_LOG READ_CALL_LOG} permission. - */ - function on(type: 'callStateChange', callback: AsyncCallback<{ state: CallState, number: String }>): void; - function on(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; - - function once(type: 'callStateChange', callback: AsyncCallback<{ state: CallState, number: String }>): void; - function once(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; - - function off(type: 'callStateChange', callback?: AsyncCallback<{ state: CallState, number: String }>): void; -} - -export default observer; \ No newline at end of file diff --git a/@ohos.telephony.radio.d.ts b/@ohos.telephony.radio.d.ts deleted file mode 100755 index 139ae0be8bdb25baac28f7465136e55e300c2d59..0000000000000000000000000000000000000000 --- a/@ohos.telephony.radio.d.ts +++ /dev/null @@ -1,330 +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 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 - } -} - -export default radio; \ No newline at end of file diff --git a/@ohos.telephony.sim.d.ts b/@ohos.telephony.sim.d.ts deleted file mode 100755 index e586e47276fb3c7cfb8deb06992e45a98b72ee96..0000000000000000000000000000000000000000 --- a/@ohos.telephony.sim.d.ts +++ /dev/null @@ -1,118 +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 applications with APIs for obtaining SIM card status, card file information, and card specifications. - * SIM cards include SIM, USIM, and CSIM cards. - * - * @since 6 - */ -declare namespace sim { - /** - * Obtains the ISO country code of the SIM card in a specified slot. - * - * @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 country code defined in ISO 3166-2; returns an empty string if no SIM card is inserted. - */ - function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback): void; - function getISOCountryCodeForSim(slotId: number): Promise; - - /** - * Obtains the home PLMN number of the SIM card in a specified slot. - * - *

The value is recorded in the SIM card and is irrelevant to the network - * with which the SIM card is currently registered. - * - * @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 PLMN number; returns an empty string if no SIM card is inserted. - */ - function getSimOperatorNumeric(slotId: number, callback: AsyncCallback): void; - function getSimOperatorNumeric(slotId: number): Promise; - - /** - * Obtains the service provider name (SPN) of the SIM card in a specified slot. - * - *

The value is recorded in the EFSPN file of the SIM card and is irrelevant to the network - * with which the SIM card is currently registered. - * - * @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 SPN; returns an empty string if no SIM card is inserted or - * no EFSPN file in the SIM card. - */ - function getSimSpn(slotId: number, callback: AsyncCallback): void; - function getSimSpn(slotId: number): Promise; - - /** - * Obtains the state of the SIM card in a specified slot. - * - * @param slotId Indicates the card slot index number, - * ranging from {@code 0} to the maximum card slot index number supported by the device. - * @param callback Returns one of the following SIM card states: - *

- */ - function getSimState(slotId: number, callback: AsyncCallback): void; - function getSimState(slotId: number): Promise; - - export enum SimState { - /** - * Indicates unknown SIM card state, that is, the accurate status cannot be obtained. - */ - SIM_STATE_UNKNOWN, - - /** - * Indicates that the SIM card is in the not present state, that is, no SIM card is inserted - * into the card slot. - */ - SIM_STATE_NOT_PRESENT, - - /** - * Indicates that the SIM card is in the locked state, that is, the SIM card is locked by the - * personal identification number (PIN)/PIN unblocking key (PUK) or network. - */ - SIM_STATE_LOCKED, - - /** - * Indicates that the SIM card is in the not ready state, that is, the SIM card is in position - * but cannot work properly. - */ - SIM_STATE_NOT_READY, - - /** - * Indicates that the SIM card is in the ready state, that is, the SIM card is in position and - * is working properly. - */ - SIM_STATE_READY, - - /** - * Indicates that the SIM card is in the loaded state, that is, the SIM card is in position and - * is working properly. - */ - SIM_STATE_LOADED - } -} - -export default sim; \ No newline at end of file diff --git a/@ohos.telephony.sms.d.ts b/@ohos.telephony.sms.d.ts deleted file mode 100755 index a1b162bf6d4fb78572513ff812d1d28f2df958b9..0000000000000000000000000000000000000000 --- a/@ohos.telephony.sms.d.ts +++ /dev/null @@ -1,155 +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 the capabilities and methods for obtaining Short Message Service (SMS) management objects. - * - * @since 6 - */ -declare namespace sms { - /** - * Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. - * - *

After receiving the original PDU data, the system creates an SMS message instance according to the specified - * SMS protocol. - * - * @param pdu Indicates the original data, which is obtained from the received SMS. - * @param specification Indicates the SMS protocol type. The value {@code 3gpp} indicates GSM/UMTS/LTE SMS, - * and the value {@code 3gpp2} indicates CDMA/LTE SMS. - * @param callback Returns an SMS message instance; returns {@code null} if {@code pdu} is empty or - * {@code specification} is not supported. - */ - function createMessage(pdu: Array, specification: string, callback: AsyncCallback): void; - function createMessage(pdu: Array, specification: string): Promise; - - /** - * Sends a text or data SMS message. - * - *

This method checks whether the length of an SMS message exceeds the maximum length. If the - * maximum length is exceeded, the SMS message is split into multiple parts and sent separately. - *

You need to obtain the following permission before calling this method: - * {@code ohos.permission.SEND_MESSAGES} - * - * @param options Indicates the parameters and callback for sending the SMS message. - */ - function sendMessage(options: SendMessageOptions): void; - - export interface ShortMessage { - /** Indicates the SMS message body. */ - visibleMessageBody: string; - /** Indicates the address of the sender, which is to be displayed on the UI. */ - visibleRawAddress: string; - /** Indicates the SMS type. */ - messageClass: ShortMessageClass; - /** Indicates the protocol identifier. */ - protocolId: number; - /** Indicates the short message service center (SMSC) address. */ - scAddress: string; - /** Indicates the SMSC timestamp. */ - scTimestamp: number; - /** Indicates whether the received SMS is a "replace short message". */ - isReplaceMessage: boolean; - /** Indicates whether the received SMS contains "TP-Reply-Path". */ - hasReplyPath: boolean; - /** Indicates Protocol Data Units (PDUs) from an SMS message. */ - pdu: Array; - /** - * Indicates the SMS message status from the SMS-STATUS-REPORT message sent by the - * Short Message Service Center (SMSC). - */ - status: number; - /** Indicates whether the current message is SMS-STATUS-REPORT. */ - isSmsStatusReportMessage: boolean; - /** Indicates the email message address. */ - emailAddress: string; - /** Indicates the email message body. */ - emailMessageBody: string; - /** Indicates the user data excluding the data header. */ - userRawData: Array; - /** Indicates whether the received SMS is an email message. */ - isEmailMessage: boolean; - } - - export enum ShortMessageClass { - /** Indicates an unknown type. */ - UNKNOWN, - /** Indicates an instant message, which is displayed immediately after being received. */ - INSTANT_MESSAGE, - /** Indicates an SMS message that can be stored on the device or SIM card based on the storage status. */ - OPTIONAL_MESSAGE, - /** Indicates an SMS message containing SIM card information, which is to be stored in a SIM card. */ - SIM_MESSAGE, - /** Indicates an SMS message to be forwarded to another device. */ - FORWARD_MESSAGE - } - - export interface SendMessageOptions { - /** Indicates the ID of the SIM card slot used for sending the SMS message. */ - slotId: number; - /** Indicates the address to which the SMS message is sent. */ - destinationHost: string; - /** Indicates the SMSC address. If the value is {@code null}, the default SMSC address of the SIM card*/ - serviceCenter?: string; - /** If the content is a string, this is a short message. If the content is a byte array, this is a data message. */ - content: string | Array; - /** If send data message, destinationPort is mandatory. Otherwise is optional. */ - destinationPort?: number; - /** Indicates the callback invoked after the SMS message is sent. */ - sendCallback?: AsyncCallback; - /** Indicates the callback invoked after the SMS message is delivered. */ - deliveryCallback?: AsyncCallback; - } - - export interface ISendShortMessageCallback { - /** Indicates the SMS message sending result. */ - result: SendSmsResult; - /** Indicates the URI to store the sent SMS message. */ - url: string; - /** Specifies whether this is the last part of a multi-part SMS message. */ - isLastPart: boolean; - } - - export interface IDeliveryShortMessageCallback { - /** Indicates the SMS delivery report. */ - pdu: Array; - } - - export enum SendSmsResult { - /** - * Indicates that the SMS message is successfully sent. - */ - SEND_SMS_SUCCESS = 0, - - /** - * Indicates that sending the SMS message fails due to an unknown reason. - */ - SEND_SMS_FAILURE_UNKNOWN = 1, - - /** - * Indicates that sending the SMS fails because the modem is powered off. - */ - SEND_SMS_FAILURE_RADIO_OFF = 2, - - /** - * Indicates that sending the SMS message fails because the network is unavailable - * or does not support sending or reception of SMS messages. - */ - SEND_SMS_FAILURE_SERVICE_UNAVAILABLE = 3 - } -} - -export default sms; \ No newline at end of file