diff --git a/code/DocsSample/ConnectivityKit/Wlan/.gitignore b/code/DocsSample/ConnectivityKit/Wlan/.gitignore
index d2ff20141ceed86d87c0ea5d99481973005bab2b..6ff06d2ba5623824e833c16a55976cec28edb64e 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/.gitignore
+++ b/code/DocsSample/ConnectivityKit/Wlan/.gitignore
@@ -1,5 +1,4 @@
/node_modules
-/oh_modules
/local.properties
/.idea
**/build
@@ -8,5 +7,7 @@
/.clangd
/.clang-format
/.clang-tidy
-**/.test
-/.appanalyzer
\ No newline at end of file
+/package-lock.json
+/entry/package-lock.json
+**/oh_modules
+**/oh-package-lock.json5
diff --git a/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5 b/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5
index 3a9049665f3b1e996cee190120cc4e4974ba6abd..ed437d519815611c578fce57873a40adad755866 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5
@@ -15,11 +15,12 @@
{
"app": {
- "bundleName": "com.samples.wlanproject",
- "vendor": "example",
+ "bundleName": "ohos.samples.wlan",
+ "vendor": "samples",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
- "label": "$string:app_name"
+ "label": "$string:app_name",
+ "distributedNotificationEnabled": true
}
}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json
index 7de15f9aa578658a2d52fafc669747762c102d88..561c62fe0815ac0ebb4f356e0b8b261b504c64be 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json
+++ b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json
@@ -2,7 +2,7 @@
"string": [
{
"name": "app_name",
- "value": "WLANProject"
+ "value": "Wlan"
}
]
}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/README_zh.md b/code/DocsSample/ConnectivityKit/Wlan/README_zh.md
index 58ba34419a9986ced038f90da74a35a60cddac32..38ac3dd79f55b353a92aed7750ca1b9488946343 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/README_zh.md
+++ b/code/DocsSample/ConnectivityKit/Wlan/README_zh.md
@@ -7,51 +7,81 @@
### 效果预览
|应用界面|
-|-------|
-|
|
+|主页 |建议网络连接 | WiFi列表 |
+|---------------------------------------------|---------------------------------------|-----------------------------------------|
+||||
+|P2p测试 |P2p连接 | 创建群组 |
+|---------------------------------------------|---------------------------------------|-----------------------------------------|
+||||
+
+
+|获取真实BSSID授权 |
+|-----------------------------------------|
+| |
### 使用说明
-1. 在主界面,可以点击对应按钮,执行相应的操作。
-2. 按钮上方会显示执行信息。
+1. 启动应用后会判断WLAN是否激活,如果是激活状态,点击wifi列表会扫描并展示可用WiFi列表;
+2. 点击首页建议击网络连接,填写可选参数,连接建议网络;
+3. 点击首页P2p测试,进行P2p连接和创建群组场景测试。
### 工程目录
```
entry/src/main/ets/
-├── entryability
-│ ├── EntryAbility.ets
-│ ├── p2pability.ets // 创建或删除群组
-│ └── p2pConnect.ets // p2p连接
-├── entrybackupability
-│ └── EntryBackupAbility.ets
-└── pages
- └── Index.ets // 应用主界面
+|---component
+| |---P2pView.ets // P2p列表详情页
+| |---TitleBar.ets // 页面头部组件
+| |---WifiView.ets // wifi列表详情页
+|---entryability
+| |---EntryAbility.ets // 应用入口,在这里请求相关权限和进入首页
+|---pages
+| |---Index.ets // 首页
+| |---AvailableWifi.ets // 热点扫描信息列表
+| |---WifiConnect.ets // 建议网络连接
+| |---P2pTest.ets // P2p测试场景
+| |---AvailableP2p.ets // P2p扫描信息列表
+| |---P2pSetting.ets // 创建群组
```
+### 具体实现
+
+* 开始测试前需打开设备WiFi,
+首页:[Index.ets](entry/src/main/ets/pages/Index.ets)。
+
+* 建议网络连接:[WifiConnect.ets](entry/src/main/ets/pages/WifiConnect.ets),根据提示填写参数信息通过connectwifi()发起连接。
+* wifi的扫描功能:首页点击wifi列表,在[AvailableWifi.ets](entry/src/main/ets/pages/AvailableWifi.ets) 通过(entry/src/main/ets/component/WifiView.ets)显示每一个WiFi信息,调用getScanInfos()获取扫描结果,调用定时器每3s获取一次。
+* P2p场景测试:
+ *p2p连接:[AvailableP2p.ets.ets](entry/src/main/ets/pages/AvailableP2p.ets) 通过(entry/src/main/ets/component/P2pView.ets)显示每一个P2p信息,点击列表信息通过connectP2p()函数发起连接。
+ *创建P2P群组:在[P2pSetting.ets](entry/src/main/ets/pages/P2pSetting.ets) 填写参数信息通过createGroup()来创建群组。
### 相关权限
-[ohos.permission.GET_WIFI_INFO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-wifiManager.md#wifimanagercreategroup9)
+[ohos.permission.GET_WIFI_INFO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionget_wifi_info)
+[ohos.permission.SET_WIFI_INFO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionset_wifi_info)
+
+[ohos.permission.GET_WIFI_PEERS_MAC](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/restricted-permissions.md#ohospermissionget_wifi_peers_mac)
### 依赖
不涉及。
### 约束与限制
-1.本示例仅支持标准系统上运行, 支持设备:RK3568。
+1. 本示例仅支持标准系统上运行, 支持设备:RK3568。
+
+2. 本示例需要使用DevEco Studio 5.0.5 及以上版本才可编译运行。
-2.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.57。
+3. 本示例已适配API version 9版本SDK,版本号:3.2.11.9,本示例需要使用@ohos.wifi系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md/) 。
-3.本示例需要使用DevEco Studio NEXT Developer Preview2 (Build Version: 5.0.5.306, built on December 12, 2024)及以上版本才可编译运行。
+4. 本示例需要使用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/AccessToken/permissions-for-all.md) 查看),需要手动配置对应级别的权限签名。
### 下载
如需单独下载本工程,执行如下命令:
-````
+```
git init
git config core.sparsecheckout true
echo code/DocsSample/ConnectivityKit/Wlan > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
-````
\ No newline at end of file
+```
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5 b/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5
index 877196e790b0b108e05378d8cbe7f7f25992fc22..a1bcc2a25f14e2a7e3cb109f5f25221406d12412 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5
@@ -15,32 +15,16 @@
{
"app": {
- "signingConfigs": [
- ],
"products": [
{
"name": "default",
"signingConfig": "default",
- "compatibleSdkVersion": 14,
- "compileSdkVersion": 14,
- "targetSdkVersion": 14,
- "runtimeOS": "OpenHarmony",
- "buildOption": {
- "strictMode": {
- "caseSensitiveCheck": true,
- "useNormalizedOHMUrl": true
- }
- }
+ "compatibleSdkVersion": "4.0.0(10)",
+ "targetSdkVersion": "4.0.0(10)",
+ "runtimeOS": "HarmonyOS",
}
],
- "buildModeSet": [
- {
- "name": "debug",
- },
- {
- "name": "release"
- }
- ]
+ "signingConfigs": []
},
"modules": [
{
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore b/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore
index e2713a2779c5a3e0eb879efe6115455592caeea5..e5d65b11d36650f2d90d25facccfec45a382e931 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore
@@ -1,6 +1,4 @@
/node_modules
-/oh_modules
/.preview
/build
/.cxx
-/.test
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/build-profile.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/build-profile.json5
index e7569e3056e27af38e9991b7ea73ec10f3ba8a05..a2d361ac657af1056e243fd093bc2d16bf8089b6 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/build-profile.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/build-profile.json5
@@ -14,24 +14,9 @@
*/
{
- "apiType": "stageMode",
+ "apiType": 'stageMode',
"buildOption": {
},
- "buildOptionSet": [
- {
- "name": "release",
- "arkOptions": {
- "obfuscation": {
- "ruleOptions": {
- "enable": false,
- "files": [
- "./obfuscation-rules.txt"
- ]
- }
- }
- }
- },
- ],
"targets": [
{
"name": "default"
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts b/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts
index e4f43d54667f8327c367c8096bd08bb8c75aff54..94b039ca97168c2ece09f5559b156db2a19d82e1 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts
@@ -13,9 +13,5 @@
* limitations under the License.
*/
-import { hapTasks } from '@ohos/hvigor-ohos-plugin';
-
-export default {
- system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
- plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
-}
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { hapTasks } from '@ohos/hvigor-ohos-plugin'
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5
index dbacc308e4f7758a11b72c6a2af812b2471a0e8a..73bef04acf22052af438cef69617a83c0d269719 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5
@@ -12,14 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
{
+ "license": "ISC",
+ "devDependencies": {},
"name": "entry",
+ "description": "example description",
+ "repository": {},
"version": "1.0.0",
- "description": "Please describe the basic information.",
- "main": "",
- "author": "",
- "license": "",
"dependencies": {}
}
-
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/P2pView.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/P2pView.ets
new file mode 100644
index 0000000000000000000000000000000000000000..94def3df3fb15dd2fc6c68d00bebcfb9a09ea2d7
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/P2pView.ets
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
+ * 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.
+ */
+
+
+import wifi from '@ohos.wifiManager';
+
+/**
+ * P2pView Component of p2p test
+ */
+const TAG = 'wifiTestApp [P2pView]'
+
+@Component
+export struct P2pView {
+ private p2p!: wifi.WifiP2pDevice
+ private securityString: Resource = $r('app.string.useful')
+ private p2pConnectState: number = 0
+ @StorageLink('p2pLinkedDeviceName') p2pLinkedDeviceName: string = ''
+ @State isLock: boolean = true
+
+ aboutToAppear() {
+ console.log(TAG , `aboutToAppear ${ JSON.stringify(this.p2p) }`)
+
+ this.p2pConnectState = AppStorage.get('p2pConnectState') !
+ this.p2pLinkedDeviceName = AppStorage.get('p2pLinkedDeviceName') !
+ if ( this.p2p ) {
+ console.log(TAG , 'this.p2p is true')
+ } else {
+ console.log(TAG , 'this.p2p is false')
+ }
+ }
+
+ build() {
+ Row() {
+ Column() {
+ if ( this.p2p ) {
+ if ( this.p2p.deviceName ) {
+ Text(this.p2p.deviceName)
+ .fontSize(20)
+ .width('100%')
+ }
+ }
+ if ( this.p2pConnectState == 1 && this.p2pLinkedDeviceName == this.p2p.deviceName ) {
+ Text($r('app.string.p2pConnected'))
+ .fontSize(18)
+ .fontColor(Color.Gray)
+ .width('100%')
+ } else {
+ Text($r('app.string.useful'))
+ .fontSize(18)
+ .fontColor(Color.Gray)
+ .width('100%')
+ }
+ }
+ .layoutWeight(1)
+
+ Stack({ alignContent : Alignment.BottomEnd }) {
+ Image($r('app.media.wifi'))
+ .height(30).width(30)
+ .objectFit(ImageFit.Contain)
+ if ( this.isLock ) {
+ Image($r('app.media.lock'))
+ .objectFit(ImageFit.Contain)
+ .width(15).height(15)
+ }
+ }
+ .width(40).height(40)
+ .margin({ right : 10 })
+ }
+ .backgroundColor(Color.White)
+ .width('100%')
+ .padding(10)
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/TitleBar.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/TitleBar.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f3b7aa84f51a3ca560093f8997defd4cff6ba90
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/TitleBar.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+import router from '@ohos.router'
+
+@Component
+export struct TitleBar {
+ build() {
+ Row() {
+ Text($r('app.string.entryAbility_label'))
+ .fontColor(Color.White)
+ .fontSize(25)
+ .layoutWeight(1)
+
+ Button() {
+ Image($r('app.media.about'))
+ .size({ width: 60, height: '95%' })
+ .objectFit(ImageFit.Contain)
+ }
+ .id('about')
+ .type(ButtonType.Normal)
+ .height('90%')
+ .backgroundColor($r('app.color.button_color'))
+ }
+ .width('100%')
+ .height('8%')
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .backgroundColor($r('app.color.button_color'))
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/WifiView.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/WifiView.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c738415886f3167a2c8dc999dcf493f460f62726
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/component/WifiView.ets
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+import Logger from '../model/Logger'
+import wifi from '@ohos.wifiManager'
+
+const TAG: string = 'WifiView'
+
+@Component
+export struct WifiView {
+ private wifi: wifi.WifiScanInfo | null = null;
+ private securityString: Resource = $r('app.string.encryption')
+ @State isLock: boolean = true
+
+ aboutToAppear() {
+ Logger.debug(TAG, `aboutToAppear ${JSON.stringify(this.wifi)}`)
+ if (this.wifi) {
+ if (this.wifi.securityType) {
+ if ((this.wifi.securityType as number) === 0 || this.wifi.securityType === 1) {
+ this.securityString = $r('app.string.open')
+ this.isLock = false
+ }
+ }
+ }
+ }
+
+ build() {
+ Row() {
+ Column() {
+ if (this.wifi) {
+ if (this.wifi.ssid) {
+ Text(this.wifi.ssid)
+ .fontSize(20)
+ .width('100%')
+ }
+ }
+ Text(this.securityString)
+ .fontSize(18)
+ .fontColor(Color.Gray)
+ .width('100%')
+ }
+ .layoutWeight(1)
+
+ Stack({ alignContent: Alignment.BottomEnd }) {
+ Image($r('app.media.wifi'))
+ .height(30)
+ .width(30)
+ .objectFit(ImageFit.Contain)
+ if (this.isLock) {
+ Image($r('app.media.lock'))
+ .objectFit(ImageFit.Contain)
+ .width(15)
+ .height(15)
+ }
+ }
+ .width(40)
+ .height(40)
+ .margin({ right: 10 })
+ }
+ .backgroundColor(Color.White)
+ .width('100%')
+ .padding(10)
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets
index 0f2f8b94aa24b0a50e272270e4e18b6df93ac5fd..be7cf8c3c3c78eb96703c28e47469b9fb842c0a6 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
* 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
@@ -13,44 +13,52 @@
* limitations under the License.
*/
-import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
-import { hilog } from '@kit.PerformanceAnalysisKit';
-import { window } from '@kit.ArkUI';
+import Logger from '../model/Logger'
+import UIAbility from '@ohos.app.ability.UIAbility';
+import Window from '@ohos.window'
+import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
+import type { Permissions } from '@ohos.abilityAccessCtrl';
+import Want from '@ohos.app.ability.Want';
+import AbilityConstant from '@ohos.app.ability.AbilityConstant';
export default class EntryAbility extends UIAbility {
- onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
+ Logger.info('Ability onCreate')
+ const PERMISSIONS: Array = ['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION'];
+ try {
+ abilityAccessCtrl.createAtManager().requestPermissionsFromUser(this.context, PERMISSIONS);
+ } catch (err) {
+ Logger.info(`catch err->${JSON.stringify(err)}`);
+ }
}
- onDestroy(): void {
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ onDestroy() {
+ Logger.info('Ability onDestroy')
}
- onWindowStageCreate(windowStage: window.WindowStage): void {
- // Main window is created, set main page for this ability
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
-
- windowStage.loadContent('pages/Index', (err) => {
+ onWindowStageCreate(windowStage: Window.WindowStage) {
+ Logger.info('Ability onWindowStageCreate')
+ windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
- hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
- return;
+ Logger.error(`Failed to load the content. Cause: ${JSON.stringify(err)}`)
+ return
}
- hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
- });
+ Logger.info(`Succeeded in loading the content. Data: ${JSON.stringify(data)}`)
+ })
}
- onWindowStageDestroy(): void {
+ onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ Logger.info('Ability onWindowStageDestroy')
}
- onForeground(): void {
+ onForeground() {
// Ability has brought to foreground
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ Logger.info('Ability onForeground')
}
- onBackground(): void {
+ onBackground() {
// Ability has back to background
- hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ Logger.info('Ability onBackground')
}
-}
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pConnect.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pConnect.ets
deleted file mode 100644
index d71da61e3784d8725ee5039d23ed59ee01b816e2..0000000000000000000000000000000000000000
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pConnect.ets
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2025 Huawei Device Co., Ltd.
- * 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.
- */
-
-// [Start create_p2p_connect]
-import { wifiManager } from '@kit.ConnectivityKit';
-
-export class P2PConnectMananger {
- public message: string = 'connecting...';
-
- public connect() {
- let recvP2pConnectionChangeFunc = (result: wifiManager.WifiP2pLinkedInfo) => {
- console.info('p2p connection change receive event: ' + JSON.stringify(result));
- wifiManager.getP2pLinkedInfo((err, data) => {
- if (err) {
- console.error('getP2pLinkedInfo ' + JSON.stringify(err));
- return;
- }
- console.info('get getP2pLinkedInfo: ' + JSON.stringify(data));
- // 添加P2P连接成功或者失败场景的业务处理
- });
- }
- // P2P连接完成,会调用'p2pConnectionChange'事件回调
- wifiManager.on('p2pConnectionChange', recvP2pConnectionChangeFunc);
-
- let recvP2pPeerDeviceChangeFunc = (result: wifiManager.WifiP2pDevice[]) => {
- console.info('p2p peer device change receive event: ' + JSON.stringify(result));
- wifiManager.getP2pPeerDevices((err, data) => {
- if (err) {
- console.error('failed to get peer devices: ' + JSON.stringify(err));
- return;
- }
- console.info('get peer devices: ' + JSON.stringify(data));
- let len = data.length;
- for (let i = 0; i < len; ++i) {
- // 选择符合条件的对端P2P设备
- if (data[i].deviceName === 'ShineAirPlay') {
- console.info('p2p connect to test device: ' + data[i].deviceAddress);
- let config: wifiManager.WifiP2PConfig = {
- deviceAddress: data[i].deviceAddress,
- deviceAddressType: 1,
- netId: -2,
- passphrase: '',
- groupName: '',
- goBand: 0,
- }
- // 执行P2P连接,作为GO时不能主动发起连接
- wifiManager.p2pConnect(config);
- this.message = 'p2p connect to test device: ' + data[i].deviceAddress;
- }
- }
- });
- }
- // P2P扫描结果上报时会调用'p2pPeerDeviceChange'事件回调
- wifiManager.on('p2pPeerDeviceChange', recvP2pPeerDeviceChangeFunc);
-
- setTimeout(() => {
- wifiManager.off('p2pConnectionChange', recvP2pConnectionChangeFunc);
- }, 125 * 1000);
- setTimeout(() => {
- wifiManager.off('p2pPeerDeviceChange', recvP2pPeerDeviceChangeFunc);
- }, 125 * 1000);
- // 开始发现P2P设备,即,开始P2P扫描
- console.info('start discover devices -> ' + wifiManager.startDiscoverDevices());
- }
-}
-
-// 默认导出let
-let p2pConnectManager = new P2PConnectMananger();
-
-export default p2pConnectManager as P2PConnectMananger;
-// [End create_p2p_connect]
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/model/Logger.ets
similarity index 51%
rename from code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
rename to code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/model/Logger.ets
index b1e212947256c5533c7b06285a597c94f840a6e3..4cff9feac7d46ee82a09640e56c434713be9c027 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/model/Logger.ets
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
* 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
@@ -13,15 +13,28 @@
* limitations under the License.
*/
-import { hilog } from '@kit.PerformanceAnalysisKit';
-import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+class Logger {
+ private prefix: string
-export default class EntryBackupAbility extends BackupExtensionAbility {
- async onBackup() {
- hilog.info(0x0000, 'testTag', 'onBackup ok');
+ constructor(prefix: string) {
+ this.prefix = prefix
}
- async onRestore(bundleVersion: BundleVersion) {
- hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ log(...args: string[]) {
+ console.log(`[${this.prefix}].${args.join(' ')}`)
}
-}
\ No newline at end of file
+
+ info(...args: string[]) {
+ console.log(`[${this.prefix}].${args.join(' ')}`)
+ }
+
+ debug(...args: string[]) {
+ console.log(`[${this.prefix}].${args.join(' ')}`)
+ }
+
+ error(...args: string[]) {
+ console.log(`[${this.prefix}].${args.join(' ')}`)
+ }
+}
+
+export default new Logger('[Sample_Wlan]')
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableP2p.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableP2p.ets
new file mode 100644
index 0000000000000000000000000000000000000000..120ba40b67cef4f678d57c16582915cdec8c1691
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableP2p.ets
@@ -0,0 +1,138 @@
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
+ * 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.
+ */
+
+import promptAction from '@ohos.promptAction'
+import Logger from '../model/Logger'
+import wifi from '@ohos.wifiManager';
+import { P2pView } from '../Component/p2pView'
+
+const TAG = 'availableP2p'
+
+/**
+ * available p2p page of WiFi test
+ */
+@Entry
+@Component
+struct WifiConnect {
+ @State p2pList: Array = []
+ @State p2pLinkedInfo: wifi.WifiP2pLinkedInfo | null = null;
+ private selectIndex: number = - 1
+ @State isSwitchOn: boolean = false;
+
+ addListener() {
+ // 连接状态改变时,修改连接信息
+ Logger.log(TAG, 'addListener');
+ wifi.on('p2pConnectionChange', async wifiP2pLinkedInfo => {
+ console.info('p2p connection change receive event: ' + JSON.stringify(wifiP2pLinkedInfo));
+ this.p2pLinkedInfo = wifiP2pLinkedInfo
+ let connectState = wifiP2pLinkedInfo.connectState
+ let p2pConnectionMessage = ''
+ switch ( connectState ) {
+ case 0:
+ p2pConnectionMessage = 'DISCONNECTED!';
+ this.p2pLinkedInfo = null
+ promptAction.showToast({ message : 'connect disabled' })
+ break;
+ case 1:
+ p2pConnectionMessage = 'CONNECTED!';
+ promptAction.showToast({ message : 'connect success' })
+ let curGp = await wifi.getCurrentGroup()
+ AppStorage.setOrCreate('p2pLinkedDeviceName', curGp.groupName)
+ break;
+ default:
+ p2pConnectionMessage = '未知状态';
+ break;
+ }
+ AppStorage.setOrCreate('p2pConnectState', connectState)
+ })
+
+ wifi.on('p2pPeerDeviceChange', async (_: wifi.WifiP2pDevice[]) => {
+ console.log(TAG, 'p2pPeerDeviceChange:', JSON.stringify(_))
+ try {
+ let devices = await wifi.getP2pPeerDevices()
+ this.p2pList = devices
+ } catch (e) {
+ console.log(JSON.stringify(e))
+ }
+ })
+ }
+
+ aboutToAppear() {
+ // 如果wifi是开的,就记录下状态,然后扫描p2p设备,并获取连接信息
+ if (!wifi.isWifiActive()) {
+ promptAction.showToast({ message : 'place active wifi' })
+ return
+ }
+ this.isSwitchOn = true;
+ wifi.startDiscoverDevices()
+ this.addListener();
+ }
+
+ aboutToDisappear() {
+ wifi.off('p2pPeerDeviceChange')
+ wifi.off('p2pConnectionChange')
+ }
+
+
+ connectP2p(p2pScanInfo: wifi.WifiP2pDevice) {
+ promptAction.showToast({ message : 'connect to device' })
+ console.log(TAG , `connect deviceAddress=${ p2pScanInfo.deviceAddress }`)
+ console.log(TAG , `p2pScanInfo:` + JSON.stringify(p2pScanInfo))
+ let config: wifi.WifiP2PConfig = {
+ deviceAddress : p2pScanInfo.deviceAddress,
+ netId : - 2 ,
+ deviceAddressType: 1,
+ passphrase : '' ,
+ groupName : '' ,
+ goBand : 0
+ }
+ wifi.p2pConnect(config)
+ }
+
+
+ build() {
+ Column() {
+ Row() {
+ Text($r('app.string.p2p_available'))
+ .fontSize(22)
+ .fontWeight(FontWeight.Bold)
+ .height(40)
+ }
+ .width('100%')
+ .padding({ left: 16, right: 16 })
+
+ List({ space: 5 }) {
+ ForEach(this.p2pList , (item: wifi.WifiP2pDevice , index: number) => {
+ ListItem() {
+ P2pView({ p2p : item })
+ }
+ .onClick(() => {
+ console.log(TAG , 'p2p click')
+ this.selectIndex = index
+ if ( this.p2pLinkedInfo !== null && this.p2pLinkedInfo.connectState == 1 ) {
+ promptAction.showToast({ message : 'this p2p is connected' })
+ return
+ }
+ this.connectP2p(item)
+ })
+ } , (item: wifi.WifiP2pDevice) => JSON.stringify(item));
+ }
+ .layoutWeight(1)
+ .divider({ strokeWidth : 1 , color : Color.Gray , startMargin : 10 , endMargin : 10 })
+ .margin(10)
+ }
+ .margin({ top : 15 , bottom : 100 })
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5ba15c5b2a461457b9b2f9509daf2b8df2572de7
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+import Logger from '../model/Logger'
+import { WifiView } from '../component/WifiView'
+import wifi from '@ohos.wifiManager'
+
+const TAG = 'AvailableWiFi'
+let self: AvailableWifi | null = null;
+@Entry
+@Component
+export struct AvailableWifi {
+ @State wifilist: Array = []
+ @State wifilisttest: Array = []
+ @State isSwitchOn: boolean = false;
+ private linkedInfo: wifi.WifiLinkedInfo | null = null;
+ @State isLinked: boolean = false;
+
+ // 扫描wifi
+ async getScanInfos() {
+ // 不停地扫描wifi
+ let result: wifi.WifiScanInfo[] = await wifi.getScanInfoList();
+
+ if (this.isSwitchOn) {
+ setTimeout(async () => {
+ this.wifilist = result
+ await this.getScanInfos();
+ }, 3000)
+ }
+ }
+
+ addListener() {
+ // 连接状态改变时,修改连接信息
+ wifi.on('wifiConnectionChange', async state => {
+ Logger.log(TAG, `wifiConnectionChange: ${state}`);
+ await this.getLinkedInfo();
+ })
+ // wifi状态改变时,先清空wifi列表,然后判断是否是开启状态,如果是就扫描
+ wifi.on('wifiStateChange', state => {
+ Logger.log(TAG, `wifiStateLisener state: ${state}`);
+ if (state === 1) { // 1: wifi is enable, 0:wifi is disable
+ this.isSwitchOn = true;
+ this.getScanInfos();
+ }
+ if (state === 0) { // 1: wifi is enable, 0:wifi is disable
+ this.isSwitchOn = false;
+ }
+ })
+ }
+
+ async getLinkedInfo() {
+ try {
+ let wifiLinkedInfo = await wifi.getLinkedInfo();
+ if (wifiLinkedInfo === null || wifiLinkedInfo.bssid === '') {
+ this.isLinked = false;
+ this.linkedInfo = null;
+ return;
+ }
+ this.isLinked = true;
+ this.linkedInfo = wifiLinkedInfo;
+ } catch (err) {
+ Logger.info(`getLinkedInfo failed err is ${JSON.stringify(err)}`);
+ }
+ }
+
+ aboutToAppear() {
+ if (wifi.isWifiActive()) {
+ Logger.log(TAG, 'wifi is active');
+ this.isSwitchOn = true;
+ this.getScanInfos();
+ this.getLinkedInfo();
+ }
+ Logger.log(TAG, 'wifi is disabled');
+ // 启动监听
+ this.addListener();
+ }
+
+ aboutToDisappear() {
+ wifi.off('wifiConnectionChange');
+ wifi.off('wifiStateChange');
+ }
+
+ build() {
+ Column() {
+ Row() {
+ Text($r('app.string.wlan'))
+ .fontSize(22)
+ .fontWeight(FontWeight.Bold)
+ .height(40)
+ Column() {
+ Toggle({ type: ToggleType.Switch, isOn: this.isSwitchOn })
+ .id('switch')
+ .onChange((isOn: boolean) => {
+ Logger.log(`wifi swtich is: ${isOn}`);
+ this.wifilist = this.wifilisttest
+ })
+ }
+ }
+ .width('100%')
+ .padding({ left: 16, right: 16 })
+
+ List({ space: 5 }) {
+ ForEach(this.isSwitchOn ? this.wifilist : this.wifilisttest, (wifiItem: wifi.WifiScanInfo) => {
+ ListItem() {
+ WifiView({ wifi: wifiItem })
+ }
+ }, (wifiItem: wifi.WifiScanInfo) => JSON.stringify(wifiItem));
+ }
+ }
+ .width('100%')
+ .height('100%')
+ .backgroundColor($r('app.color.index_bg'))
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/Index.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/Index.ets
index e4fc84051378d8502f1ac4292c13191d48c9a2a3..606ce4138dfb79ecb50c21420486737b2c301add 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/Index.ets
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/Index.ets
@@ -13,61 +13,62 @@
* limitations under the License.
*/
-import P2PManager from '../entryability/p2pability';
-import P2PConnectManager from '../entryability/p2pConnect';
-import { wifiManager } from '@kit.ConnectivityKit';
+import Logger from '../model/Logger';
+import { TitleBar } from '../component/TitleBar';
+import router from '@ohos.router'
+
+const TAG = 'Index';
@Entry
@Component
struct Index {
- @State message: string = 'p2p sample';
- scroller: Scroller = new Scroller();
-
build() {
- Column() {
- Text(this.message)
- Button('create group').onClick(async () => {
- try {
- // 创建P2P群组
- await P2PManager.create();
- let devices = await wifiManager.getLinkedInfo();
- if (Array.isArray(devices)) {
- this.message = JSON.stringify(devices, null, 2);
- } else {
- this.message = typeof devices === 'object' ? JSON.stringify(devices, null, 2) : String(devices);
- }
-
- } catch (error) {
- console.error('Error creating P2P group or getting peer devices:', error);
- this.message = 'Failed to create P2P group or get peer devices.';
- }
- })
- .width('30%')
- .margin('5')
+ Column({ space: 5 }) {
+ TitleBar()
+ Text($r('app.string.wifi_List'))
+ .fontColor(Color.Black)
+ .fontSize(20)
+ .layoutWeight(1)
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .borderRadius(5)
+ .width('100%')
+ // .fontColor($r('app.color.text_color'))
+ .backgroundColor($r('app.color.button_color2'))
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/AvailableWifi' })
+ })
- Button('connect').onClick(async () => {
- try {
- // 执行p2p连接
- await P2PConnectManager.connect();
- this.message = P2PConnectManager.message;
- } catch (error) {
- console.error('Error creating P2P group or getting peer devices:', error);
- this.message = 'Failed to connect.';
- }
- })
- .width('30%')
- .margin('5')
+ Text($r('app.string.wifi_Connect'))
+ .fontColor(Color.Black)
+ .fontSize(20)
+ .layoutWeight(1)
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .borderRadius(5)
+ .width('100%')
+ // .fontColor($r('app.color.text_color'))
+ .backgroundColor($r('app.color.text_color'))
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/WifiConnect' })
+ })
- Button('delete group').onClick(() => {
- // 删除p2p群组
- P2PManager.delete();
- let devices = wifiManager.getLinkedInfo();
- this.message = JSON.stringify(devices, null, 2);
- })
- .width('30%')
- .margin('5')
- }
- .height('100%')
- .width('100%')
+ Text($r('app.string.p2p_test'))
+ .fontColor(Color.Black)
+ .fontSize(20)
+ .layoutWeight(1)
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .borderRadius(5)
+ .width('100%')
+ // .fontColor($r('app.color.text_color'))
+ .backgroundColor($r('app.color.index_background'))
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/P2pTest' })
+ })
+ }
+ .width('100%')
+ .height('8%')
+ .backgroundColor($r('app.color.index_bg'))
}
}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pSetting.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pSetting.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f7ba4a3cd429b52d688e1051ea64bc44ca222fc1
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pSetting.ets
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+
+import Logger from '../model/Logger';
+import router from '@ohos.router'
+import wifi from '@ohos.wifiManager';
+import promptAction from '@ohos.promptAction'
+
+const TAG = 'p2pSetting'
+
+@Entry
+@Component
+struct p2pSetting {
+ @State deviceAddress: string = '6c:96:d7:3d:87:6f';
+ @State netId: number = - 2;
+ @State passphrase: string = '12345678';
+ @State groupName: string = 'testGroup'
+ @State goBand: number = 0;
+
+ aboutToAppear() {
+ AppStorage.setOrCreate('deviceAddress' , this.deviceAddress)
+ AppStorage.setOrCreate('netId' , this.netId)
+ AppStorage.setOrCreate('passphrase' , this.passphrase)
+ AppStorage.setOrCreate('groupName' , this.groupName)
+ AppStorage.setOrCreate('goBand' , this.goBand)
+ }
+
+
+ async createGroup() {
+ try {
+ let deviceInfo = await wifi.getP2pLocalDevice()
+ let config:wifi.WifiP2PConfig = {
+ deviceAddress: deviceInfo.deviceAddress,
+ netId: this.netId,
+ passphrase: this.passphrase,
+ groupName: this.groupName,
+ goBand: this.goBand,
+ }
+ console.log(`deviceAddress: ${config.deviceAddress}, netId: ${config.netId}, pwd: ${config.passphrase}, gpname: ${config.groupName}, goBand: ${config.goBand}`)
+ wifi.createGroup(config)
+ promptAction.showToast({ message : 'createGroup success' })
+ } catch (e) {
+ console.log(TAG, `createGroup Error: ${JSON.stringify(e)}`)
+ }
+ }
+
+ build() {
+ Column() {
+ Row() {
+ Text('deviceAddress:').fontSize(16).width(120)
+ TextInput({ text : this.deviceAddress , placeholder : 'input peripheral deviceId.' })
+ .fontSize('15vp')
+ .onChange((strInput: string) => {
+ this.deviceAddress = strInput;
+ //判断合法性
+ if ( strInput.length >= 1 ) {
+ AppStorage.setOrCreate('deviceAddress' , this.deviceAddress);
+ }
+ })
+ .width('80%')
+ .borderRadius(1)
+ }
+ .backgroundColor($r('app.color.moon'))
+ .padding(5)
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+
+ Column() {
+ Stack().height('0.25vp').backgroundColor('#000000');
+ Column() {
+ Row() {
+ Text('netId:').fontSize(15).width(60);
+ TextInput({ text : this.netId.toString() , placeholder : '-2' })
+ .fontSize('15vp')
+ .onChange((strInput: string) => {
+ this.netId = parseInt(strInput);
+ //判断合法性
+ if ( strInput.length >= 1 ) {
+ AppStorage.setOrCreate('netId' , this.netId);
+ }
+ })
+ .width('80%')
+ .borderRadius(1)
+ }
+ .padding(5)
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+ .backgroundColor($r('app.color.spring'))
+
+ Row() {
+ Text('passphrase:').fontSize(15).width(100);
+ TextInput({ text : this.passphrase , placeholder : 'input passphrase' })
+ .fontSize('15vp')
+ .onChange((strInput: string) => {
+ this.passphrase = strInput;
+ if ( strInput.length >= 1 ) {
+ AppStorage.setOrCreate('passphrase' , this.passphrase);
+ }
+ })
+ .width('80%')
+ .borderRadius(1)
+ }
+ .backgroundColor($r('app.color.spring'))
+ .padding(5)
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+
+ Row() {
+ Text('groupName:').fontSize(15).width(100);
+ TextInput({ text : this.groupName , placeholder : 'testGroup' })
+ .fontSize('15vp')
+ .onChange((strInput: string) => {
+ this.groupName = strInput;
+ if ( strInput.length >= 1 ) {
+ AppStorage.setOrCreate('groupName' , this.groupName);
+ }
+ })
+ .width('80%')
+ .borderRadius(1)
+ }
+ .backgroundColor($r('app.color.spring'))
+ .padding(5)
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+
+ Row() {
+ Text('goBand:').fontSize(15).width(80);
+ TextInput({ text : this.goBand.toString() , placeholder : '0' })
+ .fontSize('15vp')
+ .onChange((strInput: string) => {
+ this.goBand = Number(strInput);
+ if ( strInput.length >= 1 ) {
+ AppStorage.setOrCreate('goBand' , this.goBand);
+ }
+ })
+ .width('80%')
+ .borderRadius(1)
+ }
+ .backgroundColor($r('app.color.spring'))
+ .padding(5)
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+
+ }
+
+ Stack().height('0.25vp').backgroundColor('#000000');
+ }
+
+ Row() {
+ Button($r('app.string.create_group'))// .dialogButtonStyle()
+ .fontSize('16fp')
+ .onClick(() => {
+ if(this.passphrase === '' || this.groupName === '') {
+ Logger.log(TAG, 'ssid || preSharedKey is null');
+ promptAction.showToast({ message : 'passphrase or groupName is null' })
+ return;
+ }
+ this.createGroup();
+ })
+ .height('100%')
+ }
+ .width('50%')
+ .height('6%')
+ .justifyContent(FlexAlign.SpaceBetween)
+ }
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pTest.ets
similarity index 34%
rename from code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets
rename to code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pTest.ets
index d3c62deba090a1088bcb3cb05fcfbd7964cc776c..a6b259698fd6b34fdb28bf037ef9b63c9c8f0a4f 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/P2pTest.ets
@@ -13,44 +13,47 @@
* limitations under the License.
*/
-// [Start create_delete_p2p_group]
-import { wifiManager } from '@kit.ConnectivityKit';
+import Logger from '../model/Logger';
+import { TitleBar } from '../component/TitleBar';
+import router from '@ohos.router'
-export class P2PManager {
- private eventListeners = [];
- public recvP2pPersistentGroupChangeFunc = () => {
- console.info('p2p persistent group change receive event');
- // 永久组创建好后需要处理的业务逻辑
- };
+const TAG = 'Index';
- public create() {
- wifiManager.on('p2pPersistentGroupChange', this.recvP2pPersistentGroupChangeFunc);
- try {
- let config: wifiManager.WifiP2PConfig = {
- deviceAddress: '00:11:22:33:44:55',
- deviceAddressType: 1,
- netId: -2,
- passphrase: '12345678',
- groupName: 'testGroup',
- goBand: 0
- }
- wifiManager.createGroup(config);
- } catch (error) {
- console.error('failed:' + JSON.stringify(error));
- }
- }
+@Entry
+@Component
+struct P2pTest {
+ build() {
+ Column({ space: 5 }) {
+ Text($r('app.string.p2p_Connect'))
+ .fontColor(Color.Black)
+ .fontSize(20)
+ .layoutWeight(1)
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .borderRadius(5)
+ .width('100%')
+ // .fontColor($r('app.color.text_color'))
+ .backgroundColor($r('app.color.moon'))
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/AvailableP2p' })
+ })
- public delete() {
- try {
- wifiManager.removeGroup();
- } catch (error) {
- console.error('failed:' + JSON.stringify(error));
- }
+ Text($r('app.string.create_group_test'))
+ .fontColor(Color.Black)
+ .fontSize(20)
+ .layoutWeight(1)
+ .constraintSize({ minHeight: 50 })
+ .padding({ left: 15 })
+ .borderRadius(5)
+ .width('100%')
+ // .fontColor($r('app.color.text_color'))
+ .backgroundColor($r('app.color.cyan'))
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/P2pSetting' })
+ })
+ }
+ .width('100%')
+ .height('8%')
+ .backgroundColor($r('app.color.index_bg'))
}
-}
-
-// 默认导出let
-let p2pManager = new P2PManager();
-
-export default p2pManager as P2PManager;
-// [End create_delete_p2p_group]
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/WifiConnect.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/WifiConnect.ets
new file mode 100644
index 0000000000000000000000000000000000000000..af85486dda8155a865c209b23b8259ef5aaff0d8
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/WifiConnect.ets
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+import Logger from '../model/Logger'
+import promptAction from '@ohos.promptAction'
+import wifi from '@ohos.wifiManager'
+import router from '@ohos.router'
+
+const TAG = 'WifiConnect'
+@Entry
+@Component
+struct WifiConnect {
+ ssid: string = ''
+ password: string = ''
+ selectedSecurityType: wifi.WifiSecurityType = wifi.WifiSecurityType.WIFI_SEC_TYPE_INVALID
+ private linkedInfo: wifi.WifiLinkedInfo | null = null;
+ @State isLinked: boolean = false;
+ @State isSwitchOn: boolean = false;
+ @State wifiCandidateConfig: wifi.WifiDeviceConfig = {
+ ssid: '',
+ bssid: '',
+ preSharedKey: '',
+ isHiddenSsid: false,
+ securityType: 0
+ }
+ private controller: CustomDialogController | null = null;
+
+ async connectwifi(deviceConfig: wifi.WifiDeviceConfig) {
+ try {
+ promptAction.showToast({ message : 'connect to wifi' })
+ Logger.info(`connectwifi failed err is ${JSON.stringify(deviceConfig)}`);
+ wifi.addCandidateConfig(deviceConfig).then(result => {
+ // 连接指定网络
+ wifi.connectToCandidateConfig(result);
+ this.getLinkedInfo()
+ });
+ }catch(error){
+ console.error('sun failed:' + JSON.stringify(error));
+ }
+ }
+
+ async getLinkedInfo() {
+ try {
+ let wifiLinkedInfo = await wifi.getLinkedInfo();
+ if (wifiLinkedInfo === null || wifiLinkedInfo.bssid === '') {
+ this.isLinked = false;
+ this.linkedInfo = null;
+ return;
+ }
+ this.isLinked = true;
+ this.linkedInfo = wifiLinkedInfo;
+ } catch (err) {
+ Logger.info(`getLinkedInfo failed err is ${JSON.stringify(err)}`);
+ }
+ }
+
+ addListener() {
+ // 连接状态改变时,修改连接信息
+ wifi.on('wifiConnectionChange', async state => {
+ Logger.log(TAG, `wifiConnectionChange: ${state}`);
+ await this.getLinkedInfo();
+ })
+ }
+
+ aboutToAppear() {
+ // 如果wifi是开的,就记录下状态,然后扫描wifi,并获取连接信息
+ if (wifi.isWifiActive()) {
+ Logger.log(TAG, 'wifi is active');
+ this.isSwitchOn = true;
+ }
+ Logger.log(TAG, 'wifi is disabled');
+ // 启动监听
+ this.addListener();
+ }
+
+ build() {
+ Column() {
+ Column() {
+ Row() {
+ Text('ssid').fontSize('16fp').width('18%')
+ TextInput({ placeholder: $r('app.string.input_candidate_wifi_ssid') })
+ .placeholderColor(Color.Grey)
+ .placeholderFont({ size: '16fp' })
+ .caretColor(Color.Blue)
+ .width('80%')
+ .fontSize('16fp')
+ .fontColor($r('app.color.title_black_color'))
+ .onChange((value: string) => {
+ this.wifiCandidateConfig.ssid = value;
+ })
+ }
+ .width('100%')
+ .margin({ top: '3%' })
+
+ // .height( CommonConstants.TEXT_INPUT_HEIGHT )
+ // .backgroundColor( $r( 'app.color.input_background' ) )
+ Row() {
+ Text('bssid').fontSize('16fp').width('18%')
+ TextInput({ placeholder: $r('app.string.input_candidate_wifi_bssid') })
+ .placeholderColor(Color.Grey)
+ .placeholderFont({ size: '16fp' })
+ .caretColor(Color.Blue)
+ .width('80%')
+ .fontSize('16fp')
+ .fontColor($r('app.color.title_black_color'))
+ .onChange((value: string) => {
+ this.wifiCandidateConfig.bssid = value;
+ })
+ }
+ .width('100%')
+ .margin({ top: '3%' })
+
+ Row() {
+ Text('preSharedKey').fontSize('16fp').width('28%')
+ TextInput({ placeholder: $r('app.string.input_candidate_wifi_preSharedKey') })
+ .placeholderColor(Color.Grey)
+ .placeholderFont({ size: '16fp' })
+ .caretColor(Color.Blue)
+ .width('70%')
+ .fontSize('16fp')
+ .fontColor($r('app.color.title_black_color'))
+ .onChange((value: string) => {
+ this.wifiCandidateConfig.preSharedKey = value;
+ })
+ }
+ .width('100%')
+ .margin({ top: '3%' })
+
+
+ Row() {
+ Text('isHiddenSsid').fontSize('16fp').width('28%')
+ TextInput({ placeholder: $r('app.string.input_candidate_wifi_isHiddenSsid') })
+ .placeholderColor(Color.Grey)
+ .placeholderFont({ size: '16fp' })
+ .caretColor(Color.Blue)
+ .width('70%')
+ .fontSize('16fp')
+ .fontColor($r('app.color.title_black_color'))
+ .onChange((value: string) => {
+ this.wifiCandidateConfig.preSharedKey = value;
+ })
+ }
+ .width('100%')
+ .margin({ top: '3%' })
+
+ Row() {
+ Text('securityType').fontSize('16fp').width('28%')
+ Column() {
+ Select([
+ { value: 'WIFI_SEC_TYPE_INVALID' },
+ { value: 'WIFI_SEC_TYPE_OPEN' },
+ { value: 'WIFI_SEC_TYPE_PSK' },
+ { value: 'WIFI_SEC_TYPE_SAE' }
+ ])
+ .fontColor($r('app.color.title_black_color'))
+ .optionBgColor($r('app.color.input_background'))
+ .selectedOptionBgColor($r('app.color.input_background'))
+ .selectedOptionFontColor($r('app.color.input_background'))
+ .selected(0)
+ .value('WIFI_SEC_TYPE_INVALID')
+ .font({ size: 16 })
+ .selectedOptionFont({ size: 17 })
+ .optionFont({ size: 15 })
+ .width('100%')
+ .onSelect((index: number) => {
+ this.wifiCandidateConfig.securityType = index;
+ })
+ }
+ .width('70%')
+ .borderRadius(1)
+ }
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+ .width('100%')
+ .margin({ top: '3%' })
+
+ Row() {
+ Button($r('app.string.confirm_button'))// .dialogButtonStyle()
+ .onClick(() => {
+ if(this.wifiCandidateConfig.ssid === '' || this.wifiCandidateConfig.preSharedKey === '') {
+ Logger.log(TAG, 'ssid || preSharedKey is null');
+ promptAction.showToast({ message : 'ssid or preSharedKey is null' })
+ return;
+ }
+ this.connectwifi(this.wifiCandidateConfig);
+ })
+ .height('100%')
+ }
+ .width('70')
+ .height('6%')
+ .justifyContent(FlexAlign.SpaceBetween)
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/module.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/module.json5
index 97451e7eda0ea81494504dc9c5e5b5871738bec7..a494271f3af2e636f660e3d43385a6d2b5459d51 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/module.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/module.json5
@@ -18,7 +18,7 @@
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
- "mainElement": "EntryAbility",
+ "mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
@@ -26,16 +26,67 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.GET_WIFI_INFO",
+ "reason": "$string:GET_WIFI_INFO",
+ "usedScene": {
+ "abilities": [
+ "MainAbility"
+ ],
+ "when": "inuse"
+ },
+ },
+ {
+ "name": "ohos.permission.SET_WIFI_INFO",
+ "reason": "$string:SET_WIFI_INFO",
+ "usedScene": {
+ "abilities": [
+ "MainAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.LOCATION",
+ "reason": "$string:location_permission",
+ "usedScene": {
+ "abilities": [
+ "MainAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.APPROXIMATELY_LOCATION",
+ "reason": "$string:approximately_location_permission",
+ "usedScene": {
+ "abilities": [
+ "MainAbility"
+ ],
+ "when": "inuse"
+ }},
+ {
+ "name": "ohos.permission.GET_WIFI_PEERS_MAC",
+ "reason": "$string:GET_WIFI_PEERS_MAC",
+ "usedScene": {
+ "abilities": [
+ "MainAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ ],
"abilities": [
{
- "name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
+ "name": "EntryAbility",
"description": "$string:EntryAbility_desc",
- "icon": "$media:layered_image",
+ "icon": "$media:icon",
"label": "$string:EntryAbility_label",
- "startWindowIcon": "$media:startIcon",
+ "startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
- "exported": true,
+ "visible": true,
"skills": [
{
"entities": [
@@ -47,27 +98,6 @@
}
]
}
- ],
- "requestPermissions": [
- {
- // Add the permission for nfc tag operations.
- "name": "ohos.permission.GET_WIFI_INFO",
- "reason": "$string:app_name"
- }
- ],
- "extensionAbilities": [
- {
- "name": "EntryBackupAbility",
- "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
- "type": "backup",
- "exported": false,
- "metadata": [
- {
- "name": "ohos.extension.backup",
- "resource": "$profile:backup_config"
- }
- ]
- }
]
}
}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/color.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/color.json
index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..8919d0f5d480b0f118a27e07cf79019aeb1ae73a 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/color.json
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/color.json
@@ -3,6 +3,58 @@
{
"name": "start_window_background",
"value": "#FFFFFF"
+ },
+ {
+ "name": "index_bg",
+ "value": "#F5F5F5"
+ },
+ {
+ "name": "button_color",
+ "value": "#0D9FFB"
+ },
+ {
+ "name": "button_color1",
+ "value": "#007AFF"
+ },
+ {
+ "name": "button_color2",
+ "value": "#D7ECF1"
+ },
+ {
+ "name": "title_black_color",
+ "value": "#182431"
+ },
+ {
+ "name": "cyan",
+ "value": "#70919F"
+ },
+ {
+ "name": "spring",
+ "value": "#F5FFFA"
+ },
+ {
+ "name": "moon",
+ "value": "#D7ECF1"
+ },
+ {
+ "name": "main_blue",
+ "value": "#007DFF"
+ },
+ {
+ "name": "index_background",
+ "value": "#E8E7EB"
+ },
+ {
+ "name": "intput_background",
+ "value": "#D9B612"
+ },
+ {
+ "name": "input_background",
+ "value": "#D9B612"
+ },
+ {
+ "name": "text_color",
+ "value": "#8F8F8F"
}
]
}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/string.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/string.json
index 624c4b0902dd329d848a329ae66186575b912ed2..3511e0933d77c6a5b80711513af7ec2cf54f262b 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/string.json
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/string.json
@@ -10,7 +10,147 @@
},
{
"name": "EntryAbility_label",
- "value": "P2P"
+ "value": "Wlan"
+ },
+ {
+ "name": "entry_MainAbility",
+ "value": "eTSWLAN"
+ },
+ {
+ "name": "description_mainability",
+ "value": "eTSWLAN Ability"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "sure",
+ "value": "Sure"
+ },
+ {
+ "name": "wlan",
+ "value": "WLAN"
+ },
+ {
+ "name": "available_wlan",
+ "value": "Available WLAN"
+ },
+ {
+ "name": "wifi_List",
+ "value": "wifi_List"
+ },
+ {
+ "name": "connected",
+ "value": "connected"
+ },
+ {
+ "name": "ip_address",
+ "value": "IP address:"
+ },
+ {
+ "name": "gate_way",
+ "value": "Gateway:"
+ },
+ {
+ "name": "net_mask",
+ "value": "Netmask:"
+ },
+ {
+ "name": "primary_dns",
+ "value": "Primary Dns IP address:"
+ },
+ {
+ "name": "second_dns",
+ "value": "Second DNS IP address:"
+ },
+ {
+ "name": "server_ip",
+ "value": "DHCP server IP:"
+ },
+ {
+ "name": "lease_duration",
+ "value": "IP address lease duration:"
+ },
+ {
+ "name": "country_code",
+ "value": "Country code:"
+ },
+ {
+ "name": "infrastructure_feature",
+ "value": "Infrastructure Feature:"
+ },
+ {
+ "name": "ghz_feature",
+ "value": "5 GHz Feature:"
+ },
+ {
+ "name": "gas_anqp_feature",
+ "value": "GAS/ANQP Feature:"
+ },
+ {
+ "name": "wifi_direct",
+ "value": "WiFi-Direct Feature:"
+ },
+ {
+ "name": "soft_ap",
+ "value": "Soft AP Feature:"
+ },
+ {
+ "name": "wifi_aware",
+ "value": "WiFi Aware Feature:"
+ },
+ {
+ "name": "encryption",
+ "value": "encrypted"
+ },
+ {
+ "name": "open",
+ "value": "open"
+ },
+ {
+ "name": "location_permission",
+ "value": "Allow app to obtain device location information"
+ },
+ {
+ "name": "approximately_location_permission",
+ "value": "Allow app to obtain device ambiguous location information"
+ },
+ {
+ "name": "GET_WIFI_INFO",
+ "value": "Allow applications to obtain Wi Fi information"
+ },
+ {
+ "name": "SET_WIFI_INFO",
+ "value": "Allow applications to configure Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_INFO_INTERNAL",
+ "value": "Allow system processes to obtain Wi Fi related parameters"
+ },
+ {
+ "name": "GET_WIFI_PEERS_MAC",
+ "value": "Allow applications to obtain the MAC address of peer Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_LOCAL_MAC",
+ "value": "Allow applications to obtain the MAC address of local Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_CONFIG",
+ "value": "Allow applications to obtain Wi Fi configuration information"
+ },
+ {
+ "name": "SET_WIFI_CONFIG",
+ "value": "Allow applications to configure Wi Fi information"
+ },
+ {
+ "name": "MANAGE_WIFI_CONNECTION",
+ "value": "Allow applications to manage Wi Fi connections"
+ },
+ {
+ "name": "MANAGE_WIFI_HOTSPOT",
+ "value": "Allow applications to turn on or off Wi Fi hotspots"
}
]
}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/about.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/about.png
new file mode 100644
index 0000000000000000000000000000000000000000..2613fc352850e45f0582fa825183e3928cef3378
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/about.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/background.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/background.png
deleted file mode 100644
index f939c9fa8cc8914832e602198745f592a0dfa34d..0000000000000000000000000000000000000000
Binary files a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/background.png and /dev/null differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/foreground.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/foreground.png
deleted file mode 100644
index 4483ddad1f079e1089d685bd204ee1cfe1d01902..0000000000000000000000000000000000000000
Binary files a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/foreground.png and /dev/null differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/ic_back.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/ic_back.png
new file mode 100644
index 0000000000000000000000000000000000000000..9f793557fd1ba7a4941e2ba4dea6fc2316eb5f24
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/ic_back.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/icon.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/icon.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/layered_image.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/layered_image.json
deleted file mode 100644
index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/layered_image.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "layered-image":
- {
- "background" : "$media:background",
- "foreground" : "$media:foreground"
- }
-}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/lock.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/lock.png
new file mode 100644
index 0000000000000000000000000000000000000000..b78d86d2fc3afcc542f069b75ada2338fcf1a71a
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/lock.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/startIcon.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/startIcon.png
deleted file mode 100644
index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000
Binary files a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/startIcon.png and /dev/null differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/wifi.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/wifi.png
new file mode 100644
index 0000000000000000000000000000000000000000..7017ea920f2683095b49d9f8221e40d7697f9943
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/wifi.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/backup_config.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/backup_config.json
deleted file mode 100644
index 78f40ae7c494d71e2482278f359ec790ca73471a..0000000000000000000000000000000000000000
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/backup_config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "allowToBackupRestore": true
-}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/main_pages.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/main_pages.json
index 1898d94f58d6128ab712be2c68acc7c98e9ab9ce..ae818d5d433790df8603e9ed8d082b79f411f166 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/main_pages.json
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/main_pages.json
@@ -1,5 +1,10 @@
{
"src": [
- "pages/Index"
+ "pages/Index",
+ "pages/AvailableWifi",
+ "pages/WifiConnect",
+ "pages/P2pTest",
+ "pages/P2pSetting",
+ "pages/AvailableP2p"
]
-}
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/dark/element/color.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/dark/element/color.json
deleted file mode 100644
index 79b11c2747aec33e710fd3a7b2b3c94dd9965499..0000000000000000000000000000000000000000
--- a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/dark/element/color.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "color": [
- {
- "name": "start_window_background",
- "value": "#000000"
- }
- ]
-}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/en_US/element/string.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..53657655fc0157d5558c4210dc1a5f41095285c6
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,232 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Wlan"
+ },
+ {
+ "name": "entry_MainAbility",
+ "value": "eTSWLAN"
+ },
+ {
+ "name": "description_mainability",
+ "value": "eTSWLAN Ability"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "wlan",
+ "value": "WLAN"
+ },
+ {
+ "name": "sure",
+ "value": "Sure"
+ },
+ {
+ "name": "available_wlan",
+ "value": "Available WLAN"
+ },
+ {
+ "name": "connected",
+ "value": "Connected"
+ },
+ {
+ "name": "about",
+ "value": "About"
+ },
+ {
+ "name": "ip_address",
+ "value": "IP address:"
+ },
+ {
+ "name": "gate_way",
+ "value": "Gateway:"
+ },
+ {
+ "name": "net_mask",
+ "value": "Netmask:"
+ },
+ {
+ "name": "primary_dns",
+ "value": "Primary Dns IP address:"
+ },
+ {
+ "name": "second_dns",
+ "value": "Second DNS IP address:"
+ },
+ {
+ "name": "server_ip",
+ "value": "DHCP server IP:"
+ },
+ {
+ "name": "lease_duration",
+ "value": "IP address lease duration:"
+ },
+ {
+ "name": "country_code",
+ "value": "Country code:"
+ },
+ {
+ "name": "infrastructure_feature",
+ "value": "Infrastructure Feature:"
+ },
+ {
+ "name": "ghz_feature",
+ "value": "5 GHz Feature:"
+ },
+ {
+ "name": "gas_anqp_feature",
+ "value": "GAS/ANQP Feature:"
+ },
+ {
+ "name": "wifi_List",
+ "value": "wifi_List"
+ },
+ {
+ "name": "getScanInfoList",
+ "value": "ȡɨ"
+ },
+ {
+ "name": "wifi_Connect",
+ "value": ""
+ },
+ {
+ "name": "cancel_button",
+ "value": "ȡ"
+ },
+ {
+ "name": "confirm_button",
+ "value": "ȷ"
+ },
+ {
+ "name": "input_candidate_wifi_bssid",
+ "value": "ѡWiFibssid(MAC) (ɲ)"
+ },
+ {
+ "name": "input_candidate_wifi_preSharedKey",
+ "value": "ѡWiFi"
+ },
+ {
+ "name": "input_candidate_wifi_isHiddenSsid",
+ "value": "10 (ɲ;1:ture,0:false)"
+ },
+ {
+ "name": "add_task",
+ "value": "Ӻѡwifi"
+ },
+ {
+ "name": "p2p_available",
+ "value": "Ե豸"
+ },
+ {
+ "name": "p2p_test",
+ "value": "p2p"
+ },
+ {
+ "name": "create_group_test",
+ "value": "Ⱥ"
+ },
+ {
+ "name": "create_group",
+ "value": "Ⱥ"
+ },
+ {
+ "name": "useful",
+ "value": ""
+ },
+ {
+ "name": "p2pConnected",
+ "value": ""
+ },
+ {
+ "name": "input_candidate_wifi",
+ "value": "ѡWiFi"
+ },
+ {
+ "name": "input_candidate_wifi_ssid",
+ "value": "ѡWiFiSSID"
+ },
+ {
+ "name": "p2p_Connect",
+ "value": "p2p"
+ },
+ {
+ "name": "cancle_button",
+ "value": "cancle"
+ },
+ {
+ "name": "wifi_direct",
+ "value": "WiFi-Direct Feature:"
+ },
+ {
+ "name": "soft_ap",
+ "value": "Soft AP Feature:"
+ },
+ {
+ "name": "wifi_aware",
+ "value": "WiFi Aware Feature:"
+ },
+ {
+ "name": "encryption",
+ "value": "encrypted"
+ },
+ {
+ "name": "open",
+ "value": "open"
+ },
+ {
+ "name": "location_permission",
+ "value": "Allow app to obtain device location information"
+ },
+ {
+ "name": "approximately_location_permission",
+ "value": "Allow app to obtain device ambiguous location information"
+ },
+ {
+ "name": "GET_WIFI_INFO",
+ "value": "Allow applications to obtain Wi Fi information"
+ },
+ {
+ "name": "SET_WIFI_INFO",
+ "value": "Allow applications to configure Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_INFO_INTERNAL",
+ "value": "Allow system processes to obtain Wi Fi related parameters"
+ },
+ {
+ "name": "GET_WIFI_PEERS_MAC",
+ "value": "Allow applications to obtain the MAC address of peer Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_LOCAL_MAC",
+ "value": "Allow applications to obtain the MAC address of local Wi Fi devices"
+ },
+ {
+ "name": "GET_WIFI_CONFIG",
+ "value": "Allow applications to obtain Wi Fi configuration information"
+ },
+ {
+ "name": "SET_WIFI_CONFIG",
+ "value": "Allow applications to configure Wi Fi information"
+ },
+ {
+ "name": "MANAGE_WIFI_CONNECTION",
+ "value": "Allow applications to manage Wi Fi connections"
+ },
+ {
+ "name": "MANAGE_WIFI_HOTSPOT",
+ "value": "Allow applications to turn on or off Wi Fi hotspots"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/zh_CN/element/string.json b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..d8484995039bd0b90dfb845c4095af4da6a633b0
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,232 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Wlan"
+ },
+ {
+ "name": "entry_MainAbility",
+ "value": "eTSWLAN"
+ },
+ {
+ "name": "description_mainability",
+ "value": "eTSWLAN Ability"
+ },
+ {
+ "name": "cancel",
+ "value": "取消"
+ },
+ {
+ "name": "sure",
+ "value": "确定"
+ },
+ {
+ "name": "wlan",
+ "value": "WLAN"
+ },
+ {
+ "name": "available_wlan",
+ "value": "可用WLAN"
+ },
+ {
+ "name": "connected",
+ "value": "已连接"
+ },
+ {
+ "name": "about",
+ "value": "关于"
+ },
+ {
+ "name": "ip_address",
+ "value": "IP地址:"
+ },
+ {
+ "name": "gate_way",
+ "value": "网关:"
+ },
+ {
+ "name": "net_mask",
+ "value": "掩码:"
+ },
+ {
+ "name": "primary_dns",
+ "value": "主DNS服务器:"
+ },
+ {
+ "name": "second_dns",
+ "value": "备DNS服务器:"
+ },
+ {
+ "name": "server_ip",
+ "value": "DHCP服务端ip:"
+ },
+ {
+ "name": "lease_duration",
+ "value": "IP地址租用时长:"
+ },
+ {
+ "name": "country_code",
+ "value": "国家码:"
+ },
+ {
+ "name": "infrastructure_feature",
+ "value": "基础结构模式特性:"
+ },
+ {
+ "name": "ghz_feature",
+ "value": "5 GHz 宽带特性:"
+ },
+ {
+ "name": "gas_anqp_feature",
+ "value": "GAS/ANQP特性:"
+ },
+ {
+ "name": "wifi_List",
+ "value": "Wi-Fi 列表"
+ },
+ {
+ "name": "getScanInfoList",
+ "value": "获取扫描结果"
+ },
+ {
+ "name": "wifi_Connect",
+ "value": "建议网络连接"
+ },
+ {
+ "name": "cancel_button",
+ "value": "取消"
+ },
+ {
+ "name": "confirm_button",
+ "value": "确定"
+ },
+ {
+ "name": "input_candidate_wifi_bssid",
+ "value": "输入候选WiFi的bssid(MAC) (可不填)"
+ },
+ {
+ "name": "input_candidate_wifi_preSharedKey",
+ "value": "输入候选WiFi密码"
+ },
+ {
+ "name": "input_candidate_wifi_isHiddenSsid",
+ "value": "输入1或0 (可不填;1:ture,0:false)"
+ },
+ {
+ "name": "add_task",
+ "value": "添加候选wifi"
+ },
+ {
+ "name": "p2p_available",
+ "value": "对等设备"
+ },
+ {
+ "name": "p2p_test",
+ "value": "p2p测试"
+ },
+ {
+ "name": "create_group_test",
+ "value": "创建群组测试"
+ },
+ {
+ "name": "create_group",
+ "value": "创建群组"
+ },
+ {
+ "name": "useful",
+ "value": "可用"
+ },
+ {
+ "name": "p2pConnected",
+ "value": "已连接"
+ },
+ {
+ "name": "input_candidate_wifi",
+ "value": "输入候选WiFi的配置"
+ },
+ {
+ "name": "input_candidate_wifi_ssid",
+ "value": "输入候选WiFi的SSID"
+ },
+ {
+ "name": "p2p_Connect",
+ "value": "p2p连接"
+ },
+ {
+ "name": "cancle_button",
+ "value": "cancle"
+ },
+ {
+ "name": "wifi_direct",
+ "value": "WiFi-Direct特性:"
+ },
+ {
+ "name": "soft_ap",
+ "value": "Soft AP特性:"
+ },
+ {
+ "name": "wifi_aware",
+ "value": "WiFi Aware组网特性:"
+ },
+ {
+ "name": "encryption",
+ "value": "加密"
+ },
+ {
+ "name": "open",
+ "value": "开放"
+ },
+ {
+ "name": "location_permission",
+ "value": "允许应用获取设备位置信息"
+ },
+ {
+ "name": "approximately_location_permission",
+ "value": "允许应用获取设备模糊位置信息"
+ },
+ {
+ "name": "GET_WIFI_INFO",
+ "value": "允许应用获取Wi-Fi信息"
+ },
+ {
+ "name": "SET_WIFI_INFO",
+ "value": "允许应用配置Wi-Fi设备"
+ },
+ {
+ "name": "GET_WIFI_INFO_INTERNAL",
+ "value": "允许系统进程获取Wi-Fi相关参数"
+ },
+ {
+ "name": "GET_WIFI_PEERS_MAC",
+ "value": "允许应用获取对端Wi-Fi设备的MAC地址"
+ },
+ {
+ "name": "GET_WIFI_LOCAL_MAC",
+ "value": "允许应用获取本机的Wi-Fi设备的MAC地址"
+ },
+ {
+ "name": "GET_WIFI_CONFIG",
+ "value": "允许应用获取Wi-Fi的配置信息"
+ },
+ {
+ "name": "SET_WIFI_CONFIG",
+ "value": "允许应用配置Wi-Fi信息"
+ },
+ {
+ "name": "MANAGE_WIFI_CONNECTION",
+ "value": "允许应用管理Wi-Fi的连接"
+ },
+ {
+ "name": "MANAGE_WIFI_HOTSPOT",
+ "value": "允许应用开启或关闭Wi-Fi热点"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/hvigor/hvigor-config.json5 b/code/DocsSample/ConnectivityKit/Wlan/hvigor/hvigor-config.json5
index 1e473e424320d4e68b16737b289f5c851bb19d36..48fb346926eb36f8b2c028fd4319ac3e56165409 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/hvigor/hvigor-config.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/hvigor/hvigor-config.json5
@@ -1,22 +1,5 @@
{
- "modelVersion": "5.0.1",
+ "modelVersion": "5.0.5",
"dependencies": {
- },
- "execution": {
- // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
- // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
- // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
- // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
- // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
- },
- "logging": {
- // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
- },
- "debugging": {
- // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
- },
- "nodeOptions": {
- // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
- // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
}
}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/hvigorfile.ts b/code/DocsSample/ConnectivityKit/Wlan/hvigorfile.ts
index 2a5e543f190732c159beb574dfc9fa37bc94e156..64b143a6ae9b2db7e61a01fbe50ae7b5634a80a1 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/hvigorfile.ts
+++ b/code/DocsSample/ConnectivityKit/Wlan/hvigorfile.ts
@@ -13,9 +13,6 @@
* limitations under the License.
*/
-import { appTasks } from '@ohos/hvigor-ohos-plugin';
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { appTasks } from '@ohos/hvigor-ohos-plugin'
-export default {
- system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
- plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
-}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/oh-package.json5 b/code/DocsSample/ConnectivityKit/Wlan/oh-package.json5
index 14655ea1c07e1b7b8b8eb3d9f6813577b90f6a0f..5f609682201b4eeccf312f5e6781abddb98c23c7 100644
--- a/code/DocsSample/ConnectivityKit/Wlan/oh-package.json5
+++ b/code/DocsSample/ConnectivityKit/Wlan/oh-package.json5
@@ -14,12 +14,14 @@
*/
{
- "modelVersion": "5.0.1",
- "description": "Please describe the basic information.",
- "dependencies": {
- },
+ "modelVersion": "5.0.5",
+ "license": "ISC",
"devDependencies": {
- "@ohos/hypium": "1.0.19",
- "@ohos/hamock": "1.0.0"
- }
+ "@ohos/hypium": "1.0.6"
+ },
+ "name": "wlan",
+ "description": "example description",
+ "repository": {},
+ "version": "1.0.0",
+ "dependencies": {},
}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/GET_WIFI_PEERS_MAC.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/GET_WIFI_PEERS_MAC.png
new file mode 100644
index 0000000000000000000000000000000000000000..9735598afc20df84495b15be119750bd92d62f87
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/GET_WIFI_PEERS_MAC.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/ab45c4fb_12037546.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/ab45c4fb_12037546.png
new file mode 100644
index 0000000000000000000000000000000000000000..0167e91b705a541fdd1ddb230d7c97b84ec105a2
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/ab45c4fb_12037546.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/connect_wifi.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/connect_wifi.png
new file mode 100644
index 0000000000000000000000000000000000000000..29cfe4907984c6cc08f7dbafe51e47e74a0bcb2b
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/connect_wifi.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/creatgroup.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/creatgroup.png
new file mode 100644
index 0000000000000000000000000000000000000000..595e57bc6496d660ee664ea5cec294c43668cc4d
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/creatgroup.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/main.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/main.png
new file mode 100644
index 0000000000000000000000000000000000000000..8c495d76df076285552397b93e61f7e45423dc15
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/main.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2pconnect.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2pconnect.png
new file mode 100644
index 0000000000000000000000000000000000000000..e97c119452864f0314a52a4214b3dad983277719
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2pconnect.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2ptest.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2ptest.png
new file mode 100644
index 0000000000000000000000000000000000000000..3253280d50a04e481c52386af3daaf838bb799e4
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/p2ptest.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg b/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg
deleted file mode 100644
index 886050dfd8918801b618617a92106f68457cf064..0000000000000000000000000000000000000000
Binary files a/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg and /dev/null differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/wifi_list.png b/code/DocsSample/ConnectivityKit/Wlan/screenshots/wifi_list.png
new file mode 100644
index 0000000000000000000000000000000000000000..b80efef376dc41afe8a990444e05dd5f612cc410
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/wifi_list.png differ