2022-02-18 08:45:55 +00:00
|
|
|
/*
|
2023-05-05 08:16:02 +00:00
|
|
|
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
|
2022-02-18 08:45:55 +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.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-08 07:25:39 +00:00
|
|
|
* @kit NetworkKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-06-30 10:24:21 +00:00
|
|
|
import type { AsyncCallback, Callback } from './@ohos.base';
|
|
|
|
import type http from './@ohos.net.http';
|
|
|
|
import type socket from './@ohos.net.socket';
|
2022-02-18 08:45:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides interfaces to manage and use data networks.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @namespace connection
|
2022-02-21 09:18:50 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Provides interfaces to manage and use data networks.
|
|
|
|
* @namespace connection
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Provides interfaces to manage and use data networks.
|
|
|
|
* @namespace connection
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
declare namespace connection {
|
2024-01-23 02:33:14 +00:00
|
|
|
/**
|
|
|
|
* Get an HTTP request task.
|
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @since 8
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Get an HTTP request task.
|
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Get an HTTP request task.
|
2024-07-26 04:04:29 +00:00
|
|
|
* @typedef { http.HttpRequest }
|
2024-01-23 02:33:14 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
type HttpRequest = http.HttpRequest;
|
2024-01-23 02:33:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a TCPSocket object.
|
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @since 8
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Get a TCPSocket object.
|
2024-07-26 04:04:29 +00:00
|
|
|
* @typedef { socket.TCPSocket }
|
2024-01-23 02:33:14 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
type TCPSocket = socket.TCPSocket;
|
2024-01-23 02:33:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a UDPSocket object.
|
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @since 8
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Get a UDPSocket object.
|
2024-07-26 04:04:29 +00:00
|
|
|
* @typedef { socket.UDPSocket }
|
2024-01-23 02:33:14 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetStack
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
type UDPSocket = socket.UDPSocket;
|
|
|
|
|
|
|
|
/**
|
2022-11-26 07:31:28 +00:00
|
|
|
* Create a network connection with optional netSpecifier and timeout.
|
2023-12-26 14:12:32 +00:00
|
|
|
* @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}.
|
|
|
|
* @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before
|
2023-05-24 08:23:05 +00:00
|
|
|
* {@link NetConnection#netUnavailable} is called.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { NetConnection } the NetConnection of the NetSpecifier.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Create a network connection with optional netSpecifier and timeout.
|
2023-12-26 14:12:32 +00:00
|
|
|
* @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}.
|
|
|
|
* @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before
|
2023-05-27 08:01:48 +00:00
|
|
|
* {@link NetConnection#netUnavailable} is called.
|
|
|
|
* @returns { NetConnection } the NetConnection of the NetSpecifier.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Create a network connection with optional netSpecifier and timeout.
|
2023-12-26 14:12:32 +00:00
|
|
|
* @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}.
|
|
|
|
* @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before
|
2023-11-20 13:05:43 +00:00
|
|
|
* {@link NetConnection#netUnavailable} is called.
|
|
|
|
* @returns { NetConnection } the NetConnection of the NetSpecifier.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection;
|
|
|
|
|
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<NetHandle> } callback - the callback of getDefaultNet.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { AsyncCallback<NetHandle> } callback - the callback of getDefaultNet.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getDefaultNet(callback: AsyncCallback<NetHandle>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-04-29 08:53:29 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<NetHandle> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { Promise<NetHandle> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getDefaultNet(): Promise<NetHandle>;
|
|
|
|
|
2022-09-13 10:33:53 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2022-09-13 10:33:53 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { NetHandle } if the default network is not activated.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 12:37:42 +00:00
|
|
|
* @since 9
|
2022-09-13 10:33:53 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains the data network that is activated by default.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { NetHandle } if the default network is not activated.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-09-13 10:33:53 +00:00
|
|
|
function getDefaultNetSync(): NetHandle;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains the list of data networks that are activated.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2022-02-18 08:45:55 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<Array<NetHandle>> } callback - the callback of getAllNets.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getAllNets(callback: AsyncCallback<Array<NetHandle>>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains the list of data networks that are activated.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-04-29 08:53:29 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<Array<NetHandle>> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getAllNets(): Promise<Array<NetHandle>>;
|
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Obtains the list of data networks that are activated.
|
|
|
|
* To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { Array<NetHandle> } Returns data networks that are activated.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getAllNetsSync(): Array<NetHandle>;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Queries the connection properties of a network.
|
|
|
|
* This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network to be queried.
|
|
|
|
* @param { AsyncCallback<ConnectionProperties> } callback - the callback of getConnectionProperties.{@link ConnectionProperties}.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback<ConnectionProperties>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Queries the connection properties of a network.
|
|
|
|
* This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network to be queried.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<ConnectionProperties> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getConnectionProperties(netHandle: NetHandle): Promise<ConnectionProperties>;
|
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Queries the connection properties of a network.
|
|
|
|
* This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { NetHandle } netHandle - Indicates the network to be queried.
|
|
|
|
* @returns { ConnectionProperties } Returns the connection properties of a network.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getConnectionPropertiesSync(netHandle: NetHandle): ConnectionProperties;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
|
|
|
* @param { AsyncCallback<NetCapabilities> } callback - the callback of getNetCapabilities.{@link NetCapabilities}.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
|
|
|
* @param { AsyncCallback<NetCapabilities> } callback - the callback of getNetCapabilities.{@link NetCapabilities}.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback<NetCapabilities>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<NetCapabilities> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
|
|
|
* @returns { Promise<NetCapabilities> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getNetCapabilities(netHandle: NetHandle): Promise<NetCapabilities>;
|
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
|
|
|
* @returns { NetCapabilities } Returns the connection capabilities of a network.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Obtains {@link NetCapabilities} of a {@link NetHandle} object.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}.
|
|
|
|
* @returns { NetCapabilities } Returns the connection capabilities of a network.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-19 02:22:14 +00:00
|
|
|
function getNetCapabilitiesSync(netHandle: NetHandle): NetCapabilities;
|
|
|
|
|
2022-11-01 13:54:53 +00:00
|
|
|
/**
|
|
|
|
* Checks whether data traffic usage on the current network is metered.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if data traffic usage on the current network is metered;
|
2023-05-24 09:13:09 +00:00
|
|
|
* returns {@code false} otherwise.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 12:37:42 +00:00
|
|
|
* @since 9
|
2022-11-01 13:54:53 +00:00
|
|
|
*/
|
|
|
|
function isDefaultNetMetered(callback: AsyncCallback<boolean>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-09 07:42:23 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Checks whether data traffic usage on the current network is metered.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<boolean> } the promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2022-11-01 13:54:53 +00:00
|
|
|
function isDefaultNetMetered(): Promise<boolean>;
|
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Checks whether data traffic usage on the current network is metered.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-08-19 02:33:15 +00:00
|
|
|
* @returns { boolean } Returns true if the current network is metered, else returns false.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function isDefaultNetMeteredSync(): boolean;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the default data network is activated.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if the default data network is activated;
|
2023-05-24 08:23:05 +00:00
|
|
|
* returns {@code false} otherwise.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the default data network is activated.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if the default data network is activated;
|
2023-05-27 08:01:48 +00:00
|
|
|
* returns {@code false} otherwise.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function hasDefaultNet(callback: AsyncCallback<boolean>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Checks whether the default data network is activated.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<boolean> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the default data network is activated.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { Promise<boolean> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function hasDefaultNet(): Promise<boolean>;
|
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the default data network is activated.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @returns { boolean } Returns true if the default data network is activated, else returns false.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function hasDefaultNetSync(): boolean;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Enables the airplane mode for a device.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.CONNECTIVITY_INTERNAL} permission.
|
2023-02-14 12:37:42 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-05-24 09:13:09 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of enableAirplaneMode.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2023-05-12 03:17:13 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-15 09:22:13 +00:00
|
|
|
* @systemapi Hide this for inner system use. Only used for system app.
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function enableAirplaneMode(callback: AsyncCallback<void>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Enables the airplane mode for a device.
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.CONNECTIVITY_INTERNAL} permission.
|
2023-04-29 08:53:29 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<void> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2023-05-12 03:17:13 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-15 09:22:13 +00:00
|
|
|
* @systemapi Hide this for inner system use. Only used for system app.
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function enableAirplaneMode(): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-05-24 09:13:09 +00:00
|
|
|
* Disables the airplane mode for a device.
|
2023-05-09 13:59:00 +00:00
|
|
|
* To invoke this method, you must have the {@code ohos.permission.CONNECTIVITY_INTERNAL} permission.
|
2023-02-14 12:37:42 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-05-24 09:13:09 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of disableAirplaneMode.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2023-05-12 03:17:13 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-15 09:22:13 +00:00
|
|
|
* @systemapi Hide this for inner system use. Only used for system app.
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function disableAirplaneMode(callback: AsyncCallback<void>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-05-24 09:13:09 +00:00
|
|
|
* Disables the airplane mode for a device.
|
2023-05-09 13:59:00 +00:00
|
|
|
* To invoke this method, you must have the {@code ohos.permission.CONNECTIVITY_INTERNAL} permission.
|
2023-04-29 08:53:29 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-05-24 09:13:09 +00:00
|
|
|
* @returns { Promise<void> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
2023-05-12 03:17:13 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-15 09:22:13 +00:00
|
|
|
* @systemapi Hide this for inner system use. Only used for system app.
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function disableAirplaneMode(): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reports the network state is connected.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network whose state is to be reported.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of reportNetConnected.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Reports the network state is connected.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network whose state is to be reported.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @returns { Promise<void> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function reportNetConnected(netHandle: NetHandle): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reports the network state is disconnected.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network whose state is to be reported.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of reportNetDisconnected.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Reports the network state is disconnected.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the network whose state is to be reported.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @returns { Promise<void> } The promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function reportNetDisconnected(netHandle: NetHandle): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolves the host name to obtain all IP addresses based on the default data network.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { AsyncCallback<Array<NetAddress>> } callback - Returns the NetAddress list.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
function getAddressesByName(host: string, callback: AsyncCallback<Array<NetAddress>>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolves the host name to obtain all IP addresses based on the default data network.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<Array<NetAddress>> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
function getAddressesByName(host: string): Promise<Array<NetAddress>>;
|
|
|
|
|
2023-02-12 12:00:30 +00:00
|
|
|
/**
|
2023-02-14 13:29:14 +00:00
|
|
|
* Obtains the {@link NetHandle} bound to a process using {@link setAppNet}.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<NetHandle> } callback - Returns the {@link NetHandle} bound to the process;
|
2023-05-24 08:23:05 +00:00
|
|
|
* returns {@code null} if no {@link NetHandle} is bound to the process.For details, see {@link NetHandle}.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 13:29:14 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function getAppNet(callback: AsyncCallback<NetHandle>): void;
|
2023-02-13 05:01:50 +00:00
|
|
|
|
|
|
|
/**
|
2023-02-14 13:29:14 +00:00
|
|
|
* Obtains the {@link NetHandle} bound to a process using {@link setAppNet}.
|
|
|
|
* @returns { Promise<NetHandle> } the promise returned by the function.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 13:29:14 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function getAppNet(): Promise<NetHandle>;
|
2023-02-13 05:01:50 +00:00
|
|
|
|
2023-08-19 02:22:14 +00:00
|
|
|
/**
|
|
|
|
* Obtains the {@link NetHandle} bound to a process using {@link setAppNet}.
|
|
|
|
* @returns { NetHandle } Returns the {@link NetHandle} bound to a process using {@link setAppNet}.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-08-19 02:22:14 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getAppNetSync(): NetHandle;
|
|
|
|
|
2023-02-13 05:01:50 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Binds a process to {@code NetHandle}.
|
2023-02-14 13:29:14 +00:00
|
|
|
* <p>All the sockets created from the process will be bound to the {@code NetHandle},
|
2023-05-09 07:42:23 +00:00
|
|
|
* and the resolution of all host names will be managed by the {@code NetHandle}.</p>
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. For details, see {@link NetHandle}.
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of setAppNet.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 13:29:14 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function setAppNet(netHandle: NetHandle, callback: AsyncCallback<void>): void;
|
2023-02-13 05:01:50 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Binds a process to {@code NetHandle}.
|
2023-02-14 13:29:14 +00:00
|
|
|
* <p>All the sockets created from the process will be bound to the {@code NetHandle},
|
2023-05-09 07:42:23 +00:00
|
|
|
* and the resolution of all host names will be managed by the {@code NetHandle}.</p>
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { NetHandle } netHandle - Indicates the handle. For details, see {@link NetHandle}.
|
2023-02-14 13:29:14 +00:00
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-14 13:29:14 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function setAppNet(netHandle: NetHandle): Promise<void>;
|
2023-02-12 12:00:30 +00:00
|
|
|
|
2023-05-31 08:48:12 +00:00
|
|
|
/**
|
|
|
|
* Obtains the default {@link HttpProxy} proxy settings.
|
|
|
|
*
|
2023-12-04 03:56:01 +00:00
|
|
|
* If an application level proxy is set, the application level proxy parameters are returned.
|
2023-05-31 08:48:12 +00:00
|
|
|
* If a global proxy is set, the global proxy parameters are returned.
|
2023-06-12 08:17:06 +00:00
|
|
|
* If the process is bound to a {@link NetHandle} using {@link setAppNet}, the {@link NetHandle} proxy settings are returned.
|
2023-05-31 08:48:12 +00:00
|
|
|
* In other cases, the proxy settings of default network are returned.
|
|
|
|
*
|
2023-06-12 08:17:06 +00:00
|
|
|
* @param { AsyncCallback<HttpProxy> } callback - Returns the default {@link HttpProxy} settings.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-31 08:48:12 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getDefaultHttpProxy(callback: AsyncCallback<HttpProxy>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the default {@link HttpProxy} proxy settings.
|
|
|
|
*
|
2023-12-04 03:56:01 +00:00
|
|
|
* If an application level proxy is set, the application level proxy parameters are returned.
|
2023-05-31 08:48:12 +00:00
|
|
|
* If a global proxy is set, the global proxy parameters are returned.
|
2023-06-12 08:17:06 +00:00
|
|
|
* If the process is bound to a {@link NetHandle} using {@link setAppNet}, the {@link NetHandle} proxy settings are returned.
|
2023-05-31 08:48:12 +00:00
|
|
|
* In other cases, the proxy settings of default network are returned.
|
|
|
|
*
|
2023-06-12 08:20:39 +00:00
|
|
|
* @returns { Promise<HttpProxy> } the promise returned by the function.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-31 08:48:12 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getDefaultHttpProxy(): Promise<HttpProxy>;
|
|
|
|
|
2023-02-08 07:07:31 +00:00
|
|
|
/**
|
|
|
|
* Obtains the network independent global {@link HttpProxy} proxy settings.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { AsyncCallback<HttpProxy> } callback - Returns the proxy settings. For details, see {@link HttpProxy}.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2023-06-06 05:35:48 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-08 07:07:31 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getGlobalHttpProxy(callback: AsyncCallback<HttpProxy>): void;
|
2023-02-09 01:22:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the network independent global {@link HttpProxy} proxy settings.
|
|
|
|
* @returns { Promise<HttpProxy> } the promise returned by the function.
|
2023-06-06 05:35:48 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-09 01:22:36 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-02-08 07:07:31 +00:00
|
|
|
function getGlobalHttpProxy(): Promise<HttpProxy>;
|
|
|
|
|
2023-12-04 03:56:01 +00:00
|
|
|
/**
|
|
|
|
* Set application level http proxy {@link HttpProxy}.
|
|
|
|
* @param { HttpProxy } httpProxy - Indicates the application level proxy settings. For details, see {@link HttpProxy}.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid http proxy.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function setAppHttpProxy(httpProxy: HttpProxy): void;
|
|
|
|
|
2023-02-08 07:07:31 +00:00
|
|
|
/**
|
|
|
|
* Set a network independent global {@link HttpProxy} proxy settings.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { HttpProxy } httpProxy - Indicates the global proxy settings. For details, see {@link HttpProxy}.
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of setGlobalHttpProxy.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2023-06-06 05:35:48 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-31 08:48:12 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-02-08 07:07:31 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function setGlobalHttpProxy(httpProxy: HttpProxy, callback: AsyncCallback<void>): void;
|
2023-02-09 01:22:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a network independent global {@link HttpProxy} proxy settings.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { HttpProxy } httpProxy - Indicates the global proxy settings. For details, see {@link HttpProxy}.
|
2023-02-09 02:37:41 +00:00
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2023-06-06 05:35:48 +00:00
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-09 01:22:36 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-02-08 07:07:31 +00:00
|
|
|
function setGlobalHttpProxy(httpProxy: HttpProxy): Promise<void>;
|
|
|
|
|
2023-11-10 03:28:10 +00:00
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Add a custom {@link host} and corresponding {@link ip} mapping for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { Array<string> } ip - List of IP addresses mapped to the host name.
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns the callback of addCustomDnsRule.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function addCustomDnsRule(host: string, ip: Array<string>, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Add a custom {@link host} and corresponding {@link ip} mapping for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { Array<string> } ip - List of IP addresses mapped to the host name.
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function addCustomDnsRule(host: string, ip: Array<string>): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Remove the custom DNS rule of the {@link host} for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns the callback of removeCustomDnsRule.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function removeCustomDnsRule(host: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Remove the custom DNS rule of the {@link host} for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function removeCustomDnsRule(host: string): Promise<void>;
|
|
|
|
|
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Clear all custom DNS rules for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @param { AsyncCallback<void> } callback - Returns the callback of clearCustomDnsRules.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function clearCustomDnsRules(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
2023-11-27 06:55:35 +00:00
|
|
|
* Clear all custom DNS rules for current application.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-10 03:28:10 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function clearCustomDnsRules(): Promise<void>;
|
|
|
|
|
2023-11-29 06:08:57 +00:00
|
|
|
/**
|
|
|
|
* factory reset network settings
|
|
|
|
*
|
|
|
|
* To invoke this method, you must have the {@code ohos.permission.CONNECTIVITY_INTERNAL} permission.
|
|
|
|
* @permission ohos.permission.CONNECTIVITY_INTERNAL
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-29 06:08:57 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @systemapi Hide this for inner system use. Only used for system app.
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
function factoryReset(): Promise<void>;
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Represents the network connection handle.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface NetConnection
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Represents the network connection handle.
|
|
|
|
* @interface NetConnection
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Represents the network connection handle.
|
|
|
|
* @interface NetConnection
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface NetConnection {
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netAvailable events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netAvailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netAvailable events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netAvailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netAvailable events.
|
|
|
|
* @param { 'netAvailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
on(type: 'netAvailable', callback: Callback<NetHandle>): void;
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netBlockStatusChange events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netBlockStatusChange' } type - Indicates Event name.
|
|
|
|
* @param { Callback<{ netHandle: NetHandle, blocked: boolean }> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-12-21 10:56:03 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netBlockStatusChange events.
|
|
|
|
* @param { 'netBlockStatusChange' } type - Indicates Event name.
|
2023-12-25 01:56:11 +00:00
|
|
|
* @param { Callback<NetBlockStatusInfo> } callback - the callback used to return the result.
|
2023-12-21 10:56:03 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-12-25 01:56:11 +00:00
|
|
|
on(type: 'netBlockStatusChange', callback: Callback<NetBlockStatusInfo>): void;
|
2022-02-18 08:45:55 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netCapabilitiesChange** events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netCapabilitiesChange' } type - Indicates Event name.
|
2023-07-29 08:05:19 +00:00
|
|
|
* @param { Callback<NetCapabilityInfo> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netCapabilitiesChange** events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netCapabilitiesChange' } type - Indicates Event name.
|
2023-07-29 08:05:19 +00:00
|
|
|
* @param { Callback<NetCapabilityInfo> } callback - the callback used to return the result.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netCapabilitiesChange** events.
|
|
|
|
* @param { 'netCapabilitiesChange' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetCapabilityInfo> } callback - the callback used to return the result.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-07-29 08:05:19 +00:00
|
|
|
on(type: 'netCapabilitiesChange', callback: Callback<NetCapabilityInfo>): void;
|
2023-05-06 03:00:44 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netConnectionPropertiesChange events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netConnectionPropertiesChange' } type - Indicates Event name.
|
|
|
|
* @param { Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-12-21 10:56:03 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netConnectionPropertiesChange events.
|
|
|
|
* @param { 'netConnectionPropertiesChange' } type - Indicates Event name.
|
2023-12-25 01:56:11 +00:00
|
|
|
* @param { Callback<NetConnectionPropertyInfo> } callback - the callback used to return the result.
|
2023-12-21 10:56:03 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-12-25 01:56:11 +00:00
|
|
|
on(type: 'netConnectionPropertiesChange', callback: Callback<NetConnectionPropertyInfo>): void;
|
2022-02-18 08:45:55 +00:00
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netLost** events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netLost' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netLost** events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netLost' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for **netLost** events.
|
|
|
|
* @param { 'netLost' } type - Indicates Event name.
|
|
|
|
* @param { Callback<NetHandle> } callback - the callback used to return the result.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
on(type: 'netLost', callback: Callback<NetHandle>): void;
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netUnavailable events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netUnavailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<void> } callback - the callback used to return the result.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netUnavailable events.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { 'netUnavailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<void> } callback - the callback used to return the result.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Registers a listener for netUnavailable events.
|
|
|
|
* @param { 'netUnavailable' } type - Indicates Event name.
|
|
|
|
* @param { Callback<void> } callback - the callback used to return the result.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
on(type: 'netUnavailable', callback: Callback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Receives status change notifications of a specified network.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
2023-05-24 09:13:09 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of register.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-05-27 03:09:15 +00:00
|
|
|
* @throws { BusinessError } 2101008 - The callback already exists.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Receives status change notifications of a specified network.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of register.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-05-27 03:09:15 +00:00
|
|
|
* @throws { BusinessError } 2101008 - The callback already exists.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Receives status change notifications of a specified network.
|
|
|
|
* @permission ohos.permission.GET_NETWORK_INFO
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of register.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-05-27 03:09:15 +00:00
|
|
|
* @throws { BusinessError } 2101008 - The callback already exists.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
2023-11-21 06:44:35 +00:00
|
|
|
* @atomicservice
|
2023-11-20 13:05:43 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
register(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancels listening for network status changes.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of unregister.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-07-11 03:08:12 +00:00
|
|
|
* @throws { BusinessError } 2101007 - The callback does not exist.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Cancels listening for network status changes.
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of unregister.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-07-11 03:08:12 +00:00
|
|
|
* @throws { BusinessError } 2101007 - The callback does not exist.
|
2023-05-27 08:01:48 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Cancels listening for network status changes.
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of unregister.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-07-11 03:08:12 +00:00
|
|
|
* @throws { BusinessError } 2101007 - The callback does not exist.
|
2023-11-20 13:05:43 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2024-03-20 11:44:19 +00:00
|
|
|
/**
|
|
|
|
* Cancels listening for network status changes.
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of unregister.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2024-03-20 11:44:19 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
2024-07-11 03:08:12 +00:00
|
|
|
* @throws { BusinessError } 2101007 - The callback does not exist.
|
2024-03-20 11:44:19 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
unregister(callback: AsyncCallback<void>): void;
|
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
2023-05-09 13:59:00 +00:00
|
|
|
* Provides an instance that bear data network capabilities.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface NetSpecifier
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Provides an instance that bear data network capabilities.
|
|
|
|
* @interface NetSpecifier
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface NetSpecifier {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* The transmission capacity and support of the network's global proxy storage data network.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {NetCapabilities}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* The transmission capacity and support of the network's global proxy storage data network.
|
|
|
|
* @type {NetCapabilities}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
netCapabilities: NetCapabilities;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-06 03:00:44 +00:00
|
|
|
* Network identifier, the identifier for Wi Fi networks is "wifi", and the identifier for cellular networks is "simId1" (corresponding to SIM card 1).
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Network identifier, the identifier for Wi Fi networks is "wifi", and the identifier for cellular networks is "simId1" (corresponding to SIM card 1).
|
|
|
|
* @type {?string}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
bearerPrivateIdentifier?: string;
|
|
|
|
}
|
|
|
|
|
2023-07-28 10:46:17 +00:00
|
|
|
/**
|
|
|
|
* Receive information about changes in network capabilities.
|
2023-07-29 08:05:19 +00:00
|
|
|
* @interface NetCapabilityInfo
|
2023-07-28 10:46:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Receive information about changes in network capabilities.
|
|
|
|
* @interface NetCapabilityInfo
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-07-29 08:05:19 +00:00
|
|
|
export interface NetCapabilityInfo {
|
2023-07-28 10:46:17 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
2023-07-28 11:48:36 +00:00
|
|
|
* @type { NetHandle }
|
2023-07-28 10:46:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-07-29 01:40:14 +00:00
|
|
|
* @crossplatform
|
2023-07-28 10:46:17 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
|
|
|
* @type { NetHandle }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-07-28 10:46:17 +00:00
|
|
|
netHandle: NetHandle;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines the network capability set.
|
|
|
|
* @type { NetCapabilities }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability set.
|
|
|
|
* @type { NetCapabilities }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-07-29 08:05:19 +00:00
|
|
|
netCap: NetCapabilities;
|
2023-07-28 10:46:17 +00:00
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface NetHandle
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
2023-05-05 12:38:39 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
|
|
|
* @interface NetHandle
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
|
|
|
* @interface NetHandle
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface NetHandle {
|
2023-05-09 13:59:00 +00:00
|
|
|
/**
|
|
|
|
* Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100.
|
|
|
|
* @type {number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-09 13:59:00 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100.
|
|
|
|
* @type {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100.
|
|
|
|
* @type {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
netId: number;
|
|
|
|
|
2022-09-28 09:49:43 +00:00
|
|
|
/**
|
2023-05-09 07:42:23 +00:00
|
|
|
* <p>Binds a TCPSocket or UDPSocket to the current network. All data flows from
|
|
|
|
* the socket will use this network, without being subject to {@link setAppNet}.</p>
|
2022-09-28 09:49:43 +00:00
|
|
|
* Before using this method, ensure that the socket is disconnected.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { TCPSocket | UDPSocket } socketParam - Indicates the TCPSocket or UDPSocket object.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - the callback of bindSocket.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2022-09-28 09:49:43 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
bindSocket(socketParam: TCPSocket | UDPSocket, callback: AsyncCallback<void>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-09 07:42:23 +00:00
|
|
|
* <p>Binds a TCPSocket or UDPSocket to the current network. All data flows from
|
|
|
|
* the socket will use this network, without being subject to {@link setAppNet}.</p>
|
2023-04-29 08:53:29 +00:00
|
|
|
* Before using this method, ensure that the socket is disconnected.
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { TCPSocket | UDPSocket } socketParam - Indicates the TCPSocket or UDPSocket object.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2022-09-28 09:49:43 +00:00
|
|
|
bindSocket(socketParam: TCPSocket | UDPSocket): Promise<void>;
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
|
|
|
* Resolves a host name to obtain all IP addresses based on the specified NetHandle.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { AsyncCallback<Array<NetAddress>> } callback - the callback of getAddressesByName.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
getAddressesByName(host: string, callback: AsyncCallback<Array<NetAddress>>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Resolves a host name to obtain all IP addresses based on the specified NetHandle.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<Array<NetAddress>> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
getAddressesByName(host: string): Promise<Array<NetAddress>>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolves a host name to obtain the first IP address based on the specified NetHandle.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
|
|
|
* @param { AsyncCallback<NetAddress> } callback - the callback of getAddressByName.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
|
|
|
getAddressByName(host: string, callback: AsyncCallback<NetAddress>): void;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Resolves a host name to obtain the first IP address based on the specified NetHandle.
|
2023-05-24 09:13:09 +00:00
|
|
|
* @permission ohos.permission.INTERNET
|
2023-06-09 06:08:43 +00:00
|
|
|
* @param { string } host - Indicates the host name or the domain.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @returns { Promise<NetAddress> } The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 201 - Permission denied.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @throws { BusinessError } 2100001 - Invalid parameter value.
|
2024-05-09 03:33:58 +00:00
|
|
|
* @throws { BusinessError } 2100002 - Failed to connect to the service.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @throws { BusinessError } 2100003 - System internal error.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
getAddressByName(host: string): Promise<NetAddress>;
|
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability set.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface NetCapabilities
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 12:38:39 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability set.
|
|
|
|
* @interface NetCapabilities
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability set.
|
|
|
|
* @interface NetCapabilities
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface NetCapabilities {
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Uplink (device-to-network) bandwidth.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
linkUpBandwidthKbps?: number;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Downstream (network-to-device) bandwidth.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
linkDownBandwidthKbps?: number;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Network-specific capabilities.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?Array<NetCap>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Network-specific capabilities.
|
|
|
|
* @type {?Array<NetCap>}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
networkCap?: Array<NetCap>;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Network type.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {Array<NetBearType>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Network type.
|
|
|
|
* @type {Array<NetBearType>}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Network type.
|
|
|
|
* @type {Array<NetBearType>}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
bearerTypes: Array<NetBearType>;
|
|
|
|
}
|
|
|
|
|
2023-12-21 10:56:03 +00:00
|
|
|
/**
|
|
|
|
* Get information about network connections.
|
2023-12-25 01:56:11 +00:00
|
|
|
* @interface NetConnectionPropertyInfo
|
2023-12-21 10:56:03 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-12-25 01:56:11 +00:00
|
|
|
export interface NetConnectionPropertyInfo {
|
2023-12-21 10:56:03 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
|
|
|
* @type { NetHandle }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
netHandle: NetHandle;
|
|
|
|
/**
|
|
|
|
* Defines the network connection properties.
|
|
|
|
* @type { ConnectionProperties }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-12-25 01:56:11 +00:00
|
|
|
* @since 11
|
2023-12-21 10:56:03 +00:00
|
|
|
*/
|
|
|
|
connectionProperties: ConnectionProperties;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get network status information.
|
2023-12-25 01:56:11 +00:00
|
|
|
* @interface NetBlockStatusInfo
|
2023-12-21 10:56:03 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-12-25 01:56:11 +00:00
|
|
|
export interface NetBlockStatusInfo {
|
2023-12-21 10:56:03 +00:00
|
|
|
/**
|
|
|
|
* Defines the handle of the data network.
|
|
|
|
* @type { NetHandle }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
netHandle: NetHandle;
|
|
|
|
/**
|
|
|
|
* Check whether the current state is blocked.
|
|
|
|
* @type { boolean }
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-12-25 01:56:11 +00:00
|
|
|
* @since 11
|
2023-12-21 10:56:03 +00:00
|
|
|
*/
|
|
|
|
blocked: boolean;
|
|
|
|
}
|
|
|
|
|
2023-05-09 13:59:00 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability.
|
|
|
|
* @enum {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 8
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Defines the network capability.
|
|
|
|
* @enum {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export enum NetCap {
|
|
|
|
/**
|
|
|
|
* Indicates that the network can access the carrier's MMSC to send and receive multimedia messages.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network can access the carrier's MMSC to send and receive multimedia messages.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
NET_CAPABILITY_MMS = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network traffic is not metered.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network traffic is not metered.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
NET_CAPABILITY_NOT_METERED = 11,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network can access the Internet.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network can access the Internet.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
NET_CAPABILITY_INTERNET = 12,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network does not use a VPN.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network does not use a VPN.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
NET_CAPABILITY_NOT_VPN = 15,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network is available.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is available.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
NET_CAPABILITY_VALIDATED = 16,
|
2024-03-23 03:41:52 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is portal.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-08-15 09:29:08 +00:00
|
|
|
NET_CAPABILITY_PORTAL = 17,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network is checking connectivity.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
NET_CAPABILITY_CHECKING_CONNECTIVITY = 31
|
2022-02-18 08:45:55 +00:00
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Enumerates network types.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @enum {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 12:38:39 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Enumerates network types.
|
|
|
|
* @enum {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Enumerates network types.
|
|
|
|
* @enum {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export enum NetBearType {
|
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a cellular network.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a cellular network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a cellular network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
BEARER_CELLULAR = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a Wi-Fi network.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-05-27 08:01:48 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a Wi-Fi network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a Wi-Fi network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
BEARER_WIFI = 1,
|
|
|
|
|
2024-08-15 09:29:08 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a bluetooth network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @crossplatform
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
BEARER_BLUETOOTH = 2,
|
|
|
|
|
2022-02-18 08:45:55 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is an Ethernet network.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2022-02-18 08:45:55 +00:00
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the network is an Ethernet network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
BEARER_ETHERNET = 3,
|
2024-03-15 09:03:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the network is based on a VPN network.
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
BEARER_VPN = 4,
|
2022-02-18 08:45:55 +00:00
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Defines the network connection properties.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface ConnectionProperties
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 12:38:39 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface ConnectionProperties {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Network card name.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
interfaceName: string;
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Domain. The default value is "".
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
domains: string;
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Link information.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {Array<LinkAddress>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
linkAddresses: Array<LinkAddress>;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Network address, refer to [NetAddress].
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {Array<NetAddress>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
dnses: Array<NetAddress>;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Routing information.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {Array<RouteInfo>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
routes: Array<RouteInfo>;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2023-05-05 08:16:02 +00:00
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Maximum transmission unit.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
mtu: number;
|
|
|
|
}
|
|
|
|
|
2023-05-06 03:00:44 +00:00
|
|
|
/**
|
|
|
|
* Defines network route information.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface RouteInfo
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-06 03:00:44 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface RouteInfo {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Network card name.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
interface: string;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destination Address
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {LinkAddress}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
destination: LinkAddress;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gateway address.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {NetAddress}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
gateway: NetAddress;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Whether a gateway is present.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {boolean}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
hasGateway: boolean;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Whether the route is the default route.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {boolean}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
isDefaultRoute: boolean;
|
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Defines network link information.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface LinkAddress
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 12:38:39 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface LinkAddress {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Link address.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {NetAddress}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
address: NetAddress;
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* The length of the link address prefix.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
prefixLength: number;
|
|
|
|
}
|
|
|
|
|
2023-05-05 12:38:39 +00:00
|
|
|
/**
|
|
|
|
* Defines a network address.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @interface NetAddress
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 12:38:39 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
2024-06-14 08:26:15 +00:00
|
|
|
/**
|
|
|
|
* Defines a network address.
|
|
|
|
* @interface NetAddress
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
export interface NetAddress {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Network address.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2024-06-14 08:26:15 +00:00
|
|
|
/**
|
|
|
|
* Network address.
|
|
|
|
* @type {string}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2022-02-18 08:45:55 +00:00
|
|
|
address: string;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Address family identifier. The value is 1 for IPv4 and 2 for IPv6. The default value is 1.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2024-06-14 08:26:15 +00:00
|
|
|
/**
|
|
|
|
* Address family identifier. The value is 1 for IPv4 and 2 for IPv6. The default value is 1.
|
|
|
|
* @type {?number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2023-05-05 08:16:02 +00:00
|
|
|
family?: number;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-05 08:16:02 +00:00
|
|
|
* Port number. The value ranges from 0 to 65535.
|
2023-05-24 08:23:05 +00:00
|
|
|
* @type {?number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-05-05 08:16:02 +00:00
|
|
|
* @since 8
|
2023-04-29 08:53:29 +00:00
|
|
|
*/
|
2024-06-14 08:26:15 +00:00
|
|
|
/**
|
|
|
|
* Port number. The value ranges from 0 to 65535.
|
|
|
|
* @type {?number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2023-05-05 08:16:02 +00:00
|
|
|
port?: number;
|
2022-02-18 08:45:55 +00:00
|
|
|
}
|
2023-02-08 07:07:31 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-29 08:53:29 +00:00
|
|
|
* Network Global Proxy Configuration Information.
|
2023-05-24 07:34:39 +00:00
|
|
|
* @interface HttpProxy
|
2023-05-09 07:42:23 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-02-08 07:07:31 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Network Global Proxy Configuration Information.
|
|
|
|
* @interface HttpProxy
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-02-08 07:07:31 +00:00
|
|
|
export interface HttpProxy {
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Proxy server host name.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {string}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Proxy server host name.
|
|
|
|
* @type {string}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-02-08 07:07:31 +00:00
|
|
|
host: string;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Host port.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {number}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Host port.
|
|
|
|
* @type {number}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-02-08 07:07:31 +00:00
|
|
|
port: number;
|
2023-04-29 08:53:29 +00:00
|
|
|
|
2024-02-02 02:27:30 +00:00
|
|
|
/**
|
|
|
|
* Http proxy username.
|
|
|
|
* @type {?string}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
username?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Http proxy password.
|
|
|
|
* @type {?string}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
password?: string;
|
|
|
|
|
2023-04-29 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* Do not use a blocking list for proxy servers.
|
2023-05-09 07:42:23 +00:00
|
|
|
* @type {Array<string>}
|
2023-05-24 09:13:09 +00:00
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
2023-04-29 08:53:29 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-20 13:05:43 +00:00
|
|
|
/**
|
|
|
|
* Do not use a blocking list for proxy servers.
|
|
|
|
* @type {Array<string>}
|
|
|
|
* @syscap SystemCapability.Communication.NetManager.Core
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-02-09 02:37:41 +00:00
|
|
|
exclusionList: Array<string>;
|
2023-02-08 07:07:31 +00:00
|
|
|
}
|
2022-02-18 08:45:55 +00:00
|
|
|
}
|
|
|
|
|
2024-01-23 02:33:14 +00:00
|
|
|
export default connection;
|