161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (C) 2021-2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit TelephonyKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * Provides methods related to cellular data services.
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @namespace data
2761847f8eSopenharmony_ci * @syscap SystemCapability.Telephony.CellularData
2861847f8eSopenharmony_ci * @since 7
2961847f8eSopenharmony_ci */
3061847f8eSopenharmony_cideclare namespace data {
3161847f8eSopenharmony_ci  /**
3261847f8eSopenharmony_ci   * Get the default cellular data card.
3361847f8eSopenharmony_ci   *
3461847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - Indicates the default cellular data slot id.
3561847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
3661847f8eSopenharmony_ci   * @since 7
3761847f8eSopenharmony_ci   */
3861847f8eSopenharmony_ci  function getDefaultCellularDataSlotId(callback: AsyncCallback<number>): void;
3961847f8eSopenharmony_ci
4061847f8eSopenharmony_ci  /**
4161847f8eSopenharmony_ci   * Get the default cellular data card.
4261847f8eSopenharmony_ci   *
4361847f8eSopenharmony_ci   * @returns { Promise<number> } Returns the default cellular data slot id.
4461847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
4561847f8eSopenharmony_ci   * @since 7
4661847f8eSopenharmony_ci   */
4761847f8eSopenharmony_ci  function getDefaultCellularDataSlotId(): Promise<number>;
4861847f8eSopenharmony_ci
4961847f8eSopenharmony_ci  /**
5061847f8eSopenharmony_ci   * Get the default cellular data card.
5161847f8eSopenharmony_ci   *
5261847f8eSopenharmony_ci   * @returns { number } Returns default cellular data slot id.
5361847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
5461847f8eSopenharmony_ci   * @since 9
5561847f8eSopenharmony_ci   */
5661847f8eSopenharmony_ci  function getDefaultCellularDataSlotIdSync(): number;
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci  /**
5961847f8eSopenharmony_ci   * Switch cellular data services to another card, without changing the default settings.
6061847f8eSopenharmony_ci   *
6161847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
6261847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of the target card slot.
6361847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
6461847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setDefaultCellularDataSlotId.
6561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
6661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
6761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6861847f8eSopenharmony_ci   *     2. Incorrect parameter types.
6961847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
7061847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
7161847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
7261847f8eSopenharmony_ci   * @throws { BusinessError } 8300004 - No SIM card found.
7361847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
7461847f8eSopenharmony_ci   * @throws { BusinessError } 8301001 - SIM card is not activated.
7561847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
7661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
7761847f8eSopenharmony_ci   * @since 7
7861847f8eSopenharmony_ci   */
7961847f8eSopenharmony_ci  function setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback<void>): void;
8061847f8eSopenharmony_ci
8161847f8eSopenharmony_ci  /**
8261847f8eSopenharmony_ci   * Switch cellular data services to another card, without changing the default settings.
8361847f8eSopenharmony_ci   *
8461847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
8561847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of the target card slot.
8661847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
8761847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the setDefaultCellularDataSlotId.
8861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
8961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
9061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
9161847f8eSopenharmony_ci   *     2. Incorrect parameter types.
9261847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
9361847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
9461847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
9561847f8eSopenharmony_ci   * @throws { BusinessError } 8300004 - No SIM card found.
9661847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
9761847f8eSopenharmony_ci   * @throws { BusinessError } 8301001 - SIM card is not activated.
9861847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
9961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
10061847f8eSopenharmony_ci   * @since 7
10161847f8eSopenharmony_ci   */
10261847f8eSopenharmony_ci  function setDefaultCellularDataSlotId(slotId: number): Promise<void>;
10361847f8eSopenharmony_ci
10461847f8eSopenharmony_ci  /**
10561847f8eSopenharmony_ci   * Indicates that there is no uplink or downlink data.
10661847f8eSopenharmony_ci   *
10761847f8eSopenharmony_ci   * <p>It is a return value of service state query of cellular data services.
10861847f8eSopenharmony_ci   * @param { AsyncCallback<DataFlowType> } callback - Indicates the data flow type.
10961847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
11061847f8eSopenharmony_ci   * @since 7
11161847f8eSopenharmony_ci   */
11261847f8eSopenharmony_ci  function getCellularDataFlowType(callback: AsyncCallback<DataFlowType>): void;
11361847f8eSopenharmony_ci
11461847f8eSopenharmony_ci  /**
11561847f8eSopenharmony_ci   * Indicates that there is no uplink or downlink data.
11661847f8eSopenharmony_ci   *
11761847f8eSopenharmony_ci   * <p>It is a return value of service state query of cellular data services.
11861847f8eSopenharmony_ci   * @returns { Promise<DataFlowType> } Returns the data flow type.
11961847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
12061847f8eSopenharmony_ci   * @since 7
12161847f8eSopenharmony_ci   */
12261847f8eSopenharmony_ci  function getCellularDataFlowType(): Promise<DataFlowType>;
12361847f8eSopenharmony_ci
12461847f8eSopenharmony_ci  /**
12561847f8eSopenharmony_ci   * Obtain the connection state of the PS domain.
12661847f8eSopenharmony_ci   *
12761847f8eSopenharmony_ci   * @param { AsyncCallback<DataConnectState> } callback - Indicates the callback for getting the connection state,
12861847f8eSopenharmony_ci   * which can be any of the following:
12961847f8eSopenharmony_ci   * <ul>
13061847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_UNKNOWN}
13161847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_DISCONNECTED}
13261847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_CONNECTING}
13361847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_CONNECTED}
13461847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_SUSPENDED}
13561847f8eSopenharmony_ci   * </ul>
13661847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
13761847f8eSopenharmony_ci   * @since 7
13861847f8eSopenharmony_ci   */
13961847f8eSopenharmony_ci  function getCellularDataState(callback: AsyncCallback<DataConnectState>): void;
14061847f8eSopenharmony_ci
14161847f8eSopenharmony_ci  /**
14261847f8eSopenharmony_ci   * Obtain the connection state of the PS domain.
14361847f8eSopenharmony_ci   *
14461847f8eSopenharmony_ci   * @returns { Promise<DataConnectState> } Returns the connection state, which can be any of the following:
14561847f8eSopenharmony_ci   * <ul>
14661847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_UNKNOWN}
14761847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_DISCONNECTED}
14861847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_CONNECTING}
14961847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_CONNECTED}
15061847f8eSopenharmony_ci   * <li>{@code DataConnectState#DATA_STATE_SUSPENDED}
15161847f8eSopenharmony_ci   * </ul>
15261847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
15361847f8eSopenharmony_ci   * @since 7
15461847f8eSopenharmony_ci   */
15561847f8eSopenharmony_ci  function getCellularDataState(): Promise<DataConnectState>;
15661847f8eSopenharmony_ci
15761847f8eSopenharmony_ci  /**
15861847f8eSopenharmony_ci   * Check whether cellular data services are enabled.
15961847f8eSopenharmony_ci   *
16061847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
16161847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether cellular data services
16261847f8eSopenharmony_ci   * are enabled. Returns {@code true} if cellular data services are enabled; returns {@code false} otherwise.
16361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
16461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
16561847f8eSopenharmony_ci   *     2. Incorrect parameter types.
16661847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
16961847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
17061847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
17161847f8eSopenharmony_ci   * @since 7
17261847f8eSopenharmony_ci   */
17361847f8eSopenharmony_ci  function isCellularDataEnabled(callback: AsyncCallback<boolean>): void;
17461847f8eSopenharmony_ci
17561847f8eSopenharmony_ci  /**
17661847f8eSopenharmony_ci   * Check whether cellular data services are enabled.
17761847f8eSopenharmony_ci   *
17861847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
17961847f8eSopenharmony_ci   * @returns { Promise<boolean> } Returns {@code true} if cellular data services are enabled.
18061847f8eSopenharmony_ci   * Returns {@code false} otherwise.
18161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
18261847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
18361847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
18461847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
18561847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
18661847f8eSopenharmony_ci   * @since 7
18761847f8eSopenharmony_ci   */
18861847f8eSopenharmony_ci  function isCellularDataEnabled(): Promise<boolean>;
18961847f8eSopenharmony_ci
19061847f8eSopenharmony_ci  /**
19161847f8eSopenharmony_ci   * Check whether cellular data services are enabled.
19261847f8eSopenharmony_ci   *
19361847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
19461847f8eSopenharmony_ci   * @returns { boolean } Returns {@code true} if cellular data services are enabled.
19561847f8eSopenharmony_ci   * Returns {@code false} otherwise.
19661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
19761847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service.
19861847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
19961847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error code.
20061847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
20161847f8eSopenharmony_ci   * @since 12
20261847f8eSopenharmony_ci   */
20361847f8eSopenharmony_ci  function isCellularDataEnabledSync(): boolean;
20461847f8eSopenharmony_ci
20561847f8eSopenharmony_ci  /**
20661847f8eSopenharmony_ci   * Enable cellular data services.
20761847f8eSopenharmony_ci   *
20861847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
20961847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of enableCellularData.
21061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
21161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
21261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
21361847f8eSopenharmony_ci   *     2. Incorrect parameter types.
21461847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
21561847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
21661847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
21761847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
21861847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
21961847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
22061847f8eSopenharmony_ci   * @since 7
22161847f8eSopenharmony_ci   */
22261847f8eSopenharmony_ci  function enableCellularData(callback: AsyncCallback<void>): void;
22361847f8eSopenharmony_ci
22461847f8eSopenharmony_ci  /**
22561847f8eSopenharmony_ci   * Enable cellular data services.
22661847f8eSopenharmony_ci   *
22761847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
22861847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the enableCellularData.
22961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
23061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
23161847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
23261847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
23361847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
23461847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
23561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
23661847f8eSopenharmony_ci   * @since 7
23761847f8eSopenharmony_ci   */
23861847f8eSopenharmony_ci  function enableCellularData(): Promise<void>;
23961847f8eSopenharmony_ci
24061847f8eSopenharmony_ci  /**
24161847f8eSopenharmony_ci   * Disable cellular data services.
24261847f8eSopenharmony_ci   *
24361847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
24461847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of disableCellularData.
24561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
24661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
24761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
24861847f8eSopenharmony_ci   *     2. Incorrect parameter types.
24961847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
25061847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
25161847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
25261847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
25361847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
25461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
25561847f8eSopenharmony_ci   * @since 7
25661847f8eSopenharmony_ci   */
25761847f8eSopenharmony_ci  function disableCellularData(callback: AsyncCallback<void>): void;
25861847f8eSopenharmony_ci
25961847f8eSopenharmony_ci  /**
26061847f8eSopenharmony_ci   * Disable cellular data services.
26161847f8eSopenharmony_ci   *
26261847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
26361847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the disableCellularData.
26461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
26561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
26661847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
26761847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
26861847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
26961847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
27061847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
27161847f8eSopenharmony_ci   * @since 7
27261847f8eSopenharmony_ci   */
27361847f8eSopenharmony_ci  function disableCellularData(): Promise<void>;
27461847f8eSopenharmony_ci
27561847f8eSopenharmony_ci  /**
27661847f8eSopenharmony_ci   * Check whether roaming is enabled for cellular data services.
27761847f8eSopenharmony_ci   *
27861847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
27961847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
28061847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
28161847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether roaming is enabled
28261847f8eSopenharmony_ci   * for cellular data services. Returns {@code true} if roaming is enabled for cellular data services;
28361847f8eSopenharmony_ci   * returns {@code false} otherwise.
28461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
28561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
28661847f8eSopenharmony_ci   *     2. Incorrect parameter types.
28761847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
28861847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
28961847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
29061847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
29161847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
29261847f8eSopenharmony_ci   * @since 7
29361847f8eSopenharmony_ci   */
29461847f8eSopenharmony_ci  function isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback<boolean>): void;
29561847f8eSopenharmony_ci
29661847f8eSopenharmony_ci  /**
29761847f8eSopenharmony_ci   * Check whether roaming is enabled for cellular data services.
29861847f8eSopenharmony_ci   *
29961847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
30061847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
30161847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
30261847f8eSopenharmony_ci   * @returns { Promise<boolean> } Returns {@code true} if roaming is enabled for cellular data services.
30361847f8eSopenharmony_ci   * Returns {@code false} otherwise.
30461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
30561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
30661847f8eSopenharmony_ci   *     2. Incorrect parameter types.
30761847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
30861847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
30961847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
31061847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
31161847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
31261847f8eSopenharmony_ci   * @since 7
31361847f8eSopenharmony_ci   */
31461847f8eSopenharmony_ci  function isCellularDataRoamingEnabled(slotId: number): Promise<boolean>;
31561847f8eSopenharmony_ci
31661847f8eSopenharmony_ci  /**
31761847f8eSopenharmony_ci   * Check whether roaming is enabled for cellular data services.
31861847f8eSopenharmony_ci   *
31961847f8eSopenharmony_ci   * @permission ohos.permission.GET_NETWORK_INFO
32061847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
32161847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
32261847f8eSopenharmony_ci   * @returns { boolean } Returns {@code true} if roaming is enabled for cellular data services.
32361847f8eSopenharmony_ci   * Returns {@code false} otherwise.
32461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
32561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified;
32661847f8eSopenharmony_ci   * 2. Incorrect parameters types;
32761847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
32861847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Operation failed. Cannot connect to service.
32961847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
33061847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error code.
33161847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
33261847f8eSopenharmony_ci   * @since 12
33361847f8eSopenharmony_ci   */
33461847f8eSopenharmony_ci  function isCellularDataRoamingEnabledSync(slotId: number): boolean;
33561847f8eSopenharmony_ci
33661847f8eSopenharmony_ci  /**
33761847f8eSopenharmony_ci   * Enable cellular data roaming.
33861847f8eSopenharmony_ci   *
33961847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
34061847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
34161847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
34261847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of enableCellularDataRoaming.
34361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
34461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
34561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
34661847f8eSopenharmony_ci   *     2. Incorrect parameter types.
34761847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
34861847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
34961847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
35061847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
35161847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
35261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
35361847f8eSopenharmony_ci   * @since 7
35461847f8eSopenharmony_ci   */
35561847f8eSopenharmony_ci  function enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void>): void;
35661847f8eSopenharmony_ci
35761847f8eSopenharmony_ci  /**
35861847f8eSopenharmony_ci   * Enable cellular data roaming.
35961847f8eSopenharmony_ci   *
36061847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
36161847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
36261847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
36361847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the enableCellularDataRoaming.
36461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
36561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
36661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
36761847f8eSopenharmony_ci   *     2. Incorrect parameter types.
36861847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
36961847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
37061847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
37161847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
37261847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
37361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
37461847f8eSopenharmony_ci   * @since 7
37561847f8eSopenharmony_ci   */
37661847f8eSopenharmony_ci  function enableCellularDataRoaming(slotId: number): Promise<void>;
37761847f8eSopenharmony_ci
37861847f8eSopenharmony_ci  /**
37961847f8eSopenharmony_ci   * Disable cellular data roaming.
38061847f8eSopenharmony_ci   *
38161847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
38261847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
38361847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
38461847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of disableCellularDataRoaming.
38561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
38661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
38761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
38861847f8eSopenharmony_ci   *     2. Incorrect parameter types.
38961847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
39061847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
39161847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
39261847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
39361847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
39461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
39561847f8eSopenharmony_ci   * @since 7
39661847f8eSopenharmony_ci   */
39761847f8eSopenharmony_ci  function disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void>): void;
39861847f8eSopenharmony_ci
39961847f8eSopenharmony_ci  /**
40061847f8eSopenharmony_ci   * Disable cellular data roaming.
40161847f8eSopenharmony_ci   *
40261847f8eSopenharmony_ci   * @permission ohos.permission.SET_TELEPHONY_STATE
40361847f8eSopenharmony_ci   * @param { number } slotId - Indicates the ID of a card slot.
40461847f8eSopenharmony_ci   * The value {@code 0} indicates card 1, and the value {@code 1} indicates card 2.
40561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the disableCellularDataRoaming.
40661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
40761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Non-system applications use system APIs.
40861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
40961847f8eSopenharmony_ci   *     2. Incorrect parameter types.
41061847f8eSopenharmony_ci   * @throws { BusinessError } 8300001 - Invalid parameter value.
41161847f8eSopenharmony_ci   * @throws { BusinessError } 8300002 - Service connection failed.
41261847f8eSopenharmony_ci   * @throws { BusinessError } 8300003 - System internal error.
41361847f8eSopenharmony_ci   * @throws { BusinessError } 8300999 - Unknown error.
41461847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
41561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
41661847f8eSopenharmony_ci   * @since 7
41761847f8eSopenharmony_ci   */
41861847f8eSopenharmony_ci  function disableCellularDataRoaming(slotId: number): Promise<void>;
41961847f8eSopenharmony_ci
42061847f8eSopenharmony_ci  /**
42161847f8eSopenharmony_ci   * Obtains the default cellular data SIM ID.
42261847f8eSopenharmony_ci   *
42361847f8eSopenharmony_ci   * @returns { number } Returns the SIM ID of the default cellular data sim and SIM ID will increase from 1.
42461847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
42561847f8eSopenharmony_ci   * @since 10
42661847f8eSopenharmony_ci   */
42761847f8eSopenharmony_ci  function getDefaultCellularDataSimId(): number;
42861847f8eSopenharmony_ci
42961847f8eSopenharmony_ci  /**
43061847f8eSopenharmony_ci   * Describes the cellular data flow type.
43161847f8eSopenharmony_ci   *
43261847f8eSopenharmony_ci   * @enum { number }
43361847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
43461847f8eSopenharmony_ci   * @since 7
43561847f8eSopenharmony_ci   */
43661847f8eSopenharmony_ci  export enum DataFlowType {
43761847f8eSopenharmony_ci    /**
43861847f8eSopenharmony_ci     * Indicates that there is no uplink or downlink data.
43961847f8eSopenharmony_ci     *
44061847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
44161847f8eSopenharmony_ci     * @since 7
44261847f8eSopenharmony_ci     */
44361847f8eSopenharmony_ci    DATA_FLOW_TYPE_NONE = 0,
44461847f8eSopenharmony_ci
44561847f8eSopenharmony_ci    /**
44661847f8eSopenharmony_ci     * Indicates that there is only downlink data.
44761847f8eSopenharmony_ci     *
44861847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
44961847f8eSopenharmony_ci     * @since 7
45061847f8eSopenharmony_ci     */
45161847f8eSopenharmony_ci    DATA_FLOW_TYPE_DOWN = 1,
45261847f8eSopenharmony_ci
45361847f8eSopenharmony_ci    /**
45461847f8eSopenharmony_ci     * Indicates that there is only uplink data.
45561847f8eSopenharmony_ci     *
45661847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
45761847f8eSopenharmony_ci     * @since 7
45861847f8eSopenharmony_ci     */
45961847f8eSopenharmony_ci    DATA_FLOW_TYPE_UP = 2,
46061847f8eSopenharmony_ci
46161847f8eSopenharmony_ci    /**
46261847f8eSopenharmony_ci     * Indicates that there is uplink and downlink data.
46361847f8eSopenharmony_ci     *
46461847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
46561847f8eSopenharmony_ci     * @since 7
46661847f8eSopenharmony_ci     */
46761847f8eSopenharmony_ci    DATA_FLOW_TYPE_UP_DOWN = 3,
46861847f8eSopenharmony_ci
46961847f8eSopenharmony_ci    /**
47061847f8eSopenharmony_ci     * Indicates that there is no uplink or downlink data, and the bottom-layer link is in the dormant state.
47161847f8eSopenharmony_ci     *
47261847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
47361847f8eSopenharmony_ci     * @since 7
47461847f8eSopenharmony_ci     */
47561847f8eSopenharmony_ci    DATA_FLOW_TYPE_DORMANT = 4
47661847f8eSopenharmony_ci  }
47761847f8eSopenharmony_ci
47861847f8eSopenharmony_ci  /**
47961847f8eSopenharmony_ci   * Describes the cellular data link connection state.
48061847f8eSopenharmony_ci   *
48161847f8eSopenharmony_ci   * @enum { number }
48261847f8eSopenharmony_ci   * @syscap SystemCapability.Telephony.CellularData
48361847f8eSopenharmony_ci   * @since 7
48461847f8eSopenharmony_ci   */
48561847f8eSopenharmony_ci  export enum DataConnectState {
48661847f8eSopenharmony_ci    /**
48761847f8eSopenharmony_ci     * Indicates that a cellular data link is unknown.
48861847f8eSopenharmony_ci     *
48961847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
49061847f8eSopenharmony_ci     * @since 7
49161847f8eSopenharmony_ci     */
49261847f8eSopenharmony_ci    DATA_STATE_UNKNOWN = -1,
49361847f8eSopenharmony_ci
49461847f8eSopenharmony_ci    /**
49561847f8eSopenharmony_ci     * Indicates that a cellular data link is disconnected.
49661847f8eSopenharmony_ci     *
49761847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
49861847f8eSopenharmony_ci     * @since 7
49961847f8eSopenharmony_ci     */
50061847f8eSopenharmony_ci    DATA_STATE_DISCONNECTED = 0,
50161847f8eSopenharmony_ci
50261847f8eSopenharmony_ci    /**
50361847f8eSopenharmony_ci     * Indicates that a cellular data link is being connected.
50461847f8eSopenharmony_ci     *
50561847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
50661847f8eSopenharmony_ci     * @since 7
50761847f8eSopenharmony_ci     */
50861847f8eSopenharmony_ci    DATA_STATE_CONNECTING = 1,
50961847f8eSopenharmony_ci
51061847f8eSopenharmony_ci    /**
51161847f8eSopenharmony_ci     * Indicates that a cellular data link is connected.
51261847f8eSopenharmony_ci     *
51361847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
51461847f8eSopenharmony_ci     * @since 7
51561847f8eSopenharmony_ci     */
51661847f8eSopenharmony_ci    DATA_STATE_CONNECTED = 2,
51761847f8eSopenharmony_ci
51861847f8eSopenharmony_ci    /**
51961847f8eSopenharmony_ci     * Indicates that a cellular data link is suspended.
52061847f8eSopenharmony_ci     *
52161847f8eSopenharmony_ci     * @syscap SystemCapability.Telephony.CellularData
52261847f8eSopenharmony_ci     * @since 7
52361847f8eSopenharmony_ci     */
52461847f8eSopenharmony_ci    DATA_STATE_SUSPENDED = 3
52561847f8eSopenharmony_ci  }
52661847f8eSopenharmony_ci}
52761847f8eSopenharmony_ci
52861847f8eSopenharmony_ciexport default data;
529