2022-02-18 08:45:55 +00:00
|
|
|
/*
|
2024-05-28 03:51:40 +00:00
|
|
|
* Copyright (C) 2021-2024 Huawei Device Co., Ltd.
|
2022-03-01 04:11:12 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-08 07:25:39 +00:00
|
|
|
* @kit TelephonyKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-08-03 07:56:32 +00:00
|
|
|
import type { AsyncCallback } from './@ohos.base';
|
2022-02-18 08:45:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides methods related to cellular data services.
|
|
|
|
*
|
2023-05-13 03:19:57 +00:00
|
|
|
* @namespace data
|
2022-02-21 09:18:50 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
declare namespace data {
|
|
|
|
/**
|
2023-02-06 12:23:33 +00:00
|
|
|
* Get the default cellular data card.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<number> } callback - Indicates the default cellular data slot id.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getDefaultCellularDataSlotId(callback: AsyncCallback<number>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the default cellular data card.
|
|
|
|
*
|
|
|
|
* @returns { Promise<number> } Returns the default cellular data slot id.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getDefaultCellularDataSlotId(): Promise<number>;
|
|
|
|
|
2022-09-19 02:45:09 +00:00
|
|
|
/**
|
2023-02-06 12:23:33 +00:00
|
|
|
* Get the default cellular data card.
|
2022-09-19 02:45:09 +00:00
|
|
|
*
|
2023-05-13 03:19:57 +00:00
|
|
|
* @returns { number } Returns default cellular data slot id.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-09-19 02:45:09 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function getDefaultCellularDataSlotIdSync(): number;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Switch cellular data services to another card, without changing the default settings.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { number } 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 { AsyncCallback<void> } callback - The callback of setDefaultCellularDataSlotId.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300004 - No SIM card found.
|
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8301001 - SIM card is not activated.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-02-18 08:45:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback<void>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Switch cellular data services to another card, without changing the default settings.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
|
|
|
* @param { number } slotId - Indicates the ID of the target card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @returns { Promise<void> } The promise returned by the setDefaultCellularDataSlotId.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300004 - No SIM card found.
|
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8301001 - SIM card is not activated.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function setDefaultCellularDataSlotId(slotId: number): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is no uplink or downlink data.
|
|
|
|
*
|
|
|
|
* <p>It is a return value of service state query of cellular data services.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<DataFlowType> } callback - Indicates the data flow type.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getCellularDataFlowType(callback: AsyncCallback<DataFlowType>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is no uplink or downlink data.
|
|
|
|
*
|
|
|
|
* <p>It is a return value of service state query of cellular data services.
|
|
|
|
* @returns { Promise<DataFlowType> } Returns the data flow type.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getCellularDataFlowType(): Promise<DataFlowType>;
|
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Obtain the connection state of the PS domain.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<DataConnectState> } callback - Indicates the callback for getting the connection state,
|
|
|
|
* which can be any of the following:
|
2022-02-18 08:45:55 +00:00
|
|
|
* <ul>
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_UNKNOWN}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_DISCONNECTED}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_CONNECTING}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_CONNECTED}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_SUSPENDED}
|
|
|
|
* </ul>
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getCellularDataState(callback: AsyncCallback<DataConnectState>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Obtain the connection state of the PS domain.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @returns { Promise<DataConnectState> } Returns the connection state, which can be any of the following:
|
|
|
|
* <ul>
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_UNKNOWN}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_DISCONNECTED}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_CONNECTING}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_CONNECTED}
|
|
|
|
* <li>{@code DataConnectState#DATA_STATE_SUSPENDED}
|
|
|
|
* </ul>
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getCellularDataState(): Promise<DataConnectState>;
|
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Check whether cellular data services are enabled.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
2022-03-26 09:42:58 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether cellular data services
|
|
|
|
* are enabled. Returns {@code true} if cellular data services are enabled; returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function isCellularDataEnabled(callback: AsyncCallback<boolean>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Check whether cellular data services are enabled.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { Promise<boolean> } Returns {@code true} if cellular data services are enabled.
|
|
|
|
* Returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function isCellularDataEnabled(): Promise<boolean>;
|
|
|
|
|
2024-06-07 06:57:07 +00:00
|
|
|
/**
|
|
|
|
* Check whether cellular data services are enabled.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { boolean } Returns {@code true} if cellular data services are enabled.
|
|
|
|
* Returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service.
|
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
|
|
|
* @throws { BusinessError } 8300999 - Unknown error code.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
function isCellularDataEnabledSync(): boolean;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Enable cellular data services.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - The callback of enableCellularData.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-02-18 08:45:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function enableCellularData(callback: AsyncCallback<void>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Enable cellular data services.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
|
|
|
* @returns { Promise<void> } The promise returned by the enableCellularData.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function enableCellularData(): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Disable cellular data services.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - The callback of disableCellularData.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-02-18 08:45:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function disableCellularData(callback: AsyncCallback<void>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Disable cellular data services.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
|
|
|
* @returns { Promise<void> } The promise returned by the disableCellularData.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function disableCellularData(): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Check whether roaming is enabled for cellular data services.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether roaming is enabled
|
|
|
|
* for cellular data services. Returns {@code true} if roaming is enabled for cellular data services;
|
|
|
|
* returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback<boolean>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Check whether roaming is enabled for cellular data services.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @returns { Promise<boolean> } Returns {@code true} if roaming is enabled for cellular data services.
|
|
|
|
* Returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function isCellularDataRoamingEnabled(slotId: number): Promise<boolean>;
|
|
|
|
|
2024-06-07 06:57:07 +00:00
|
|
|
/**
|
|
|
|
* Check whether roaming is enabled for cellular data services.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @returns { boolean } Returns {@code true} if roaming is enabled for cellular data services.
|
|
|
|
* Returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified;
|
|
|
|
* 2. Incorrect parameters types;
|
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
|
|
|
* @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service.
|
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
|
|
|
* @throws { BusinessError } 8300999 - Unknown error code.
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
function isCellularDataRoamingEnabledSync(slotId: number): boolean;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Enable cellular data roaming.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @param { AsyncCallback<void> } callback - The callback of enableCellularDataRoaming.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-02-18 08:45:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Enable cellular data roaming.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @returns { Promise<void> } The promise returned by the enableCellularDataRoaming.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function enableCellularDataRoaming(slotId: number): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Disable cellular data roaming.
|
2022-02-18 08:45:55 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
2023-05-13 03:19:57 +00:00
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @param { AsyncCallback<void> } callback - The callback of disableCellularDataRoaming.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
2022-02-18 08:45:55 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void>): void;
|
2023-05-13 03:19:57 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-13 03:22:00 +00:00
|
|
|
* Disable cellular data roaming.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @permission ohos.permission.SET_TELEPHONY_STATE
|
|
|
|
* @param { number } slotId - Indicates the ID of a card slot.
|
|
|
|
* The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
|
|
|
|
* @returns { Promise<void> } The promise returned by the disableCellularDataRoaming.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-24 02:53:55 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-05-27 07:23:52 +00:00
|
|
|
* 2. Incorrect parameter types.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300001 - Invalid parameter value.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300002 - Service connection failed.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @throws { BusinessError } 8300003 - System internal error.
|
2024-05-28 03:51:40 +00:00
|
|
|
* @throws { BusinessError } 8300999 - Unknown error.
|
2023-05-13 03:19:57 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 7
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function disableCellularDataRoaming(slotId: number): Promise<void>;
|
|
|
|
|
2023-06-12 09:17:05 +00:00
|
|
|
/**
|
|
|
|
* Obtains the default cellular data SIM ID.
|
|
|
|
*
|
2023-06-13 02:05:09 +00:00
|
|
|
* @returns { number } Returns the SIM ID of the default cellular data sim and SIM ID will increase from 1.
|
2023-06-12 09:17:05 +00:00
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getDefaultCellularDataSimId(): number;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
|
|
|
* Describes the cellular data flow type.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @enum { number }
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
export enum DataFlowType {
|
|
|
|
/**
|
|
|
|
* Indicates that there is no uplink or downlink data.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_FLOW_TYPE_NONE = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is only downlink data.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_FLOW_TYPE_DOWN = 1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is only uplink data.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_FLOW_TYPE_UP = 2,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is uplink and downlink data.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_FLOW_TYPE_UP_DOWN = 3,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that there is no uplink or downlink data, and the bottom-layer link is in the dormant state.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_FLOW_TYPE_DORMANT = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes the cellular data link connection state.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @enum { number }
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
export enum DataConnectState {
|
|
|
|
/**
|
|
|
|
* Indicates that a cellular data link is unknown.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_STATE_UNKNOWN = -1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a cellular data link is disconnected.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_STATE_DISCONNECTED = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a cellular data link is being connected.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_STATE_CONNECTING = 1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a cellular data link is connected.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_STATE_CONNECTED = 2,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that a cellular data link is suspended.
|
2023-05-13 03:19:57 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Telephony.CellularData
|
|
|
|
* @since 7
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
DATA_STATE_SUSPENDED = 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-28 09:03:24 +00:00
|
|
|
export default data;
|