| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| entry/ | 12-May-2024 | - | 1,583 | 1,472 | ||
| screenshots/device/ | 12-May-2024 | - | ||||
| .gitignore | D | 12-May-2024 | 121 | 8 | 8 | |
| README.md | D | 12-May-2024 | 1.1 KiB | 20 | 10 | |
| README_zh.md | D | 12-May-2024 | 2.2 KiB | 40 | 23 | |
| build-profile.json5 | D | 12-May-2024 | 1 KiB | 42 | 41 | |
| hvigorfile.js | D | 12-May-2024 | 174 | 2 | 1 | |
| package.json | D | 12-May-2024 | 335 | 18 | 17 |
README.md
1# WLAN 2 3### Introduction 4 5This sample shows how to use WLAN with eTS, including disabling and enabling the WLAN, scanning the WLAN and obtaining the scanning result, listening for WLAN status and Wi-Fi connection status, obtaining the IP address, country code, and checking whether the device supports WLAN features. 6 7### Usage 8 91. After the app is started, it checks whether the WLAN is activated. If it is activated, the app scans for available Wi-Fi networks and displays the list of available and connected Wi-Fi networks. 10 112. Touch the toggle on the page to enable or disable the WLAN. The device listens for the WLAN statue, scans for available Wi-Fi networks, and displays the connected Wi-Fi network. 12 133. Touch a Wi-Fi network in the list of available Wi-Fi networks to connect to the Wi-Fi network. If the Wi-Fi network is encrypted, a dialog box will be displayed asking you to enter the password. 14 154. Touch **About** in the upper right corner of the home page. The obtained IP address, country code, and supported WLAN features are displayed. 16 17### Constraints 18 19This sample can only be run on standard-system devices. 20
README_zh.md
1# WLAN 2 3### 简介 4 5本示例展示了在eTS中WLAN的基本使用,包括禁用和启用WLAN、WLAN扫描和获取扫描结果、WLAN状态监听、WiFi连接状态监听、获取IP信息、获取国家码、判断设备是否支持WLAN相关特性。实现效果如下: 6 7 8 9### 相关概念 10 11WLAN:提供API实现wlan激活、扫描和连接WIFI等功能。 12 13### 相关权限 14 15获取WLAN信息权限:ohos.permission.GET_WIFI_INFO 16获取WLAN网络信息权限:ohos.permission.GET_WIFI_INFO_INTERNAL 17允许配置WLAN设备权限:ohos.permission.SET_WIFI_INFO 18获取WLAN配置信息权限:ohos.permission.GET_WIFI_CONFIG 19允许配置WLAN配置权限:ohos.permission.SET_WIFI_CONFIG 20允许控制WLAN连接状态权限:ohos.permission.MANAGE_WIFI_CONNECTION 21 22### 使用说明 23 241.启动应用后会判断WLAN是否激活,如果是激活状态,会扫描并展示可用WiFi列表,同时获取已连接WiFi信息并展示。 25 262.点击界面的Switch开关可以禁用和激活WLAN,界面会监听WLAN状态扫描可用WiFi列表,也会监听WiFi连接状态展示已连接WiFi。 27 283.点击可用WLAN列表中的WLAN信息,可以连接WiFi,如果是加密类型,会弹窗输入密码后连接。 29 304.点击首页右上角的**关于**图标,进入关于界面,展示获取的IP信息、国家码和支持WLAN相关特性信息。 31 32### 约束与限制 33 341.本示例仅支持标准系统上运行。 35 362.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。 37 383.本示例需要使用@ohos.wifi系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)。 39 404.本示例需要使用ohos.permission.GET_WIFI_INFO_INTERNAL、ohos.permission.MANAGE_WIFI_CONNECTION的权限为system_core级别(相关权限级别可通过[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)查看),需要手动配置对应级别的权限签名。