From f13e5c309dd02d5596439a00a6da19efba525226 Mon Sep 17 00:00:00 2001 From: chentao Date: Wed, 17 Nov 2021 15:54:37 +0800 Subject: [PATCH] update sim/observer/radio.d.ts Signed-off-by: chentao --- api/@ohos.telephony.observer.d.ts | 63 ++++++++++++++++++++--------- api/@ohos.telephony.radio.d.ts | 15 +++++++ api/@ohos.telephony.sim.d.ts | 67 +++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 20 deletions(-) diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index d1c0fe0b18..ef63881501 100755 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -13,9 +13,10 @@ * limitations under the License. */ -import {AsyncCallback} from "./basic"; +import {Callback} from "./basic"; import radio from "./@ohos.telephony.radio"; 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, @@ -39,13 +40,10 @@ 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 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 +53,11 @@ 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; - - function once(type: 'signalInfoChange', callback: AsyncCallback>): 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 +70,44 @@ 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 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: '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: 'simStateChange', callback?: Callback): void; - function off(type: 'callStateChange', callback?: AsyncCallback<{ state: CallState, number: String }>): void; + /** + * @since 8 + */ + export interface SimStateData { + state: SimState, + reason: LockReason + } + + /** + * @since 8 + */ + 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 bbc4dcfc71..3b055ff198 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -142,6 +142,21 @@ declare namespace radio { function turnOffRadio(callback: AsyncCallback): void; function turnOffRadio(): Promise; + /** + * Obtains the IMEI of a specified card slot of the device. + * + *

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 IMEI; returns an empty string if the IMEI does not exist. + * @permission ohos.permission.GET_TELEPHONY_STATE + * @since 8 + */ + 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 ed9652a51a..1e9553d443 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -105,6 +105,22 @@ 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 + * @since 8 + */ + 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. @@ -126,6 +142,17 @@ 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. + * @since 8 + */ + function hasSimCard(slotId: number, callback: AsyncCallback): void; + function hasSimCard(slotId: number): Promise; /** * @permission ohos.permission.GET_TELEPHONY_STATE @@ -174,6 +201,35 @@ 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. + * @since 8 + */ + function queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback>): void + function queryIccDiallingNumbers(slotId: number, type: ContactType): Promise>; + + + /** + * @systemapi Hide this for inner system use. + * @since 8 + */ + function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; + function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 8 + */ + function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; + function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise; + + /** + * @systemapi Hide this for inner system use. + * @since 8 + */ + function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void; + function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise; /** * @systemapi Hide this for inner system use. @@ -194,6 +250,17 @@ declare namespace sim { remain?: number, /* Operations remaining */ } + /** + * @systemapi Hide this for inner system use. + * @since 8 + */ + export interface DiallingNumbersInfo { + alphaTag: string, + number: string, + recordNumber?: number, + pin2?: string, + } + export enum SimState { /** * Indicates unknown SIM card state, that is, the accurate status cannot be obtained. -- Gitee