From 0b3868bb2f22715e3fb172b3335e92caf4ab6e45 Mon Sep 17 00:00:00 2001 From: tanfengting Date: Thu, 18 Nov 2021 16:06:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=83=AD=E7=82=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.wifi.d.ts | 78 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/api/@ohos.wifi.d.ts b/api/@ohos.wifi.d.ts index c6a0537d28..20fed78af4 100755 --- a/api/@ohos.wifi.d.ts +++ b/api/@ohos.wifi.d.ts @@ -23,13 +23,51 @@ import { AsyncCallback } from "./basic"; * @since 6 */ declare namespace wifi { + /** + * Queries the HOTSPOT status + * + * @return Returns {@code true} if the HOTSPOT is active; returns {@code false} otherwise. + * + * @since 6 + */ + function isHotspotActive(): boolean; + /** + * Enables HOTSPOT. + * + * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * + * @since 6 + * @systemapi Hide this for inner system use. + */ + function enableHotspot(): boolean; + + /** + * Disables HOTSPOT. + * + * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * + * @since 6 + * @systemapi Hide this for inner system use. + */ + function disableHotspot(): boolean; + + /** + * Set HOTSPOT Config. + * + * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * + * @since 6 + * @systemapi Hide this for inner system use. + */ + function setHotspotConfig(conf: HotSpotConfig): boolean; + /** * Enables Wi-Fi. * * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. * * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function enableWifi(): boolean; @@ -39,7 +77,7 @@ declare namespace wifi { * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. * * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function disableWifi(): boolean; @@ -82,7 +120,7 @@ declare namespace wifi { * * @devices phone, tablet * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function addDeviceConfig(config: WifiDeviceConfig): Promise; function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; @@ -94,7 +132,7 @@ declare namespace wifi { * @return Returns {@code true} if the network connection is successful; returns {@code false} otherwise. * * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function connectToNetwork(networkId: number): boolean; @@ -106,7 +144,7 @@ declare namespace wifi { * * @devices phone, tablet * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function connectToDevice(config: WifiDeviceConfig): boolean; @@ -116,7 +154,7 @@ declare namespace wifi { * @return Returns {@code true} for disconnecting network success, returns {@code false} otherwise. * * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function disconnect(): boolean; @@ -131,12 +169,36 @@ declare namespace wifi { */ function getSignalLevel(rssi: number, band: number): number; + /** + * Hotspot configuration information. + * + * @devices phone, tablet + * @since 6 + * @systemapi Hide this for inner system use. + */ + interface HotSpotConfig { + /* Hotspot name, The string length range is 1~32 */ + ssid: string; + + /* Hotspot Encryption type, Optional NONE/WPA_PSK/WPA2_PSK */ + securityType: number; + + /* Hotspot password ,The string length range is 8~63 */ + preSharedKey: string; + + /* Hotspot band */ + band: number; + + /* Hotspot maxConn */ + maxConn: number; + } + /** * Wi-Fi device configuration information. * * @devices phone, tablet * @since 6 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ interface WifiDeviceConfig { /** Wi-Fi SSID: the maximum length is 32 */ @@ -174,7 +236,7 @@ declare namespace wifi { /** Received signal strength indicator (RSSI) */ rssi: number; - /** Frequency band */ + /** Frequency band, 1: 2.4G, 2: 5G */ band: number; /** Frequency */ -- Gitee From 1e31420da6836face05469c98d83d5ba835ae61e Mon Sep 17 00:00:00 2001 From: tanfengting Date: Thu, 18 Nov 2021 16:21:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=83=AD=E7=82=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.wifi.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/@ohos.wifi.d.ts b/api/@ohos.wifi.d.ts index 20fed78af4..710ab5dbba 100755 --- a/api/@ohos.wifi.d.ts +++ b/api/@ohos.wifi.d.ts @@ -60,6 +60,16 @@ declare namespace wifi { * @systemapi Hide this for inner system use. */ function setHotspotConfig(conf: HotSpotConfig): boolean; + + /** + * Get HOTSPOT Config. + * + * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. + * + * @since 6 + * @systemapi Hide this for inner system use. + */ + function getHotspotConfig(conf: HotSpotConfig): boolean; /** * Enables Wi-Fi. -- Gitee From d597eb06dbc5e051896eec77cca8e1768b130ba5 Mon Sep 17 00:00:00 2001 From: tanfengting Date: Thu, 18 Nov 2021 16:35:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=83=AD=E7=82=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.wifi.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/api/@ohos.wifi.d.ts b/api/@ohos.wifi.d.ts index 710ab5dbba..ac7c6019a0 100755 --- a/api/@ohos.wifi.d.ts +++ b/api/@ohos.wifi.d.ts @@ -61,6 +61,15 @@ declare namespace wifi { */ function setHotspotConfig(conf: HotSpotConfig): boolean; + /** + * Get HOTSPOT Station. + * + * @return Returns hotspot station info if any. + * + * @since 6 + */ + function getStations(): Array + /** * Get HOTSPOT Config. * @@ -203,6 +212,25 @@ declare namespace wifi { maxConn: number; } + /** + * Hotspot station information. + * + * @devices phone, tablet + * @since 6 + * @systemapi Hide this for inner system use. + */ + interface StationInfo { + /* Device name */ + deviceName: string; + + /* Device Mac */ + bssid: string; + + /* Device IP address */ + ipAddr: string; + } + + /** * Wi-Fi device configuration information. * -- Gitee