diff --git a/OAT.xml b/OAT.xml
index 80e83a6013de0bfa1cab2607de67ac9a5217e882..52a25d28dda3829293879b51c4fd26b7542179c2 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -1406,6 +1406,7 @@ Note:If the text contains special characters, please escape them according to th
+
diff --git a/code/BasicFeature/Graphics/Graphics3d/entry/src/main/ets/graphics3d/node_light.ets b/code/BasicFeature/Graphics/Graphics3d/entry/src/main/ets/graphics3d/node_light.ets
index 4e3a2b497328b7bf3e17eff18b7a0683ccbb1410..f1ec2cb405f7b5df2eb244264ca92e172484c012 100644
--- a/code/BasicFeature/Graphics/Graphics3d/entry/src/main/ets/graphics3d/node_light.ets
+++ b/code/BasicFeature/Graphics/Graphics3d/entry/src/main/ets/graphics3d/node_light.ets
@@ -242,6 +242,14 @@ struct nodeLight {
shadowFlag = !shadowFlag;
this.UpdateLights();
}).id('enable_shadow');
+
+ Button('change light rotation').onClick(() => {
+ if (!this.scene || !this.lgt || this.lgt.lightType != scene3d.LightType.DIRECTIONAL) {
+ return;
+ }
+ this.lgt.position = { x: 4.0, y: 5.0, z: 6.0 };
+ this.lgt.rotation = { x: 0.3, y: 0.4, z: 0.5, w: 0.2 };
+ });
}
}
diff --git a/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
index de7e4e0ae556212726b8a5f0b78bfbbe00a468f9..fcdb89404d15f36e530c292f85307a6a29e78123 100644
--- a/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
+++ b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
+ * Copyright (c) 2022-2024 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,10 +13,10 @@
* limitations under the License.
*/
-import fileio from '@ohos.fileio'
-import image from '@ohos.multimedia.image'
-import photoAccessHelper from '@ohos.file.photoAccessHelper'
-import common from '@ohos.app.ability.common'
+import fileio from '@ohos.fileio';
+import image from '@ohos.multimedia.image';
+import photoAccessHelper from '@ohos.file.photoAccessHelper';
+import common from '@ohos.app.ability.common';
import prompt from '@ohos.promptAction';
import {
BarcodeFormat,
@@ -30,20 +30,25 @@ import {
BinaryBitmap,
HybridBinarizer
} from '@ohos/zxing';
-import DateTimeUtil from '../utils/DateTimeUtil'
-import { CameraService } from './CameraService'
+import DateTimeUtil from '../utils/DateTimeUtil';
+import { CameraService } from './CameraService';
import { QRCodeScanConst, ImageAttribute, DecodeResultAttribute } from './QRCodeScanConst';
-import Logger from '../utils/Logger'
-import Want from '@ohos.app.ability.Want'
-import dataSharePredicates from '@ohos.data.dataSharePredicates'
+import Logger from '../utils/Logger';
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+import deviceInfo from '@ohos.deviceInfo';
-const TAG: string = 'QRCodeParser'
-let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
+const TAG: string = 'QRCodeParser';
/**
* 二维码解析器
*/
class QRCodeParser {
+ private deviceType: string = 'default';
+
+ constructor() {
+ this.deviceType = deviceInfo.deviceType;
+ Logger.info(TAG, `deviceType: ${this.deviceType}`);
+ }
/**
* 解析从相机获取的二维码图片
@@ -102,35 +107,59 @@ class QRCodeParser {
* @param imageSrc
*/
async parseImageQRCode(imageSrc: string): Promise {
- Logger.info(`parseImageQRCode start`);
- let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context'));
- let imagesIdFetchOp: photoAccessHelper.FetchOptions = {
- fetchColumns: [],
- predicates: predicates.equalTo('uri', imageSrc)
- }
- // 获取图片文件资源
- let fetchIdFileResult = await media.getAssets(imagesIdFetchOp);
- let fileIdAsset = await fetchIdFileResult.getFirstObject();
- // 获取文件描述符
- let fd = await fileIdAsset.open('RW');
- // 获取PixelMap图片数据
- let imageSource = image.createImageSource(fd, { sourceDensity: 120, sourceSize: { width: 120, height: 120 } })
- let decodingOptions: image.DecodingOptions = {
- sampleSize: 1,
- editable: true,
- desiredSize: { width: 120, height: 120 },
- rotate: 0,
- desiredPixelFormat: 3,
- desiredRegion: { size: { height: 120, width: 120 }, x: 0, y: 0 },
- index: 0
+ Logger.info(TAG, `parseImageQRCode start`);
+ let parseResult: DecodeResultAttribute = {
+ isSucess: false,
+ decodeResult: 'failed'
};
- let pixMapData = await imageSource.createPixelMap(decodingOptions);
- let pixelBytesNumber = pixMapData.getPixelBytesNumber();
- let arrayBuffer: ArrayBuffer = new ArrayBuffer(pixelBytesNumber);
- // 读取图像像素数据,结果写入ArrayBuffer里
- await pixMapData.readPixelsToBuffer(arrayBuffer);
+ let width: number;
+ let height: number;
+ let pixelBytesNumber: number;
+ let arrayBuffer: ArrayBuffer;
+ if (this.deviceType !== 'default') {
+ let imageSource: ImageAttribute = await this.getImageSource(imageSrc);
+ imageSource = await this.getImageSource(imageSrc);
+ // 图片宽高
+ width = imageSource.width;
+ height = imageSource.height;
+ pixelBytesNumber = imageSource.pixelMap.getPixelBytesNumber();
+ arrayBuffer = new ArrayBuffer(pixelBytesNumber);
+ // 读取图像像素数据,结果写入ArrayBuffer里
+ await imageSource.pixelMap.readPixelsToBuffer(arrayBuffer);
+ } else {
+ let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context'));
+ let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
+ let imagesIdFetchOp: photoAccessHelper.FetchOptions = {
+ fetchColumns: [],
+ predicates: predicates.equalTo('uri', imageSrc)
+ };
+ // 获取图片文件资源
+ let fetchIdFileResult = await media.getAssets(imagesIdFetchOp);
+ let fileIdAsset = await fetchIdFileResult.getFirstObject();
+ // 获取文件描述符
+ let fd = await fileIdAsset.open('RW');
+ // 获取PixelMap图片数据
+ let imageSource = image.createImageSource(fd, { sourceDensity: 120, sourceSize: { width: 120, height: 120 } });
+ let decodingOptions: image.DecodingOptions = {
+ sampleSize: 1,
+ editable: true,
+ desiredSize: { width: 120, height: 120 },
+ rotate: 0,
+ desiredPixelFormat: 3,
+ desiredRegion: { size: { height: 120, width: 120 }, x: 0, y: 0 },
+ index: 0
+ };
+ // 图片宽高
+ width = 120;
+ height = 120;
+ let pixMapData = await imageSource.createPixelMap(decodingOptions);
+ pixelBytesNumber = pixMapData.getPixelBytesNumber();
+ arrayBuffer = new ArrayBuffer(pixelBytesNumber);
+ // 读取图像像素数据,结果写入ArrayBuffer里
+ await pixMapData.readPixelsToBuffer(arrayBuffer);
+ }
let int32Array = new Int32Array(arrayBuffer);
- let luminanceSource = new RGBLuminanceSource(int32Array, 120, 120);
+ let luminanceSource = new RGBLuminanceSource(int32Array, width, height);
let binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));
let mltiFormatReader = new MultiFormatReader();
let hints: Map = new Map();
@@ -140,14 +169,16 @@ class QRCodeParser {
// 解析二维码
let decodeResult = mltiFormatReader.decode(binaryBitmap);
let decodeText = decodeResult.getText();
- Logger.info(`parseImageQRCode end ${decodeText}`);
- return { isSucess: true, decodeResult: decodeText };
+ Logger.info(TAG, `parseImageQRCode end ${decodeText}`);
+ parseResult = { isSucess: true, decodeResult: decodeText };
} catch (err) {
let error = `The error is ${err}`;
- Logger.info(`parseImageQRCode end`);
- return { isSucess: false, decodeResult: error };
+ Logger.info(TAG, `parseImageQRCode end`);
+ parseResult = { isSucess: false, decodeResult: error };
}
+ return parseResult;
}
+
/**
* 获取图片的属性
* @param context
@@ -156,10 +187,11 @@ class QRCodeParser {
async getImageSource(imageSrc: string): Promise {
Logger.info(`getImageSource start`);
let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context'));
+ let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
let imagesIdFetchOp: photoAccessHelper.FetchOptions = {
fetchColumns: ['width', 'height'],
predicates: predicates.equalTo('uri', imageSrc)
- }
+ };
// 获取图片文件资源
let fetchIdFileResult = await media.getAssets(imagesIdFetchOp);
let fileIdAsset = await fetchIdFileResult.getFirstObject();
@@ -186,6 +218,7 @@ class QRCodeParser {
pixelMap: pixelMap
};
}
+
/**
* 在媒体公共资源目录下的创建指定类型的资源对象
*/
diff --git a/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
index 336913ad7c53b85a1e6f3172d657a0b18b159a79..d9566165a06d23b45ee7ff87e75d386815ea5658 100644
--- a/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
+++ b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
@@ -23,6 +23,7 @@ import { QRCodeParser } from '../QRCodeParser';
import Logger from '../../utils/Logger';
import { BusinessError } from '@ohos.base';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
+import photoAccessHelper from '@ohos.file.photoAccessHelper';
const TAG: string = 'QRCodeScanComponent';
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
@@ -167,20 +168,13 @@ export default struct QRCodeScanComponent {
.onClick(async () => {
// 打开相册获取图片
this.isQRCodeScanStopped = true
- let context = AppStorage.Get('context') as common.UIAbilityContext
- await context.startAbilityForResult({
- parameters: { uri: 'singleselect' },
- bundleName: 'com.ohos.photos',
- abilityName: 'com.ohos.photos.MainAbility',
- }).then(data => {
- // 获取want数据
- let want = data['want'];
- if (want) {
- // param代表want参数中的paramters
- let param = want['parameters'];
- if (param) {
+ let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
+ photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
+ photoSelectOptions.maxSelectNumber = 1; // 最多只允许选择一张图片
+ let photoPicker = new photoAccessHelper.PhotoViewPicker();
+ photoPicker.select(photoSelectOptions).then((data: photoAccessHelper.PhotoSelectResult) => {
// 被选中的图片路径media/image/8
- let selectedUri = param['select-item-list'];
+ let selectedUri = data.photoUris[0];
setTimeout(async () => {
if (!selectedUri) {
prompt.showToast({
@@ -197,7 +191,7 @@ export default struct QRCodeScanComponent {
}, 4000)
}
// 获取解析数据
- let qrCodeParseRlt: DecodeResultAttribute = await this.qrCodeParser.parseImageQRCode((selectedUri as string[])[0]);
+ let qrCodeParseRlt: DecodeResultAttribute = await this.qrCodeParser.parseImageQRCode(selectedUri);
if (qrCodeParseRlt.isSucess) {
prompt.showDialog({
title: $r('app.string.qrcodeResult'),
@@ -209,8 +203,6 @@ export default struct QRCodeScanComponent {
})
}
}, 50)
- }
- }
})
})
diff --git a/code/BasicFeature/Media/QRCodeScan/entry/src/main/module.json5 b/code/BasicFeature/Media/QRCodeScan/entry/src/main/module.json5
index 3f0809dbf8d7794eaccf15ed787bc6bf83cf8411..8217f44f6fd2c5d6b45985f9776b0347a92254c0 100644
--- a/code/BasicFeature/Media/QRCodeScan/entry/src/main/module.json5
+++ b/code/BasicFeature/Media/QRCodeScan/entry/src/main/module.json5
@@ -30,30 +30,30 @@
"requestPermissions": [
{
"name": "ohos.permission.CAMERA",
- "reason": "$string:read_image_video_permission",
+ "reason": "$string:use_camera_permission",
"usedScene": {
- "when": "always"
+ "when": "inuse"
}
},
{
"name": "ohos.permission.MEDIA_LOCATION",
- "reason": "$string:read_image_video_permission",
+ "reason": "$string:media_location_permission",
"usedScene": {
- "when": "always"
+ "when": "inuse"
}
},
{
"name": "ohos.permission.READ_IMAGEVIDEO",
"reason": "$string:read_image_video_permission",
"usedScene": {
- "when": "always"
+ "when": "inuse"
}
},
{
"name": "ohos.permission.WRITE_IMAGEVIDEO",
"reason": "$string:write_image_video_permission",
"usedScene": {
- "when": "always"
+ "when": "inuse"
}
}
],
diff --git a/code/BasicFeature/Media/QRCodeScan/entry/src/main/resources/base/element/string.json b/code/BasicFeature/Media/QRCodeScan/entry/src/main/resources/base/element/string.json
index fcdbbec8617a10a2276b6bf47f7f405ec960780a..be1c648dc40ff45141ecfce9e2a1eb2520b313dc 100644
--- a/code/BasicFeature/Media/QRCodeScan/entry/src/main/resources/base/element/string.json
+++ b/code/BasicFeature/Media/QRCodeScan/entry/src/main/resources/base/element/string.json
@@ -19,6 +19,14 @@
{
"name": "write_image_video_permission",
"value": "修改用户公共目录的图片或视频文件"
+ },
+ {
+ "name": "use_camera_permission",
+ "value": "允许应用使用相机"
+ },
+ {
+ "name": "media_location_permission",
+ "value": "允许应用访问用户媒体文件中的地理位置信息"
}
]
}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/.gitignore b/code/DocsSample/ConnectivityKit/Wlan/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5 b/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..be106603baf262754eba6588943b83b569dc4fc4
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+* 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.
+*/
+
+{
+ "app": {
+ "bundleName": "com.example.wlanproject",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7de15f9aa578658a2d52fafc669747762c102d88
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "WLANProject"
+ }
+ ]
+}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/media/app_icon.png b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/AppScope/resources/base/media/app_icon.png differ
diff --git a/code/DocsSample/ConnectivityKit/Wlan/README_zh.md b/code/DocsSample/ConnectivityKit/Wlan/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..a8ab992bd7e602e7a86007fb1e1ff8e257684aa0
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/README_zh.md
@@ -0,0 +1,56 @@
+# Connectivity Kit指南文档示例
+
+### 介绍
+
+示例通过将[Connectivity Kit指南文档](https://gitee.com/openharmony/docs/tree/master/zh-cn/application-dev/connectivity)中各场景的开发示例,展示在工程中,帮助开发者更好地理解ArkUI提供的组件及组件属性并合理使用。该工程中展示的代码详细描述可查如下链接:
+
+1. [P2P模式开发](https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.1-Release/zh-cn/application-dev/connectivity/wlan/p2p-development-guide.md)。
+### 效果预览
+
+
+
+### 使用说明
+
+1. 在主界面,可以点击对应按钮,执行相应的操作。
+2. 按钮上方会显示执行信息。
+
+### 工程目录
+```
+entry/src/main/ets/
+├── entryability
+│ ├── EntryAbility.ets
+│ ├── p2pability.ets // 创建或删除群组
+│ └── p2pConnect.ets // p2p连接
+├── entrybackupability
+│ └── EntryBackupAbility.ets
+└── pages
+ └── Index.ets // 应用主界面
+```
+
+### 相关权限
+
+[ohos.permission.GET_WIFI_INFO](https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.1-Release/zh-cn/application-dev/reference/apis-connectivity-kit/js-apis-wifiManager.md#wifimanagercreategroup9)
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1.本示例仅支持标准系统上运行, 支持设备:RK3568。
+
+2.本示例为Stage模型,支持API14版本SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.57。
+
+3.本示例需要使用DevEco Studio NEXT Developer Preview2 (Build Version: 5.0.5.306, built on December 12, 2024)及以上版本才可编译运行。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+````
+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
diff --git a/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5 b/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..877196e790b0b108e05378d8cbe7f7f25992fc22
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/build-profile.json5
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+{
+ "app": {
+ "signingConfigs": [
+ ],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": 14,
+ "compileSdkVersion": 14,
+ "targetSdkVersion": 14,
+ "runtimeOS": "OpenHarmony",
+ "buildOption": {
+ "strictMode": {
+ "caseSensitiveCheck": true,
+ "useNormalizedOHMUrl": true
+ }
+ }
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/code-linter.json5 b/code/DocsSample/ConnectivityKit/Wlan/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4bacc9e298b707e25577dbcef9e1c7c698880ecf
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore b/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/.gitignore
@@ -0,0 +1,6 @@
+/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
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts b/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * 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 { 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. */
+}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/obfuscation-rules.txt b/code/DocsSample/ConnectivityKit/Wlan/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..dbacc308e4f7758a11b72c6a2af812b2471a0e8a
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+{
+ "name": "entry",
+ "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/entryability/EntryAbility.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f2f8b94aa24b0a50e272270e4e18b6df93ac5fd
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', '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) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..2a9a76739d4e5e560e03411517c66fbf30ce5ec4
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pConnect.ets
@@ -0,0 +1,81 @@
+/*
+ * 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 { 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('p2pConnectionChang', 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;
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..01c764fd88c4294b683043da62772251f15a0f05
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entryability/p2pability.ets
@@ -0,0 +1,54 @@
+/*
+ * 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 { wifiManager } from '@kit.ConnectivityKit';
+
+export class P2PManager {
+ private eventListeners = [];
+ public recvP2pPersistentGroupChangeFunc = () => {
+ console.info('p2p persistent group change receive event');
+ // 永久组创建好后需要处理的业务逻辑
+ };
+
+ 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));
+ }
+ }
+
+ public delete() {
+ try {
+ wifiManager.removeGroup();
+ } catch (error) {
+ console.error('failed:' + JSON.stringify(error));
+ }
+ }
+}
+
+// 默认导出let
+let p2pManager = new P2PManager();
+
+export default p2pManager as P2PManager;
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * 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 { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ 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
new file mode 100644
index 0000000000000000000000000000000000000000..6e0601b674e81d58f04f17cd584f935af843beae
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,72 @@
+/*
+ * 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 P2PManager from '../entryability/p2pability';
+import P2PConnectManager from '../entryability/p2pConnect'
+import { wifiManager } from '@kit.ConnectivityKit';
+
+@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')
+
+ 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')
+
+ 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%')
+ }
+}
\ 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
new file mode 100644
index 0000000000000000000000000000000000000000..97451e7eda0ea81494504dc9c5e5b5871738bec7
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/module.json5
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "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
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ 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
new file mode 100644
index 0000000000000000000000000000000000000000..624c4b0902dd329d848a329ae66186575b912ed2
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "P2P"
+ }
+ ]
+}
\ No newline at end of file
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
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/background.png 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
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/foreground.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
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "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/startIcon.png b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/media/startIcon.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
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "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
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
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
new file mode 100644
index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/resources/dark/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#000000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/mock/mock-config.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..fec94bcaee89632a26be6c4862a88acf88d0daad
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+
+ {
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/Ability.test.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f8ce9a2c012f8fe36114cef65216ef0b6254f41
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,50 @@
+/*
+ * 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 { hilog } from '@kit.PerformanceAnalysisKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ })
+ })
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/List.test.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1eac52fcebe8958e19a7b8fed2e8f39c520a3e42
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * 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 abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/module.json5 b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/List.test.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f1186b1f53c3a70930921c5dbd1417332bec56c9
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * 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 localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/LocalUnit.test.ets b/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7fc57c77dbf76d8df08a2b802a55b948e3fcf968
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ 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
new file mode 100644
index 0000000000000000000000000000000000000000..1e473e424320d4e68b16737b289f5c851bb19d36
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/hvigor/hvigor-config.json5
@@ -0,0 +1,22 @@
+{
+ "modelVersion": "5.0.1",
+ "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
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * 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 { 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
new file mode 100644
index 0000000000000000000000000000000000000000..14655ea1c07e1b7b8b8eb3d9f6813577b90f6a0f
--- /dev/null
+++ b/code/DocsSample/ConnectivityKit/Wlan/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+{
+ "modelVersion": "5.0.1",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.19",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg b/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..886050dfd8918801b618617a92106f68457cf064
Binary files /dev/null and b/code/DocsSample/ConnectivityKit/Wlan/screenshots/sample.jpeg differ
diff --git a/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerCtrlComp.ets b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerCtrlComp.ets
index b7ab3470a98cc881e6e515d305d0a69456c76166..4a82350771735c9ad6473fd21987f37f26429a89 100644
--- a/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerCtrlComp.ets
+++ b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerCtrlComp.ets
@@ -94,6 +94,17 @@ export struct MusicPlayerCtrlComp {
// 当前进度到达最大进度时,不响应onChange事件
if (this.viewModel.curProgress >= CommonConstants.MUSIC_SLIDER_MAX) {
+ if (this.viewModel.curPlayerState === CommonConstants.AVPLAYER_STATE_IDLE ||
+ this.viewModel.curPlayerState === CommonConstants.AVPLAYER_STATE_PREPARED) {
+ this.viewModel.progressLock = false;
+ this.viewModel.playNext();
+ } else if (this.viewModel.curPlayerState === CommonConstants.AVPLAYER_STATE_PLAYING) {
+ this.viewModel.progressLock = false;
+ this.viewModel.playNext();
+ } else if (this.viewModel.curPlayerState === CommonConstants.AVPLAYER_STATE_PAUSED) {
+ this.viewModel.updateCurTime(this.viewModel.curMusicModel.totalTime);
+ this.viewModel.seek(this.viewModel.curMusicModel.totalTime);
+ }
return;
}