From aa53c2b536973b22ae7ea8be26f24420369012cc Mon Sep 17 00:00:00 2001 From: qian-nan-xu Date: Mon, 5 Sep 2022 15:06:23 +0800 Subject: [PATCH] add interface Signed-off-by: qian-nan-xu --- api/@ohos.telephony.call.d.ts | 85 ++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 7 deletions(-) diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts index 2a48ba7418..f18b74f8d5 100644 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -131,27 +131,41 @@ declare namespace call { function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise; /** - * @systemapi Hide this for inner system use. + * Answers the incoming call. + * + * @param callId Indicates the identifier of the call to answer. It is optional since API 9. * @permission ohos.permission.ANSWER_CALL + * @systemapi Hide this for inner system use. * @since 7 */ + function answer(callback: AsyncCallback): void; function answer(callId: number, callback: AsyncCallback): void; - function answer(callId: number): Promise; + function answer(callId?: number): Promise; /** + * Hangups the foreground call. + * + * @param callId Indicates the identifier of the call to hangup. It is optional since API 9. * @systemapi Hide this for inner system use. * @since 7 */ + function hangup(callback: AsyncCallback): void; function hangup(callId: number, callback: AsyncCallback): void; - function hangup(callId: number): Promise; + function hangup(callId?: number): Promise; /** + * Rejects the incoming call. + * + * @param callId Indicates the identifier of the call to reject. It is optional since API 9. + * @param options Indicates the text message to reject. * @systemapi Hide this for inner system use. * @since 7 */ + function reject(callback: AsyncCallback): void; + function reject(options: RejectMessageOptions, callback: AsyncCallback): void; function reject(callId: number, callback: AsyncCallback): void; function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; - function reject(callId: number, options?: RejectMessageOptions): Promise; + function reject(callId?: number, options?: RejectMessageOptions): Promise; /** * @systemapi Hide this for inner system use. @@ -274,6 +288,26 @@ declare namespace call { */ function off(type: 'callDisconnectedCause', callback?: Callback): void; + /** + * Observe the result of MMI code + * + * @param type Indicates the observer type. + * @param callback Return the result of MMI code. + * @systemapi Hide this for inner system use. + * @since 9 + */ + function on(type: 'mmiCodeResult', callback: Callback): void; + + /** + * Unobserve the result of MMI code + * + * @param type Indicates the observer type. + * @param callback Return the result of MMI code. + * @systemapi Hide this for inner system use. + * @since 9 + */ + function off(type: 'mmiCodeResult', callback?: Callback): void; + /** * @systemapi Hide this for inner system use. * @since 8 @@ -339,11 +373,17 @@ declare namespace call { function cancelMuted(): Promise; /** + * Set the audio device + * + * @param device Indicates the device of audio. + * @param options Indicates additional information, such as address of bluetooth(Since API 9). + * @param callback Returns {@code true} if the request is successful; returns {@code false} otherwise. * @systemapi Hide this for inner system use. * @since 8 */ function setAudioDevice(device: AudioDevice, callback: AsyncCallback): void; - function setAudioDevice(device: AudioDevice): Promise; + function setAudioDevice(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback): void; + function setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise; /** * @systemapi Hide this for inner system use. @@ -397,10 +437,11 @@ declare namespace call { * @since 8 */ export enum AudioDevice { - DEVICE_MIC, + DEVICE_EARPIECE, DEVICE_SPEAKER, DEVICE_WIRED_HEADSET, - DEVICE_BLUETOOTH_SCO + DEVICE_BLUETOOTH_SCO, + DEVICE_MIC, } /** @@ -678,6 +719,36 @@ declare namespace call { countryCode?: string; } + /** + * @systemapi Hide this for inner system use. + * @since 9 + */ + export interface AudioDeviceOptions { + bluetoothAddress?: string; + } + + /** + * @systemapi Hide this for inner system use. + * @since 9 + */ + export interface MmiCodeResults { + /** Indicates the result of MMI code. */ + result: MmiCodeResult; + /** Indicates the message of MMI code. */ + message: string; + } + + /** + * @systemapi Hide this for inner system use. + * @since 9 + */ + export enum MmiCodeResult { + /** Indicates the result of MMI code with successfully. */ + MMI_CODE_SUCCESS = 0, + /** Indicates the result of MMI code with failed. */ + MMI_CODE_FAILED = 1 + } + /** * @systemapi Hide this for inner system use. * @since 8 -- Gitee