From bd71a64efd3d26d10338cbfe7d09f3625b7e16d7 Mon Sep 17 00:00:00 2001 From: wanzixuan Date: Thu, 24 Jul 2025 22:10:11 +0800 Subject: [PATCH] Modify overload functions for telephony core service Signed-off-by: wanzixuan --- api/@ohos.telephony.radio.d.ts | 260 ++++++++++++++++++++++++++++++--- 1 file changed, 238 insertions(+), 22 deletions(-) diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index 8118431187..6894aaa89d 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -182,6 +182,12 @@ declare namespace radio { */ function getRadioTechSync(slotId: number): NetworkRadioTech; + /** + * @since 20 + * @arkts 1.2 + */ + overload getNetworkState { getNetworkStateWithSlotIdCallback, getNetworkStateWithSlotIdReturnsPromise, getNetworkStateWithCallback }; + /** * Obtains the network state of the registered network. * @@ -197,8 +203,27 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'6','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getNetworkStateWithSlotIdCallback(slotId: number, callback: AsyncCallback): void; + + /** + * Obtains the network state of the registered network. + * + * @permission ohos.permission.GET_NETWORK_INFO + * @param { number } slotId - Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param { AsyncCallback } callback - Indicates the callback for getting network registration state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 6 */ function getNetworkState(slotId: number, callback: AsyncCallback): void; @@ -218,8 +243,28 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'6','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getNetworkStateWithSlotIdReturnsPromise(slotId?: number): Promise; + + /** + * Obtains the network state of the registered network. + * + * @permission ohos.permission.GET_NETWORK_INFO + * @param { number } slotId - Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * if no slotId is provided, the default slotId is 0. + * @returns { Promise } Returns the NetworkState object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 6 */ function getNetworkState(slotId?: number): Promise; @@ -236,8 +281,25 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'6','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getNetworkStateWithCallback(callback: AsyncCallback): void; + + /** + * Obtains the network state of the registered network. + * + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - Indicates the callback for getting network registration state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 6 */ function getNetworkState(callback: AsyncCallback): void; @@ -803,6 +865,12 @@ declare namespace radio { */ function getUniqueDeviceId(callback: AsyncCallback): void; + /** + * @since 20 + * @arkts 1.2 + */ + overload getPrimarySlotId { getPrimarySlotIdWithCallback, getPrimarySlotIdReturnsPromise }; + /** * Obtains the index number of the card slot where the primary card is located if multiple SIM cards are inserted. * @@ -817,8 +885,26 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getPrimarySlotIdWithCallback(callback: AsyncCallback): void; + + /** + * Obtains the index number of the card slot where the primary card is located if multiple SIM cards are inserted. + * + * The primary card is the SIM card inserted in the card slot that uses data services by default. + * + * @param { AsyncCallback } callback - Indicates the callback for getting the index number of + * the primary card slot. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 7 */ function getPrimarySlotId(callback: AsyncCallback): void; @@ -832,8 +918,22 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getPrimarySlotIdReturnsPromise(): Promise; + + /** + * Obtains the index number of the card slot where the primary card is located if multiple SIM cards are inserted. + * + * The primary card is the SIM card inserted in the card slot that uses data services by default. + * + * @returns { Promise } Returns the index number of the primary card slot. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 7 */ function getPrimarySlotId(): Promise; @@ -881,6 +981,12 @@ declare namespace radio { */ function setPrimarySlotId(slotId: number): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getSignalInformation { getSignalInformationWithCallback, getSignalInformationReturnsPromise }; + /** * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. * @@ -895,8 +1001,26 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getSignalInformationWithCallback(slotId: number, callback: AsyncCallback>): void; + + /** + * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. + * + * @param { number } slotId - Indicates the card slot index number, ranging from 0 to the maximum card slot + * index number supported by the device. + * @param { AsyncCallback> } callback - Indicates the callback for getting + * the instance list of the child classes derived from {@link SignalInformation}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 7 */ function getSignalInformation(slotId: number, callback: AsyncCallback>): void; @@ -914,8 +1038,26 @@ declare namespace radio { * @throws { BusinessError } 8300003 - System internal error. * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getSignalInformationReturnsPromise(slotId: number): Promise>; + + /** + * Obtains the list of signal strength information of the registered network corresponding to a specified SIM card. + * + * @param { number } slotId - Indicates the card slot index number, ranging from 0 to the maximum card slot + * index number supported by the device. + * @returns { Promise> } Returns the callback for getting the instance list of + * the child classes derived from {@link SignalInformation}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @since 7 */ function getSignalInformation(slotId: number): Promise>; @@ -955,13 +1097,28 @@ declare namespace radio { */ function isNrSupported(slotId: number): boolean; + /** + * @since 20 + * @arkts 1.2 + */ + overload isNRSupported { isNRSupportedWithoutSlotId, isNRSupportedWithSlotId }; + /** * Checks whether the device supports 5G New Radio (NR). * * @returns { boolean } Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function isNRSupportedWithoutSlotId(): boolean; + + /** + * Checks whether the device supports 5G New Radio (NR). + * + * @returns { boolean } Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. + * @syscap SystemCapability.Telephony.CoreService + * @since 9 */ function isNRSupported(): boolean; @@ -972,8 +1129,19 @@ declare namespace radio { * index number supported by the device. * @returns { boolean } Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. * @syscap SystemCapability.Telephony.CoreService - * @since arkts{ '1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function isNRSupportedWithSlotId(slotId: number): boolean; + + /** + * Checks whether the device supports 5G New Radio (NR) by according card slot. + * + * @param { number } slotId - Indicates the card slot index number, ranging from 0 to the maximum card slot + * index number supported by the device. + * @returns { boolean } Returns {@code true} if the device supports 5G NR; returns {@code false} otherwise. + * @syscap SystemCapability.Telephony.CoreService + * @since 9 */ function isNRSupported(slotId: number): boolean; @@ -1288,6 +1456,12 @@ declare namespace radio { */ function getPreferredNetwork(slotId: number): Promise; + /** + * @since 20 + * @arkts 1.2 + */ + overload getImsRegInfo { getImsRegInfoWithCallback, getImsRegInfoReturnsPromise }; + /** * Get the IMS registration state info of specified IMS service type. * @@ -1305,8 +1479,29 @@ declare namespace radio { * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getImsRegInfoWithCallback(slotId: number, imsType: ImsServiceType, callback: AsyncCallback): void; + + /** + * Get the IMS registration state info of specified IMS service type. + * + * @permission ohos.permission.GET_TELEPHONY_STATE + * @param { number } slotId - Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param { ImsServiceType } imsType - Indicates the ims service type of the {@link ImsServiceType}. + * @param { AsyncCallback } callback - Indicates an instance of the {@link ImsRegInfo} class. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Non-system applications use system APIs. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @systemapi Hide this for inner system use. + * @since 9 */ function getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback): void; @@ -1327,8 +1522,29 @@ declare namespace radio { * @throws { BusinessError } 8300999 - Unknown error. * @syscap SystemCapability.Telephony.CoreService * @systemapi Hide this for inner system use. - * @since arkts{ '1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 + */ + function getImsRegInfoReturnsPromise(slotId: number, imsType: ImsServiceType): Promise; + + /** + * Get the IMS registration state info of specified IMS service type. + * + * @permission ohos.permission.GET_TELEPHONY_STATE + * @param { number } slotId - Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @param { ImsServiceType } imsType - Indicates the ims service type of the {@link ImsServiceType}. + * @returns { Promise } Returns an instance of the {@link ImsRegInfo} class. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Non-system applications use system APIs. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 8300001 - Invalid parameter value. + * @throws { BusinessError } 8300002 - Service connection failed. + * @throws { BusinessError } 8300003 - System internal error. + * @throws { BusinessError } 8300999 - Unknown error. + * @syscap SystemCapability.Telephony.CoreService + * @systemapi Hide this for inner system use. + * @since 9 */ function getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise; -- Gitee