2022-10-20 09:57:17 +00:00
|
|
|
/*
|
2023-02-11 01:36:01 +00:00
|
|
|
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
|
2022-10-20 09:57:17 +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-04-04 02:17:06 +00:00
|
|
|
import { AsyncCallback, Callback } from './@ohos.base';
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-02-01 00:58:47 +00:00
|
|
|
* Provides methods to operate or manage Wi-Fi.
|
2022-12-06 09:36:25 +00:00
|
|
|
* @namespace wifiManager
|
2022-10-20 09:57:17 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2022-10-21 06:09:11 +00:00
|
|
|
declare namespace wifiManager {
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Enable Wi-Fi.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501003 - Failed for wifi is closing.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function enableWifi(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable Wi-Fi.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501004 - Failed for wifi is opening.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function disableWifi(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the Wi-Fi status
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isWifiActive(): boolean;
|
|
|
|
|
|
|
|
/**
|
2023-05-31 14:41:17 +00:00
|
|
|
* Scan Wi-Fi hotspot, This API works in asynchronous mode.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-07-25 00:40:50 +00:00
|
|
|
* @deprecated since 10
|
|
|
|
* @useinstead wifiManager.startScan
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function scan(): void;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Scan Wi-Fi hotspot.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function startScan(): void;
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Obtain the scanned sta list.
|
2023-07-19 06:56:52 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
|
|
|
|
* (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
|
|
|
|
* @returns { Promise<Array<WifiScanInfo>> } Returns information about scanned Wi-Fi hotspot if any.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
2023-07-25 00:40:50 +00:00
|
|
|
* @deprecated since 10
|
|
|
|
* @useinstead wifiManager.getScanInfoList
|
2023-07-19 06:56:52 +00:00
|
|
|
*/
|
|
|
|
function getScanResults(): Promise<Array<WifiScanInfo>>;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the scanned sta list.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
|
|
|
|
* (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
|
|
|
|
* @param { AsyncCallback<Array<WifiScanInfo>> } callback - Returns information about scanned Wi-Fi hotspot if any.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
2023-07-25 00:40:50 +00:00
|
|
|
* @deprecated since 10
|
|
|
|
* @useinstead wifiManager.getScanInfoList
|
2023-07-19 06:56:52 +00:00
|
|
|
*/
|
|
|
|
function getScanResults(callback: AsyncCallback<Array<WifiScanInfo>>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the scanned sta list.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or
|
|
|
|
* (ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION))
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-07-25 00:40:50 +00:00
|
|
|
* @deprecated since 10
|
|
|
|
* @useinstead wifiManager.getScanInfoList
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function getScanResultsSync(): Array<WifiScanInfo>;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the scanned station list. If does't have the permission of ohos.permission.GET_WIFI_PEERS_MAC, return random bssid.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Array<WifiScanInfo> } Returns information about scanned Wi-Fi hotspot if any.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getScanInfoList(): Array<WifiScanInfo>;
|
|
|
|
|
2023-07-08 06:57:08 +00:00
|
|
|
/**
|
|
|
|
* User can trigger scan even Wi-Fi is disabled.
|
2023-07-09 14:51:46 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
|
2023-07-08 06:57:08 +00:00
|
|
|
* @param { boolean } isScanAlwaysAllowed - true for allow trigger scan, otherwise don't allow trigger scan when Wi-Fi is disabled.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function setScanAlwaysAllowed(isScanAlwaysAllowed: boolean): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get scan always allowed flag.
|
2023-07-09 14:51:46 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
2023-07-08 06:57:08 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if scan running state is true, returns {@code false} otherwise.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getScanAlwaysAllowed(): boolean;
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
2023-05-31 14:41:17 +00:00
|
|
|
* Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p>
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
|
2023-06-01 02:42:10 +00:00
|
|
|
* @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network.
|
|
|
|
* @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function addDeviceConfig(config: WifiDeviceConfig): Promise<number>;
|
2023-06-01 02:42:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add Wi-Fi connection configuration to the device. The configuration will be updated when the configuration is added.</p>
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
|
|
|
|
* @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi network.
|
|
|
|
* @param { AsyncCallback<number> } callback - Indicates call back of addDeviceConfig.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a specified candidate hotspot configuration and returns the networkId.
|
2023-05-31 14:41:17 +00:00
|
|
|
* This method adds one configuration at a time. After this configuration is added,
|
2023-04-21 09:47:24 +00:00
|
|
|
* your device will determine whether to connect to the hotspot.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO
|
|
|
|
* @param { WifiDeviceConfig } config - candidate config.
|
2023-06-01 02:42:10 +00:00
|
|
|
* @returns { Promise<number> } Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function addCandidateConfig(config: WifiDeviceConfig): Promise<number>;
|
2023-06-01 02:42:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a specified candidate hotspot configuration and returns the networkId.
|
|
|
|
* This method adds one configuration at a time. After this configuration is added,
|
|
|
|
* your device will determine whether to connect to the hotspot.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO
|
|
|
|
* @param { WifiDeviceConfig } config - candidate config.
|
|
|
|
* @param { AsyncCallback<number> } callback - Indicates call back of addCandidateConfig.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed
|
|
|
|
* to be removed.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO
|
2023-06-01 02:42:10 +00:00
|
|
|
* @param { number } networkId - Network ID which will be removed.
|
2023-06-01 03:21:49 +00:00
|
|
|
* @returns { Promise<void> } Return results.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function removeCandidateConfig(networkId: number): Promise<void>;
|
2023-06-01 02:42:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a specified candidate hotspot configuration, only the configuration which is added by ourself is allowed
|
|
|
|
* to be removed.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO
|
2023-06-01 03:21:49 +00:00
|
|
|
* @param { number } networkId - Network ID which will be removed.
|
2023-06-01 02:42:10 +00:00
|
|
|
* @param { AsyncCallback<void> } callback - Indicates call back of removeCandidateConfig.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function removeCandidateConfig(networkId: number, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the list of all existed candidate Wi-Fi configurations which added by ourself.
|
2023-05-31 14:41:17 +00:00
|
|
|
* You can obtain only the Wi-Fi configurations you created on your own application.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the list of all existed candidate Wi-Fi configurations which added by ourself.
|
|
|
|
* You can obtain only the Wi-Fi configurations you created on your own application.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Array<WifiDeviceConfig> } Returns the list of all existed Wi-Fi configurations you created on your application.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getCandidateConfigs(): Array<WifiDeviceConfig>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Connect to a specified candidate hotspot by networkId, only the configuration which is added by ourself
|
2023-05-31 14:41:17 +00:00
|
|
|
* is allowed to be connected. This method connect to a configuration at a time.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO
|
|
|
|
* @param { number } networkId - Network ID which will be connected.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function connectToCandidateConfig(networkId: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Connect to Wi-Fi hotspot by networkId.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_CONNECTION
|
|
|
|
* @param { number } networkId - ID of the connected network.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function connectToNetwork(networkId: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Connect to Wi-Fi hotspot by WifiDeviceConfig.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and
|
|
|
|
* ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-06-01 03:21:49 +00:00
|
|
|
* @param { WifiDeviceConfig } config - Indicates the device configuration for connection to the Wi-Fi hotspot.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function connectToDevice(config: WifiDeviceConfig): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disconnect connection between sta and Wi-Fi hotspot.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function disconnect(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { number } rssi - Indicates the Wi-Fi RSSI.
|
|
|
|
* @param { number } band - Indicates the Wi-Fi frequency band.
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { number } Returns Wi-Fi signal level ranging from 0 to 4.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getSignalLevel(rssi: number, band: number): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain connection information about the Wi-Fi connection.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:42:10 +00:00
|
|
|
* @returns { Promise<WifiLinkedInfo> } Returns Wi-Fi linked information.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getLinkedInfo(): Promise<WifiLinkedInfo>;
|
2023-06-01 02:42:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain connection information about the Wi-Fi connection.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { AsyncCallback<WifiLinkedInfo> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the Wi-Fi connection has been set up.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isConnected(): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the features supported by the device.
|
2023-05-31 14:41:17 +00:00
|
|
|
* To check whether this device supports a specified feature.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { number } Returns the features supported by this device.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2401000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getSupportedFeatures(): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the device supports a specified feature.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { number } featureId Indicates the ID of the feature.
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2401000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isFeatureSupported(featureId: number): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the MAC address of a Wi-Fi device. Wi-Fi must be enabled.
|
2023-05-31 14:41:17 +00:00
|
|
|
* The MAC address is unique and cannot be changed.
|
|
|
|
* @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { string[] } Returns the MAC address of the Wi-Fi device.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getDeviceMacAddress(): string[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the IP information of the Wi-Fi connection.
|
2023-05-31 14:41:17 +00:00
|
|
|
* The IP information includes the host IP address, gateway address, and DNS information.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { IpInfo } Returns the IP information of the Wi-Fi connection.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getIpInfo(): IpInfo;
|
|
|
|
|
2023-07-08 06:57:08 +00:00
|
|
|
/**
|
|
|
|
* Obtain the IPv6 information of the Wi-Fi connection.
|
|
|
|
* The IPv6 information includes the host IP address, gateway address, and DNS information.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Ipv6Info } Returns the IPv6 information of the Wi-Fi connection.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
function getIpv6Info(): Ipv6Info;
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Obtain the country code of the device.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { string } Returns the country code of this device.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2401000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getCountryCode(): string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Re-associate to current network.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function reassociate(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Re-connect to current network.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @throws {BusinessError} 2501001 - Wifi is closed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function reconnect(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the list of all existed Wi-Fi configurations.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.GET_WIFI_CONFIG
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the list of all existed Wi-Fi configurations.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
|
|
|
* @returns { Array<WifiDeviceConfig> } Returns the list of all existing Wi-Fi configurations you created on your application.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getDeviceConfigs(): Array<WifiDeviceConfig>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the specified Wi-Fi configuration.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG
|
|
|
|
* @param { WifiDeviceConfig } config Indicates the Wi-Fi configuration to update.
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { number } Returns the network ID in the updated Wi-Fi configuration if the update is successful;
|
2023-04-21 09:47:24 +00:00
|
|
|
* returns {@code -1} if the specified Wi-Fi configuration is not contained in the list.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function updateNetwork(config: WifiDeviceConfig): number;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable the specified DeviceConfig by networkId.
|
2023-05-31 14:41:17 +00:00
|
|
|
* The disabled DeviceConfig will not be associated with again.
|
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-07-19 06:56:52 +00:00
|
|
|
* @param { number } netId Identifies the network to disable.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function disableNetwork(netId: number): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all the saved Wi-Fi configurations.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function removeAllNetwork(): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a Wi-Fi DeviceConfig with networkId.
|
2023-05-31 14:41:17 +00:00
|
|
|
* After a Wi-Fi DeviceConfig is removed, its configuration will be deleted from the list of Wi-Fi configurations.
|
2023-04-21 09:47:24 +00:00
|
|
|
* If the Wi-Fi DeviceConfig is being connected, the connection will be interrupted.
|
|
|
|
* The application can only delete Wi-Fi DeviceConfig it has created.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-07-19 06:56:52 +00:00
|
|
|
* @param { number } id - Indicate the ID of the Wi-Fi DeviceConfig.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function removeDevice(id: number): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether the current device supports the specified band.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 03:36:25 +00:00
|
|
|
* @param { WifiBandType } bandType - Indicates the band type.
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean }Returns {@code true} if the specified band is supported, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isBandTypeSupported(bandType: WifiBandType): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the supported 5G channel list of the device.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { Array<number> } Returns 5G channel list.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function get5GChannelList(): Array<number>;
|
|
|
|
|
2023-05-29 08:55:14 +00:00
|
|
|
/**
|
2023-05-30 12:58:41 +00:00
|
|
|
* Obtain the latest disconnected reason.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { DisconnectedReason } Returns the latest disconnected reason.
|
2023-05-29 08:55:14 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 10
|
2023-05-29 08:55:14 +00:00
|
|
|
*/
|
2023-05-30 12:58:41 +00:00
|
|
|
function getDisconnectedReason(): DisconnectedReason;
|
2023-05-29 08:55:14 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Enable Wi-Fi hotspot function.
|
2023-05-31 14:41:17 +00:00
|
|
|
* This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled.
|
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function enableHotspot(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable Wi-Fi hotspot function.
|
2023-05-31 14:41:17 +00:00
|
|
|
* This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled.
|
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function disableHotspot(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if the method is called successfully, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isHotspotDualBandSupported(): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether Wi-Fi hotspot is active on a device.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { boolean } {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function isHotspotActive(): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the hotspot configuration for the device.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
|
|
|
* @param { HotspotConfig } config - Indicates the Wi-Fi hotspot configuration.
|
2023-04-21 09:47:24 +00:00
|
|
|
* The SSID and {@code securityType} must be available and correct.
|
|
|
|
* If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function setHotspotConfig(config: HotspotConfig): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the Wi-Fi hotspot configuration.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { HotspotConfig } Returns the configuration of an existed or enabled Wi-Fi hotspot.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getHotspotConfig(): HotspotConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the list of stations that are connected to the Wi-Fi hotspot.
|
2023-05-31 14:41:17 +00:00
|
|
|
* This method can only be used on a device that serves as a Wi-Fi hotspot.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the list of stations that are connected to the Wi-Fi hotspot.
|
|
|
|
* This method can only be used on a device that serves as a Wi-Fi hotspot.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT
|
|
|
|
* @returns { Array<StationInfo> } the list of clients that are connected to the Wi-Fi hotspot.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function getStations(): Array<StationInfo>;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the P2P connection.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 03:21:49 +00:00
|
|
|
* @returns { Promise<WifiP2pLinkedInfo> } Returns p2p linked information.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo>;
|
2023-06-01 03:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the P2P connection.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { AsyncCallback<WifiP2pLinkedInfo> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the current p2p group.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 03:02:24 +00:00
|
|
|
* @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain information about the current p2p group.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Promise<WifiP2pGroupInfo> } Returns p2p group information.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-07-19 07:37:34 +00:00
|
|
|
function getCurrentP2pGroup(): Promise<WifiP2pGroupInfo>;
|
2023-06-01 03:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the current p2p group.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
|
|
|
* @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain information about the current p2p group.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { AsyncCallback<WifiP2pGroupInfo> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-07-19 07:37:34 +00:00
|
|
|
function getCurrentP2pGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the information about the found devices.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 03:02:24 +00:00
|
|
|
* @returns { Promise<WifiP2pDevice[]> } Returns p2p device information.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the information about the found devices.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Promise<WifiP2pDevice[]> } Returns p2p device information.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pPeerDevices(): Promise<WifiP2pDevice[]>;
|
2023-06-01 03:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the information about the found devices.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
|
|
|
* @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain the information about the found devices.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { AsyncCallback<WifiP2pDevice[]> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the information about own device information.
|
2023-05-31 14:41:17 +00:00
|
|
|
* DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00",
|
2023-04-21 09:47:24 +00:00
|
|
|
* if ohos.permission.GET_WIFI_LOCAL_MAC is not granted.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
2023-06-01 03:02:24 +00:00
|
|
|
* @returns { Promise<WifiP2pDevice> } Returns the information about own device info.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function getP2pLocalDevice(): Promise<WifiP2pDevice>;
|
2023-06-01 03:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the information about own device information.
|
|
|
|
* DeviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00",
|
|
|
|
* if ohos.permission.GET_WIFI_LOCAL_MAC is not granted.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG
|
|
|
|
* @param { AsyncCallback<WifiP2pDevice> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a P2P group.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { WifiP2PConfig } config - Indicates the configuration for a group.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function createGroup(config: WifiP2PConfig): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a P2P group.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function removeGroup(): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initiate a P2P connection to a device with the specified configuration.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
|
|
|
* @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Initiate a P2P connection to a device with the specified configuration.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { WifiP2PConfig } config - Indicates the configuration for connecting to a specific group.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function p2pConnect(config: WifiP2PConfig): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop an ongoing p2p connection that is being established.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function p2pCancelConnect(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start discover Wi-Fi P2P devices.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Start discover Wi-Fi P2P devices.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function startDiscoverDevices(): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stop discover Wi-Fi P2P devices.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function stopDiscoverDevices(): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete the persistent P2P group with the specified network ID.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
|
|
|
* @param { number } netId - Indicates the network ID of the group to be deleted.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 14:41:17 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function deletePersistentGroup(netId: number): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the groups.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 03:02:24 +00:00
|
|
|
* @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain information about the groups.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @returns { Promise<Array<WifiP2pGroupInfo>> } Returns the information about own device info.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>;
|
2023-06-01 03:02:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain information about the groups.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
|
|
|
* @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Obtain information about the groups.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { AsyncCallback<Array<WifiP2pGroupInfo>> } callback - Indicates callback of function.
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the name of the Wi-Fi P2P device.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION
|
|
|
|
* @param { string } devName - Indicate the name to be set.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
function setDeviceName(devName: string): void;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi status change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "wifiStateChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi status change events.
|
|
|
|
*
|
|
|
|
* <p>All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "wifiStateChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi connection change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiConnectionChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 0: disconnected, 1: connected
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "wifiConnectionChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi connection change events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiConnectionChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "wifiConnectionChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi scan status change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiScanStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 0: scan fail, 1: scan success
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "wifiScanStateChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi scan status change events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiScanStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "wifiScanStateChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi rssi change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiRssiChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "wifiRssiChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi rssi change events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "wifiRssiChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "wifiRssiChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi stream change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "streamChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 1: stream down, 2: stream up, 3: stream bidirectional
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "streamChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi stream change events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_CONNECTION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "streamChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "streamChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi device config change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "deviceConfigChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 0: config is added, 1: config is changed, 2: config is removed.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "deviceConfigChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi device config change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "deviceConfigChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off, 0: config is added, 1: config is changed, 2: config is removed.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2501000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "deviceConfigChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi hotspot state change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 0: inactive, 1: active, 2: activating, 3: de-activating
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "hotspotStateChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi hotspot state change events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "hotspotStateChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi hotspot sta join events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStaJoin" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<StationInfo> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "hotspotStaJoin", callback: Callback<StationInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi hotspot sta join events.
|
2023-05-31 14:41:17 +00:00
|
|
|
* All callback functions will be deregistered If there is no specific callback parameter.</p>
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStaJoin" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<StationInfo> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "hotspotStaJoin", callback?: Callback<StationInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe Wi-Fi hotspot sta leave events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStaLeave" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<StationInfo> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 13:06:44 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "hotspotStaLeave", callback: Callback<StationInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe Wi-Fi hotspot sta leave events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "hotspotStaLeave" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<StationInfo> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2601000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "hotspotStaLeave", callback?: Callback<StationInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P status change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on, 1: idle, 2: starting, 3:started, 4: closing, 5: closed
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "p2pStateChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P status change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pStateChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "p2pStateChange", callback?: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P connection change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pConnectionChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pLinkedInfo> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "p2pConnectionChange", callback: Callback<WifiP2pLinkedInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P connection change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pConnectionChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pLinkedInfo> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "p2pConnectionChange", callback?: Callback<WifiP2pLinkedInfo>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P local device change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pDeviceChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pDevice> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Subscribe P2P local device change events.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { "p2pDeviceChange" } type - event name.
|
|
|
|
* @param { Callback<WifiP2pDevice> } callback - the callback of on
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function on(type: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P local device change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pDeviceChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pDevice> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe P2P local device change events.
|
|
|
|
* @param { "p2pDeviceChange" } type - event name.
|
|
|
|
* @param { Callback<WifiP2pDevice> } callback - the callback of off
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function off(type: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P peer device change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pPeerDeviceChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pDevice[]> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 04:04:21 +00:00
|
|
|
/**
|
|
|
|
* Subscribe P2P peer device change events.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
|
|
|
* @param { "p2pPeerDeviceChange" } type - event name.
|
|
|
|
* @param { Callback<WifiP2pDevice[]> } callback - the callback of on
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function on(type: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P peer device change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pPeerDeviceChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<WifiP2pDevice[]> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribe P2P peer device change events.
|
|
|
|
* @param { "p2pPeerDeviceChange" } type - event name.
|
|
|
|
* @param { Callback<WifiP2pDevice[]> } callback - the callback of off
|
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function off(type: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P persistent group change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pPersistentGroupChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<void> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "p2pPersistentGroupChange", callback: Callback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P persistent group change events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pPersistentGroupChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<void> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "p2pPersistentGroupChange", callback?: Callback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subscribe P2P discovery events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pDiscoveryChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of on
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function on(type: "p2pDiscoveryChange", callback: Callback<number>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unsubscribe P2P discovery events.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-06-01 02:21:34 +00:00
|
|
|
* @param { "p2pDiscoveryChange" } type - event name.
|
2023-05-31 13:06:44 +00:00
|
|
|
* @param { Callback<number> } callback - the callback of off
|
2023-04-21 09:47:24 +00:00
|
|
|
* @throws {BusinessError} 201 - Permission denied.
|
|
|
|
* @throws {BusinessError} 401 - Invalid parameters.
|
|
|
|
* @throws {BusinessError} 801 - Capability not supported.
|
|
|
|
* @throws {BusinessError} 2801000 - Operation failed.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 13:06:44 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function off(type: "p2pDiscoveryChange", callback?: Callback<number>): void;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi device address( mac / bssid ) type.
|
|
|
|
* @enum { number }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum DeviceAddressType {
|
|
|
|
/**
|
|
|
|
* random device address
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
RANDOM_DEVICE_ADDRESS,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* real device address
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
REAL_DEVICE_ADDRESS,
|
|
|
|
}
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi EAP method.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum EapMethod {
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP NONE
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_NONE,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP PEAP
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_PEAP,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP TLS
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_TLS,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP TTLS
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_TTLS,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP PWD
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_PWD,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP SIM
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_SIM,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP AKA
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_AKA,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP AKA PRIME
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
EAP_AKA_PRIME,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP UNAUTH TLS
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
EAP_UNAUTH_TLS
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi phase 2 method.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum Phase2Method {
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 NONE
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_NONE,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 PAP
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_PAP,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 MSCHAP
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_MSCHAP,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 MSCHAPV2
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_MSCHAPV2,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 GTC
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_GTC,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 SIM
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_SIM,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 AKA
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
PHASE2_AKA,
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase2 AKA+
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
PHASE2_AKA_PRIME
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
2023-05-29 08:55:14 +00:00
|
|
|
/**
|
2023-05-30 12:58:41 +00:00
|
|
|
* Wi-Fi disconnected reason.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-05-29 08:55:14 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
2023-05-29 08:55:14 +00:00
|
|
|
*/
|
2023-05-30 12:58:41 +00:00
|
|
|
enum DisconnectedReason {
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Default reason
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-05-30 12:58:41 +00:00
|
|
|
DISC_REASON_DEFAULT = 0,
|
2023-05-29 08:55:14 +00:00
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Password is wrong
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-05-30 12:58:41 +00:00
|
|
|
DISC_REASON_WRONG_PWD = 1,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
2023-05-31 13:06:44 +00:00
|
|
|
* The number of router's connection reaches the maximum number limit
|
2023-05-31 12:28:40 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
DISC_REASON_CONNECTION_FULL = 2
|
2023-05-29 08:55:14 +00:00
|
|
|
}
|
|
|
|
|
2023-06-26 06:40:52 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi Proxy method.
|
|
|
|
* @enum { number }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
enum ProxyMethod {
|
|
|
|
/**
|
|
|
|
* No proxy is to be used.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
METHOD_NONE = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use auto configured proxy.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
METHOD_AUTO = 1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use manual configured proxy.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
METHOD_MANUAL = 2
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi Proxy config.
|
|
|
|
* @typedef WifiProxyConfig
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
interface WifiProxyConfig {
|
|
|
|
/**
|
|
|
|
* Wi-Fi proxy method
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
proxyMethod?: ProxyMethod;
|
|
|
|
|
|
|
|
/**
|
2023-06-26 12:46:23 +00:00
|
|
|
* PAC web address for auto configured proxy.
|
2023-06-26 06:40:52 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
pacWebAddress?: string;
|
|
|
|
|
|
|
|
/**
|
2023-06-26 06:48:38 +00:00
|
|
|
* Server host name for manual configured proxy.
|
2023-06-26 06:40:52 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-06-26 12:46:23 +00:00
|
|
|
serverHostName?: string;
|
2023-06-26 06:40:52 +00:00
|
|
|
|
|
|
|
/**
|
2023-06-26 06:48:38 +00:00
|
|
|
* Server port for manual configured proxy.
|
2023-06-26 06:40:52 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-06-26 12:46:23 +00:00
|
|
|
serverPort?: number;
|
2023-06-26 06:40:52 +00:00
|
|
|
|
|
|
|
/**
|
2023-06-26 09:00:26 +00:00
|
|
|
* Exclusion objects for manual configured proxy. objects are separated by ','.
|
2023-06-26 06:40:52 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-06-26 12:46:23 +00:00
|
|
|
exclusionObjects?: string;
|
2023-06-26 06:40:52 +00:00
|
|
|
}
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi EAP config.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiEapConfig
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiEapConfig {
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* EAP authentication method
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
eapMethod: EapMethod;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Phase 2 authentication method
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
phase2Method: Phase2Method;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* The identity
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
identity: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Anonymous identity
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
anonymousIdentity: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Password
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
password: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* CA certificate alias
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
caCertAliases: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* CA certificate path
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
caPath: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Client certificate alias
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
clientCertAliases: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* content of user's certificate
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
certEntry: Uint8Array;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Password of user's certificate
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
certPassword: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Alternate subject match
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
altSubjectMatch: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Domain suffix match
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
domainSuffixMatch: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Realm for Passpoint credential
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
realm: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Public Land Mobile Network of the provider of Passpoint credential
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
plmn: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Sub ID of the SIM card
|
2023-07-25 00:40:50 +00:00
|
|
|
* @type { number }
|
2023-05-31 12:28:40 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-05-31 12:28:40 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
eapSubId: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi device configuration information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiDeviceConfig
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiDeviceConfig {
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi SSID: the maximum length is 32.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ssid: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi bssid(MAC): the length is 6.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
bssid?: string;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi bssid type.
|
|
|
|
* @type { ?DeviceAddressType }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
bssidType?: DeviceAddressType;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi key: maximum length is 64.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
preSharedKey: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Hide SSID or not, false(default): not hide
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
isHiddenSsid?: boolean;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Security type: reference definition of WifiSecurityType
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
securityType: WifiSecurityType;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* The UID of the Wi-Fi configuration creator.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
creatorUid?: number;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Disable reason
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
disableReason?: number;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Allocated networkId
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
netId?: number;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Random mac type
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
randomMacType?: number;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* Random mac address, the length is 6.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
randomMacAddr?: string;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* IP Type
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ipType?: IpType;
|
|
|
|
|
2023-05-31 12:28:40 +00:00
|
|
|
/**
|
|
|
|
* IP config of static
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
staticIp?: IpConfig;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* EAP config info.
|
2023-07-25 00:40:50 +00:00
|
|
|
* @type { ?WifiEapConfig }
|
2023-05-31 12:28:40 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-07-25 00:40:50 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
eapConfig?: WifiEapConfig;
|
2023-06-26 06:40:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Proxy config.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
proxyConfig?: WifiProxyConfig;
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi IP configuration information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef IpConfig
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface IpConfig {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* IP address.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-06-01 09:46:29 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ipAddress: number;
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gate way.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
gateway: number;
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prefix length.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
prefixLength: number;
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* DNS servers.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
dnsServers: number[];
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Domains.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
domains: Array<string>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi information elements.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiInfoElem
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiInfoElem {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Element id
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
eid: number;
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Element content
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
content: Uint8Array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes the wifi channel width.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum WifiChannelWidth {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* 20MHz.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_20MHZ = 0,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* 40MHz.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_40MHZ = 1,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* 80MHz.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_80MHZ = 2,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* 160MHz.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_160MHZ = 3,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* 80MHz plus.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_80MHZ_PLUS = 4,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Invalid.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIDTH_INVALID
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes the scanned Wi-Fi information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiScanInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiScanInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi SSID: the maximum length is 32
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ssid: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi bssid(MAC): the length is 6
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
bssid: string;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi bssid type
|
|
|
|
* @type { DeviceAddressType }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
bssidType: DeviceAddressType;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Hotspot capability
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
capabilities: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Security type: reference definition of WifiSecurityType
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
securityType: WifiSecurityType;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Received signal strength indicator (RSSI)
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
rssi: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Frequency band, 1: 2.4G, 2: 5G
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
band: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Frequency
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
frequency: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Channel width
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
channelWidth: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Center frequency 0.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
centerFrequency0: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Center frequency 1.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
centerFrequency1: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Information elements.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
infoElems: Array<WifiInfoElem>;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Time stamp
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
timestamp: number;
|
|
|
|
}
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Describes the wifi security type.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum WifiSecurityType {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Invalid security type
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_INVALID = 0,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Open
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_OPEN = 1,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Wired Equivalent Privacy (WEP)
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_WEP = 2,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Pre-shared key (PSK)
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_PSK = 3,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Simultaneous Authentication of Equals (SAE)
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_SAE = 4,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* EAP authentication.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_EAP = 5,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* SUITE_B_192 192 bit level.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_EAP_SUITE_B = 6,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Opportunistic Wireless Encryption.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_OWE = 7,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* WAPI certificate to be specified.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_SEC_TYPE_WAPI_CERT = 8,
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* WAPI pre-shared key to be specified.
|
2022-10-20 09:57:17 +00:00
|
|
|
*
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.Core
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
WIFI_SEC_TYPE_WAPI_PSK = 9
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi band type.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum WifiBandType {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Default.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_BAND_NONE,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Band 2.4G.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_BAND_2G,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Band 5G.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_BAND_5G,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Band 6G.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_BAND_6G,
|
2023-05-31 14:41:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Band 60G.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
WIFI_BAND_60G
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi standard.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum WifiStandard {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-05-31 12:28:40 +00:00
|
|
|
* Undefined
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_UNDEFINED,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11a
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11A,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11b
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11B,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11g
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11G,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11n
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11N,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11ac
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11AC,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wifi 802.11ax
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
WIFI_STANDARD_11AX,
|
2023-05-31 06:58:28 +00:00
|
|
|
|
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* Wifi 802.11ad
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
WIFI_STANDARD_11AD
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi connection information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiLinkedInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiLinkedInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The SSID of the Wi-Fi hotspot
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ssid: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The BSSID of the Wi-Fi hotspot
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
bssid: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The ID(uniquely identifies) of a Wi-Fi connection.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
networkId: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The RSSI(dBm) of a Wi-Fi access point.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
rssi: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The frequency band of a Wi-Fi access point.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
band: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The speed of a Wi-Fi access point.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
linkSpeed: number;
|
|
|
|
|
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The rx speed of a Wi-Fi access point.
|
2022-10-20 09:57:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
rxLinkSpeed: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* Max tx speed of a Wi-Fi access point.
|
2022-10-20 09:57:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
maxSupportedTxLinkSpeed: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* Max rx speed of a Wi-Fi access point.
|
2022-10-20 09:57:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
maxSupportedRxLinkSpeed: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The frequency of a Wi-Fi access point.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
frequency: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
isHidden: boolean;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* Whether this Wi-Fi connection restricts the data volume.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
isRestricted: boolean;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The load value of this Wi-Fi connection. A greater value indicates a higher load.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
chload: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
2023-07-08 06:57:08 +00:00
|
|
|
* The signal-to-noise ratio (SNR) of this Wi-Fi connection.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 13:06:44 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
snr: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Type of macAddress: 0 - real mac, 1 - random mac.
|
2022-10-20 09:57:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-06-01 01:42:02 +00:00
|
|
|
* @since 9
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
macType: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi MAC address of a device.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
macAddress: string;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The IP address of this Wi-Fi connection.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ipAddress: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The state of the supplicant of this Wi-Fi connection.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
suppState: SuppState;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The state of this Wi-Fi connection.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-06-01 08:09:34 +00:00
|
|
|
* @since 9
|
2023-05-31 06:58:28 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
connState: ConnState;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-03-02 10:18:29 +00:00
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Channel width of the connected hotspot.
|
2023-03-02 10:18:29 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2023-03-02 10:18:29 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
channelWidth: WifiChannelWidth;
|
2023-03-02 10:18:29 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-31 06:58:28 +00:00
|
|
|
* Wifi standard of current connection.
|
2023-03-02 10:18:29 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2023-03-02 10:18:29 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
wifiStandard: WifiStandard;
|
|
|
|
}
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi IP information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef IpInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface IpInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The IP address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ipAddress: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The gateway of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
gateway: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The network mask of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
netmask: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The primary DNS server IP address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
primaryDns: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The secondary DNS server IP address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
secondDns: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The DHCP server IP address of the Wi-Fi connection
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
serverIp: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The IP address lease duration of the Wi-Fi connection
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
leaseDuration: number;
|
|
|
|
}
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-07-08 06:57:08 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi IPv6 information.
|
|
|
|
* @typedef Ipv6Info
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
interface Ipv6Info {
|
|
|
|
/**
|
|
|
|
* The link IPv6 address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
linkIpv6Address: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The global IPv6 address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
globalIpv6Address: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The rand Global IPv6 address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
randomGlobalIpv6Address: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The gateway of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
gateway: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The network mask of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
netmask: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The primary DNS server IPV6 address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
primaryDNS: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The secondary DNS server IPV6 address of the Wi-Fi connection
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
secondDNS: string;
|
|
|
|
}
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Wi-Fi hotspot configuration information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef HotspotConfig
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface HotspotConfig {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The SSID of the Wi-Fi hotspot
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ssid: string;
|
2023-03-02 10:18:29 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The encryption mode of the Wi-Fi hotspot
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
securityType: WifiSecurityType;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The frequency band of the Wi-Fi hotspot
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
band: number;
|
2022-10-20 09:57:17 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-31 06:58:28 +00:00
|
|
|
* The channel of the Wi-Fi hotspot.
|
2022-10-20 09:57:17 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2022-10-20 09:57:17 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
channel?: number;
|
2023-04-21 09:47:24 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The password of the Wi-Fi hotspot
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
preSharedKey: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The maximum number of connections allowed by the Wi-Fi hotspot
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
maxConn: number;
|
2023-05-30 01:14:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* IP address of the dhcp server, it's a string, For example 192.168.43.1
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 10
|
2023-05-30 01:14:37 +00:00
|
|
|
*/
|
2023-07-19 06:56:52 +00:00
|
|
|
ipAddress?: string;
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi station information.
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef StationInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface StationInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The network name of the Wi-Fi client
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
name: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The MAC address of the Wi-Fi client
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
macAddress: string;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* The MAC address type of the Wi-Fi client
|
|
|
|
* @type { ?DeviceAddressType }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
macAddressType?: DeviceAddressType;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The IP address of the Wi-Fi client
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Core
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ipAddress: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wi-Fi IP type enumeration.
|
|
|
|
*
|
2023-05-31 06:58:28 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum IpType {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Use statically configured IP settings
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
STATIC,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Use dynamically configured IP settings
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
DHCP,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* No IP details are assigned
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 06:58:28 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-05-31 01:01:20 +00:00
|
|
|
UNKNOWN
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of the supplicant enumeration.
|
|
|
|
*
|
2023-05-31 06:58:28 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
export enum SuppState {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is not associated with or is disconnected from the AP.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
DISCONNECTED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The network interface is disabled.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
INTERFACE_DISABLED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is disabled.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
INACTIVE,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is scanning for a Wi-Fi connection.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
SCANNING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is authenticating with a specified AP.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
AUTHENTICATING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is associating with a specified AP.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ASSOCIATING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is associated with a specified AP.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ASSOCIATED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The four-way handshake is ongoing.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
FOUR_WAY_HANDSHAKE,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The group handshake is ongoing.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
GROUP_HANDSHAKE,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* All authentication is completed.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
COMPLETED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Failed to establish a connection to the supplicant.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
UNINITIALIZED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The supplicant is in an unknown or invalid state.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 12:28:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
INVALID
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of Wi-Fi connection enumeration.
|
|
|
|
*
|
2023-05-31 06:58:28 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
export enum ConnState {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The device is searching for an available AP.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
SCANNING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi connection is being set up.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
CONNECTING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi connection is being authenticated.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
AUTHENTICATING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The IP address of the Wi-Fi connection is being obtained.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
OBTAINING_IPADDR,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi connection has been set up.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
CONNECTED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi connection is being torn down.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
DISCONNECTING,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The Wi-Fi connection has been torn down.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
DISCONNECTED,
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Failed to set up the Wi-Fi connection.
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.STA
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P device information.
|
|
|
|
*
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiP2pDevice
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-31 04:19:20 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiP2pDevice {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Device name
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
deviceName: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Device mac address
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
deviceAddress: string;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Device mac address type
|
|
|
|
* @type { ?DeviceAddressType }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deviceAddressType?: DeviceAddressType;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Primary device type
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
primaryDeviceType: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Device status
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
deviceStatus: P2pDeviceStatus;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Device group capabilities
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
groupCapabilities: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P config.
|
|
|
|
*
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiP2PConfig
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:43:25 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiP2PConfig {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Device mac address
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
deviceAddress: string;
|
|
|
|
|
2023-07-25 00:40:50 +00:00
|
|
|
/**
|
|
|
|
* Device mac address type
|
|
|
|
* @type { ?DeviceAddressType }
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 10
|
|
|
|
*/
|
|
|
|
deviceAddressType?: DeviceAddressType;
|
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Group network ID. When creating a group, -1 indicates creates a temporary group,
|
|
|
|
* -2: indicates creates a persistent group
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
netId: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The passphrase of this {@code WifiP2pConfig} instance
|
2023-05-31 04:19:20 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
passphrase: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group name
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
groupName: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group owner band
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
goBand: GroupOwnerBand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P group information.
|
|
|
|
*
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiP2pGroupInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:43:25 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiP2pGroupInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether it is group owner
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
isP2pGo: boolean;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group owner information
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
ownerInfo: WifiP2pDevice;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* The group passphrase
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
passphrase: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Interface name
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
interface: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group name
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
groupName: string;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Network ID
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
networkId: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Frequency
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
frequency: number;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Client list
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
clientDevices: WifiP2pDevice[];
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group owner IP address
|
2023-05-31 04:19:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
goIpAddress: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P connection status.
|
|
|
|
*
|
2023-05-30 14:43:25 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:43:25 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum P2pConnectState {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* p2p is disconnected
|
2023-05-31 01:01:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
DISCONNECTED = 0,
|
2023-05-30 14:43:25 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* p2p is connected
|
2023-05-31 01:01:20 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-05-30 15:11:21 +00:00
|
|
|
CONNECTED = 1
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P linked information.
|
|
|
|
*
|
2023-05-31 12:28:40 +00:00
|
|
|
* @typedef WifiP2pLinkedInfo
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:43:25 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface WifiP2pLinkedInfo {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Connection status
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
connectState: P2pConnectState;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicates whether it is group owner
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
isGroupOwner: boolean;
|
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Group owner address
|
2023-05-30 14:58:58 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
groupOwnerAddr: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P device status.
|
|
|
|
*
|
2023-05-31 01:25:59 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:43:25 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum P2pDeviceStatus {
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicate p2p device is connected.
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
CONNECTED = 0,
|
2023-05-30 14:43:25 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicate p2p device is invited.
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
INVITED = 1,
|
2023-05-30 14:43:25 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicate p2p device is failed.
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
FAILED = 2,
|
2023-05-30 14:43:25 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicate p2p device is available.
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
AVAILABLE = 3,
|
2023-05-30 14:43:25 +00:00
|
|
|
|
2023-05-31 06:58:28 +00:00
|
|
|
/**
|
|
|
|
* Indicate p2p device is unavailable.
|
2023-05-30 14:58:58 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-05-30 15:11:21 +00:00
|
|
|
UNAVAILABLE = 4
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P2P group owner band.
|
|
|
|
*
|
2023-05-31 01:25:59 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
2023-05-30 14:58:58 +00:00
|
|
|
* @since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum GroupOwnerBand {
|
2023-05-30 14:58:58 +00:00
|
|
|
/**
|
|
|
|
* default band.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
GO_BAND_AUTO = 0,
|
2023-05-30 14:58:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 2.4G band.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
GO_BAND_2GHZ = 1,
|
2023-05-30 14:58:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 5G band.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.P2P
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-05-30 15:11:21 +00:00
|
|
|
GO_BAND_5GHZ = 2
|
2023-04-21 09:47:24 +00:00
|
|
|
}
|
2022-10-20 09:57:17 +00:00
|
|
|
}
|
|
|
|
|
2022-10-21 06:09:11 +00:00
|
|
|
export default wifiManager;
|