diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts old mode 100644 new mode 100755 index 6e4fbce5de6c0999198b4f3c0b5fbaf1d5ab7777..63439819e241689d51725967160230af22017d23 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -16,6 +16,7 @@ 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, @@ -70,11 +71,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: Callback<{ state: CallState, number: string }>): void; + function on(type: 'callStateChange', callback: Callback<{ state: CallState, number: String }>): void; function on(type: 'callStateChange', options: { slotId: number }, - callback: Callback<{ state: CallState, number: string }>): void; + callback: Callback<{ state: CallState, number: String }>): void; - function off(type: 'callStateChange', 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 off(type: 'simStateChange', callback?: Callback): 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 bbc4dcfc71deb04e96e1e5bf2e8328c822a6f7b7..3b055ff198245890cc90689b2f3621c57840f5be 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 ed9652a51a98d1674559b03443969de12edc360a..1e9553d443f84ac4e1c126e4e741cc57d0e19c00 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.