diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index d1c0fe0b187625e47654b52e43e97561fd44b2b1..caa0d0555ca68894d2eabe641d155159f488a2d9 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -13,9 +13,11 @@ * limitations under the License. */ -import {AsyncCallback} from "./basic"; +import { Callback } from "./basic"; import radio from "./@ohos.telephony.radio"; +import data from "./@ohos.telephony.data"; import call from "./@ohos.telephony.call"; +import { SimState } from "./@ohos.telephony.sim"; /** * Monitors telephony state updates of a device, including updates of the network state, @@ -24,9 +26,13 @@ import call from "./@ohos.telephony.call"; * @since 6 */ declare namespace observer { - type NetworkState = radio.NetworkState; - type SignalInformation = radio.SignalInformation; - type CallState = call.CallState; + 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. @@ -39,13 +45,13 @@ declare namespace observer { * 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 on(type: 'networkStateChange', callback: Callback): void; + function on(type: 'networkStateChange', options: { slotId: number }, callback: Callback): void; - function once(type: 'networkStateChange', callback: AsyncCallback): void; - function once(type: 'networkStateChange', options: { slotId: number }, callback: AsyncCallback): void; + function once(type: 'networkStateChange', callback: Callback): void; + function once(type: 'networkStateChange', options: { slotId: number }, callback: Callback): void; - function off(type: 'networkStateChange', callback?: AsyncCallback): void; + function off(type: 'networkStateChange', callback?: Callback): void; /** * Called when the signal strength corresponding to a monitored {@code slotId} updates. @@ -55,15 +61,15 @@ declare namespace observer { * 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', callback: Callback>): void; function on(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; + callback: Callback>): void; - function once(type: 'signalInfoChange', callback: AsyncCallback>): void; + function once(type: 'signalInfoChange', callback: Callback>): void; function once(type: 'signalInfoChange', options: { slotId: number }, - callback: AsyncCallback>): void; + callback: Callback>): void; - function off(type: 'signalInfoChange', callback?: AsyncCallback>): void; + function off(type: 'signalInfoChange', callback?: Callback>): void; /** * Receives a call state change. This callback is invoked when the call state of a specified card updates @@ -76,15 +82,42 @@ declare namespace observer { * 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', callback: Callback<{ state: CallState, number: String }>): void; function on(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; + callback: Callback<{ state: CallState, number: String }>): void; - function once(type: 'callStateChange', callback: AsyncCallback<{ state: CallState, number: String }>): void; + function once(type: 'callStateChange', callback: Callback<{ state: CallState, number: String }>): void; function once(type: 'callStateChange', options: { slotId: number }, - callback: AsyncCallback<{ state: CallState, number: String }>): void; + callback: Callback<{ state: CallState, number: String }>): void; - function off(type: 'callStateChange', callback?: AsyncCallback<{ state: CallState, number: String }>): void; + function off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: String }>): void; } + /** + * Receives a sim state change. This callback is invoked when the sim state of a specified card updates + * and the observer is added to monitor the updates. + * + * @param type simStateChange + * @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 sim state, and reason Indicates the cause of the change. + * The value of reason is an empty string if the application does not have + */ + function on(type: 'simStateChange', callback: Callback): void; + function on(type: 'simStateChange', options: { slotId: number }, + callback: Callback): void; + function once(type: 'simStateChange', callback: Callback): void; + function once(type: 'simStateChange', options: { slotId: number }, + callback: Callback): void; + function off(type: 'simStateChange', callback?: Callback): void; + + export interface SimStateData { + state: SimState, + reason: LockReason + } + export enum LockReason { + SIM_NONE, + SIM_PIN, + SIM_PUK, + } export default observer; \ No newline at end of file diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index bbc4dcfc71deb04e96e1e5bf2e8328c822a6f7b7..3da618d79beb0c2a1b6acc1be1e04dfea8d19657 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -142,6 +142,13 @@ declare namespace radio { function turnOffRadio(callback: AsyncCallback): void; function turnOffRadio(): Promise; + /** + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getIMEI(callback: AsyncCallback): void; + function getIMEI(slotId: number, callback: AsyncCallback): void; + function getIMEI(slotId?: number): Promise; + /** * Describes the radio access technology. */ diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts index ed9652a51a98d1674559b03443969de12edc360a..3f4956b3b6c6aded41cc6bdbeb8d07f429f4099a 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -105,6 +105,21 @@ declare namespace sim { function getSimIccId(slotId: number, callback: AsyncCallback): void; function getSimIccId(slotId: number): Promise; + /** + * Obtains the MSISDN of the SIM card in a specified slot. + * The MSISDN is recorded in the EFMSISDN file of the SIM card. + * + *

Requires Permission: {@code ohos.permission.GET_TELEPHONY_STATE}. + * + * @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 MSISDN; returns an empty string if no SIM card is inserted or + * no MSISDN is recorded in the EFMSISDN file. + * @permission ohos.permission.GET_TELEPHONY_STATE + */ + function getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void; + function getSimTelephoneNumber(slotId: number): Promise; + /** * Obtains the Group Identifier Level 1 (GID1) of the SIM card in a specified slot. * The GID1 is recorded in the EFGID1 file of the SIM card. @@ -127,6 +142,16 @@ declare namespace sim { function getIMSI(slotId: number, callback: AsyncCallback): void; function getIMSI(slotId: number): Promise; + /** + * Checks whether a SIM card is inserted 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 true if a SIM card is inserted; return false otherwise. + */ + function hasSimCard(slotId: number, callback: AsyncCallback): void; + function hasSimCard(slotId: number): Promise; + /** * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. @@ -174,6 +199,30 @@ declare namespace sim { */ function setLockState(slotId: number, pin: string, enable: number, callback: AsyncCallback): void; function setLockState(slotId: number, pin: string, enable: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function queryIccDiallingNumbers(slotId: number, type: number, callback: AsyncCallback>): void; + function queryIccDiallingNumbers(slotId: number, type: number): Promise>; + + /** + * @systemapi Hide this for inner system use. + */ + function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; + function addIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function delIccDiallingNumbers(slotId: number, type: number, index: number, callback :AsyncCallback): void; + function delIccDiallingNumbers(slotId: number, type: number, index: number): Promise; + + /** + * @systemapi Hide this for inner system use. + */ + function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number, callback: AsyncCallback): void; + function updateIccDiallingNumbers(slotId: number, type: number, diallingNumbers: DiallingNumbersInfo, index: number): Promise; /** * @systemapi Hide this for inner system use. @@ -194,6 +243,15 @@ declare namespace sim { remain?: number, /* Operations remaining */ } + /** + * @systemapi Hide this for inner system use. + */ + export interface DiallingNumbersInfo { + recordNumber: number, + alphaTag: string, + number: string, + } + export enum SimState { /** * Indicates unknown SIM card state, that is, the accurate status cannot be obtained.