From ad17cfac3a6a1a07ac0b5fb9d681e5dac7028ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B5=E5=A4=B7=E6=81=BA?= Date: Fri, 12 Sep 2025 14:45:30 +0800 Subject: [PATCH] updatecallEx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邵夷恺 --- api/@ohos.telephony.call.d.ts | 185 ++++++++++++++++++++---------- api/@ohos.telephony.observer.d.ts | 60 +++++++--- 2 files changed, 172 insertions(+), 73 deletions(-) diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts index 6b5babb833..2bdaea7276 100644 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -2787,7 +2787,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_MODE_SEND_ONLY, + CALL_MODE_SEND_ONLY = 1, /** * Indicates receiving only calls. @@ -2796,7 +2796,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_MODE_RECEIVE_ONLY, + CALL_MODE_RECEIVE_ONLY = 2, /** * Indicates permission to send and receive calls. @@ -2805,7 +2805,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_MODE_SEND_RECEIVE, + CALL_MODE_SEND_RECEIVE = 3, /** * Indicates a pause in video calls. @@ -2814,7 +2814,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_MODE_VIDEO_PAUSED, + CALL_MODE_VIDEO_PAUSED = 4 } /** @@ -2842,7 +2842,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 10 */ - VONR_STATE_ON = 1, + VONR_STATE_ON = 1 } /** @@ -2863,7 +2863,7 @@ declare namespace call { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - DEVICE_EARPIECE, + DEVICE_EARPIECE = 0, /** * Indicates the audio device is speaker. @@ -2873,7 +2873,7 @@ declare namespace call { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - DEVICE_SPEAKER, + DEVICE_SPEAKER = 1, /** * Indicates the audio device is wired headset. @@ -2883,7 +2883,7 @@ declare namespace call { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - DEVICE_WIRED_HEADSET, + DEVICE_WIRED_HEADSET = 2, /** * Indicates the audio device is bluetooth headset. @@ -2893,7 +2893,7 @@ declare namespace call { * @since arkts {'1.1':'10','1.2':'20'} * @arkts 1.1&1.2 */ - DEVICE_BLUETOOTH_SCO, + DEVICE_BLUETOOTH_SCO = 3, /** * Indicates the audio device is distributed automotive device. @@ -2903,7 +2903,7 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - DEVICE_DISTRIBUTED_AUTOMOTIVE, + DEVICE_DISTRIBUTED_AUTOMOTIVE = 4 } /** @@ -3019,7 +3019,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_ALL_OUTGOING, + RESTRICTION_TYPE_ALL_OUTGOING = 1, /** * Indicates restrict international calls. @@ -3028,7 +3028,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_INTERNATIONAL, + RESTRICTION_TYPE_INTERNATIONAL = 2, /** * Indicates restrict international roaming calls. @@ -3037,7 +3037,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME, + RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME = 3, /** * Indicates restrict roaming calls. @@ -3046,7 +3046,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_ROAMING_INCOMING, + RESTRICTION_TYPE_ROAMING_INCOMING = 4, /** * Indicates restrict all calls. @@ -3055,7 +3055,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_ALL_CALLS, + RESTRICTION_TYPE_ALL_CALLS = 5, /** * Indicates restrict all outgoing services. @@ -3064,7 +3064,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_OUTGOING_SERVICES, + RESTRICTION_TYPE_OUTGOING_SERVICES = 6, /** * Indicates restrict all incoming services. @@ -3073,7 +3073,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_TYPE_INCOMING_SERVICES, + RESTRICTION_TYPE_INCOMING_SERVICES = 7 } /** @@ -3181,7 +3181,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - TRANSFER_TYPE_BUSY, + TRANSFER_TYPE_BUSY = 1, /** * Indicates transfer the call when no reply. @@ -3190,7 +3190,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - TRANSFER_TYPE_NO_REPLY, + TRANSFER_TYPE_NO_REPLY = 2, /** * Indicates transfer the call when unreachable. @@ -3199,7 +3199,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - TRANSFER_TYPE_NOT_REACHABLE, + TRANSFER_TYPE_NOT_REACHABLE = 3 } /** @@ -3245,7 +3245,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_TRANSFER_ERASURE = 4, + CALL_TRANSFER_ERASURE = 4 } /** @@ -3380,7 +3380,7 @@ declare namespace call { * @since 11 */ crsType: number; - + /** * Indicates the initial type of this call. * @@ -3500,7 +3500,7 @@ declare namespace call { * @since 12 */ showBannerForIncomingCall?: boolean; - + /** * Indicates whether the VoIP call is a conference call. Default value is false. * @@ -3510,7 +3510,7 @@ declare namespace call { * @since 12 */ isConferenceCall?: boolean; - + /** * Indicates whether the VoIP incoming video call is support voice answer. Default value is true. * @@ -3547,7 +3547,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 7 */ - TEL_CONFERENCE_ACTIVE, + TEL_CONFERENCE_ACTIVE = 1, /** * Indicates the state is disconnecting. @@ -3556,7 +3556,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 7 */ - TEL_CONFERENCE_DISCONNECTING, + TEL_CONFERENCE_DISCONNECTING = 2, /** * Indicates the state is disconnected. @@ -3565,7 +3565,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 7 */ - TEL_CONFERENCE_DISCONNECTED, + TEL_CONFERENCE_DISCONNECTED = 3 } /** @@ -3626,7 +3626,7 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - TYPE_VOIP = 4, + TYPE_VOIP = 4 } /** @@ -3655,7 +3655,7 @@ declare namespace call { * @deprecated since 11 * @useinstead telephony.call#TYPE_VIDEO_BIDIRECTIONAL */ - TYPE_VIDEO, + TYPE_VIDEO = 1, /** * Indicates the call is in send only video state. * @@ -3671,7 +3671,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_VIDEO_RECEIVE_ONLY, + TYPE_VIDEO_RECEIVE_ONLY = 2, /** * Indicates the call is in send and receive video state. * @@ -3679,7 +3679,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_VIDEO_BIDIRECTIONAL, + TYPE_VIDEO_BIDIRECTIONAL = 3 } /** @@ -3706,7 +3706,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_REQUEST_FAILURE, + TYPE_REQUEST_FAILURE = 1, /** * Indicates the request ignored due to invalid parameters. * @@ -3714,7 +3714,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_REQUEST_INVALID, + TYPE_REQUEST_INVALID = 2, /** * Indicates the request timed out. * @@ -3722,7 +3722,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_REQUEST_TIMED_OUT, + TYPE_REQUEST_TIMED_OUT = 3, /** * Indicates the request rejected by remote. * @@ -3730,7 +3730,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_REQUEST_REJECTED_BY_REMOTE, + TYPE_REQUEST_REJECTED_BY_REMOTE = 4, /** * Indicates the upgrade request canceled. * @@ -3738,7 +3738,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_REQUEST_UPGRADE_CANCELED, + TYPE_REQUEST_UPGRADE_CANCELED = 5, /** * Indicates the ImsCall Mode downgrade RTP time out. * @@ -3754,7 +3754,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - TYPE_DOWNGRADE_RTP_AND_RTCP_TIMEOUT, + TYPE_DOWNGRADE_RTP_AND_RTCP_TIMEOUT = 101 } /** @@ -3797,7 +3797,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - DEVICE_DIRECTION_270 = 270, + DEVICE_DIRECTION_270 = 270 } /** @@ -3824,7 +3824,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - EVENT_CONTROL_CAMERA_READY, + EVENT_CONTROL_CAMERA_READY = 1, /** * Indicates release display surface event. * @@ -3840,7 +3840,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 11 */ - EVENT_PREVIEW_SURFACE_RELEASED, + EVENT_PREVIEW_SURFACE_RELEASED = 101 } /** @@ -3871,7 +3871,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_HOLDING, + CALL_STATUS_HOLDING = 1, /** * Indicates the call is dialing. @@ -3881,7 +3881,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_DIALING, + CALL_STATUS_DIALING = 2, /** * Indicates the call is alerting. @@ -3891,7 +3891,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_ALERTING, + CALL_STATUS_ALERTING = 3, /** * Indicates the call is incoming. @@ -3901,7 +3901,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_INCOMING, + CALL_STATUS_INCOMING = 4, /** * Indicates the call is waiting. @@ -3911,7 +3911,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_WAITING, + CALL_STATUS_WAITING = 5, /** * Indicates the call is disconnected. @@ -3921,7 +3921,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_DISCONNECTED, + CALL_STATUS_DISCONNECTED = 6, /** * Indicates the call is disconnecting. @@ -3931,7 +3931,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_DISCONNECTING, + CALL_STATUS_DISCONNECTING = 7, /** * Indicates the call is idle. @@ -3941,7 +3941,7 @@ declare namespace call { * @since arkts {'1.1':'7','1.2':'20'} * @arkts 1.1&1.2 */ - CALL_STATUS_IDLE, + CALL_STATUS_IDLE = 8 } /** @@ -4009,7 +4009,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - RESTRICTION_MODE_ACTIVATION, + RESTRICTION_MODE_ACTIVATION = 1 } /** @@ -4062,7 +4062,7 @@ declare namespace call { * @since arkts {'1.1':'8','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_INVALID_FDN_NUMBER, + EVENT_INVALID_FDN_NUMBER = 2, /** * Indicates hold call fail. @@ -4072,7 +4072,7 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_HOLD_CALL_FAILED, + EVENT_HOLD_CALL_FAILED = 3, /** * Indicates swap call fail. @@ -4082,7 +4082,7 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_SWAP_CALL_FAILED, + EVENT_SWAP_CALL_FAILED = 4, /** * Indicates combine call failed. @@ -4092,8 +4092,8 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_COMBINE_CALL_FAILED, - + EVENT_COMBINE_CALL_FAILED = 5, + /** * Indicates split call failed. * @@ -4102,7 +4102,7 @@ declare namespace call { * @since arkts {'1.1':'11','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_SPLIT_CALL_FAILED, + EVENT_SPLIT_CALL_FAILED = 6, /** * Indicates show full screen. @@ -4112,7 +4112,7 @@ declare namespace call { * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_SHOW_FULL_SCREEN, + EVENT_SHOW_FULL_SCREEN = 7, /** * Indicates show float window. @@ -4122,7 +4122,7 @@ declare namespace call { * @since arkts {'1.1':'12','1.2':'20'} * @arkts 1.1&1.2 */ - EVENT_SHOW_FLOAT_WINDOW, + EVENT_SHOW_FLOAT_WINDOW = 8 } /** @@ -4181,6 +4181,71 @@ declare namespace call { CALL_STATE_ANSWERED = 3 } + /** + * Indicates the states of telCall. + * + * @enum { number } + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + export enum TelCallState { + /** + * Indicates an invalid state, which is used when the call state fails to be obtained. + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_UNKNOWN = -1, + + /** + * Indicates that there is no ongoing call. + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_IDLE = 0, + + /** + * Indicates that an incoming call is ringing or waiting. + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_RINGING = 1, + + /** + * Indicates that a least one call is in the dialing, and there is no new + * incoming call ringing or waiting. + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_OFFHOOK = 2, + + /** + * Indicates that call is answered + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_ANSWERED = 3, + + /** + * Indicates that call is connected + * + * @syscap SystemCapability.Telephony.CallManager + * @since 21 + * @arkts 1.1&1.2 + */ + TEL_CALL_STATE_CONNECTED = 4 + } + /** * Indicates the options of placing a call. * @@ -4332,7 +4397,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - CALL_EMERGENCY = 2, + CALL_EMERGENCY = 2 } /** @@ -4369,7 +4434,7 @@ declare namespace call { * @systemapi Hide this for inner system use. * @since 8 */ - DIAL_OTT_TYPE = 2, + DIAL_OTT_TYPE = 2 } /** @@ -5447,7 +5512,7 @@ declare namespace call { * @since arkts {'1.1':'8','1.2':'20'} * @arkts 1.1&1.2 */ - UNKNOWN = 1279, + UNKNOWN = 1279 } /** diff --git a/api/@ohos.telephony.observer.d.ts b/api/@ohos.telephony.observer.d.ts index e42b83c2d6..ccb631b740 100644 --- a/api/@ohos.telephony.observer.d.ts +++ b/api/@ohos.telephony.observer.d.ts @@ -610,6 +610,39 @@ declare namespace observer { */ function off(type: 'callStateChange', callback?: Callback): void; + /** + * Callback when the telCall state corresponding to the monitored {@code slotId} is updated. + * + * @param { 'callStateChangeEx' } type - Event type. Indicates the callStateChangeEx event to be subscribed to. + * @param { Callback } callback - Indicates the callback for + * getting the telCall state. + * @param { ObserverOptions } [options] - Indicates the options for observer. + * @throws { BusinessError } 8800001 - Invalid parameter value. + * @throws { BusinessError } 8800002 - Service connection failed. + * @throws { BusinessError } 8800003 - System internal error. + * @throws { BusinessError } 8800999 - Unknown error. + * @syscap SystemCapability.Telephony.StateRegistry + * @since 21 + * @arkts 1.1&1.2 + */ + function on(type: 'callStateChangeEx', callback: Callback, options?: ObserverOptions): void; + + /** + * Cancel callback when the telCall state is updated. + * + * @param { 'callStateChangeEx' } type - Event type. Indicates the callStateChangeEx event to unsubscribe from. + * @param { Callback } [callback] - Indicates the callback to + * unsubscribe from the callStateChangeEx event. + * @throws { BusinessError } 8800001 - Invalid parameter value. + * @throws { BusinessError } 8800002 - Service connection failed. + * @throws { BusinessError } 8800003 - System internal error. + * @throws { BusinessError } 8800999 - Unknown error. + * @syscap SystemCapability.Telephony.StateRegistry + * @since 21 + * @arkts 1.1&1.2 + */ + function off(type: 'callStateChangeEx', callback?: Callback): void; + /** * Callback when the sim state corresponding to the default sim card is updated. * @@ -808,6 +841,7 @@ declare namespace observer { * @since 11 */ export interface ObserverOptions { + /** * Indicates the ID of the target card slot. * @@ -832,7 +866,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_NONE, + SIM_NONE = 0, /** * Indicates the PIN lock. @@ -840,7 +874,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PIN, + SIM_PIN = 1, /** * Indicates the PUK lock. @@ -848,7 +882,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PUK, + SIM_PUK = 2, /** * Indicates network personalization of PIN lock(refer 3GPP TS 22.022 [33]). @@ -856,7 +890,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PN_PIN, + SIM_PN_PIN = 3, /** * Indicates network personalization of PUK lock(refer 3GPP TS 22.022 [33]). @@ -864,7 +898,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PN_PUK, + SIM_PN_PUK = 4, /** * Indicates network subset personalization of PIN lock(refer 3GPP TS 22.022 [33]). @@ -872,7 +906,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PU_PIN, + SIM_PU_PIN = 5, /** * Indicates network subset personalization of PUK lock(refer 3GPP TS 22.022 [33]). @@ -880,7 +914,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PU_PUK, + SIM_PU_PUK = 6, /** * Indicates service provider personalization of PIN lock(refer 3GPP TS 22.022 [33]). @@ -888,7 +922,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PP_PIN, + SIM_PP_PIN = 7, /** * Indicates service provider personalization of PUK lock(refer 3GPP TS 22.022 [33]). @@ -896,7 +930,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PP_PUK, + SIM_PP_PUK = 8, /** * Indicates corporate personalization of PIN lock(refer 3GPP TS 22.022 [33]). @@ -904,7 +938,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PC_PIN, + SIM_PC_PIN = 9, /** * Indicates corporate personalization of PUK lock(refer 3GPP TS 22.022 [33]). @@ -912,7 +946,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_PC_PUK, + SIM_PC_PUK = 10, /** * Indicates SIM/USIM personalization of PIN lock(refer 3GPP TS 22.022 [33]). @@ -920,7 +954,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_SIM_PIN, + SIM_SIM_PIN = 11, /** * Indicates SIM/USIM personalization of PUK lock(refer 3GPP TS 22.022 [33]). @@ -928,7 +962,7 @@ declare namespace observer { * @syscap SystemCapability.Telephony.StateRegistry * @since 8 */ - SIM_SIM_PUK, + SIM_SIM_PUK = 12 } } -- Gitee