diff --git a/DistributedAppDev/DistributedCollab/.gitignore b/DistributedAppDev/DistributedCollab/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b --- /dev/null +++ b/DistributedAppDev/DistributedCollab/.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/DistributedAppDev/DistributedCollab/AppScope/app.json5 b/DistributedAppDev/DistributedCollab/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..742a670795ed8c4a5e187aea7e452bddc5939e94 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/AppScope/app.json5 @@ -0,0 +1,24 @@ +/* + * 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.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:layered_image", + "label": "$string:app_name" + } +} diff --git a/DistributedAppDev/DistributedCollab/AppScope/resources/base/element/string.json b/DistributedAppDev/DistributedCollab/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1080233f01384411ec684b58955cb8808746fdd3 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/background.png b/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/background.png differ diff --git a/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/foreground.png b/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9427585b36d14b12477435b6419d1f07b3e0bb Binary files /dev/null and b/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/foreground.png differ diff --git a/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/layered_image.json b/DistributedAppDev/DistributedCollab/AppScope/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/DistributedAppDev/DistributedCollab/AppScope/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/DistributedAppDev/DistributedCollab/build-profile.json5 b/DistributedAppDev/DistributedCollab/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..49291ea87bc9a94bb57858f8a317b498e960cba0 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/build-profile.json5 @@ -0,0 +1,55 @@ +/* + * 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": { + "products": [ + { + "name": "default", + "signingConfig": "default", + "targetSdkVersion": "6.0.0(20)", + "compatibleSdkVersion": "6.0.0(20)", + "runtimeOS": "HarmonyOS", + "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/DistributedAppDev/DistributedCollab/code-linter.json5 b/DistributedAppDev/DistributedCollab/code-linter.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/code-linter.json5 @@ -0,0 +1,46 @@ +/* + * 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": { + "@security/no-unsafe-aes": "error", + "@security/no-unsafe-hash": "error", + "@security/no-unsafe-mac": "warn", + "@security/no-unsafe-dh": "error", + "@security/no-unsafe-dsa": "error", + "@security/no-unsafe-ecdsa": "error", + "@security/no-unsafe-rsa-encrypt": "error", + "@security/no-unsafe-rsa-sign": "error", + "@security/no-unsafe-rsa-key": "error", + "@security/no-unsafe-dsa-key": "error", + "@security/no-unsafe-dh-key": "error", + "@security/no-unsafe-3des": "error" + } +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/.gitignore b/DistributedAppDev/DistributedCollab/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/build-profile.json5 b/DistributedAppDev/DistributedCollab/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9016faf39f8a65cf648bae246a53575510fe8b9f --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/build-profile.json5 @@ -0,0 +1,47 @@ +/* + * 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": { + "resOptions": { + "copyCodeResource": { + "enable": false + } + } + }, + "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/DistributedAppDev/DistributedCollab/entry/hvigorfile.ts b/DistributedAppDev/DistributedCollab/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f8b117a17af3b2d7cb87a7680e29e2bb8ccd5b46 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/hvigorfile.ts @@ -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 { 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. */ +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/obfuscation-rules.txt b/DistributedAppDev/DistributedCollab/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b --- /dev/null +++ b/DistributedAppDev/DistributedCollab/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/DistributedAppDev/DistributedCollab/entry/oh-package.json5 b/DistributedAppDev/DistributedCollab/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..10cda399b0aec3099b257299a57d284393e4e55a --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * 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/DistributedAppDev/DistributedCollab/entry/src/main/ets/entryability/EntryAbility.ets b/DistributedAppDev/DistributedCollab/entry/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e14b25e459848b665aa279e122d7bdba726665d --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,106 @@ +/* + * 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'; +import abilityConnectionManager from '@ohos.distributedsched.abilityConnectionManager'; +import { util } from '@kit.ArkTS'; + +const TAG:string = "WatchAbility_DemoTest"; + +export default class EntryAbility extends UIAbility { +// [Start collab] + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onContinue(wantParam: Record): AbilityConstant.OnContinueResult { + return 1; + } + onCollaborate(wantParam: Record): AbilityConstant.CollaborateResult { + hilog.info(0x0000, 'testTag', '%{public}s', 'on collaborate'); + let param = wantParam['ohos.extra.param.key.supportCollaborateIndex'] as Record + this.onCollab(param); + return 0; + } + + onCollab(collabParam: Record) { + const sessionId = this.createSessionFromWant(collabParam); + if (sessionId == -1) { + return; + } + this.registerSessionEvent(sessionId); + const collabToken = collabParam['ohos.dms.collabToken'] as string; + abilityConnectionManager.acceptConnect(sessionId, collabToken).then(() => { + AppStorage.setOrCreate('sessionId', sessionId); + }).catch(() => { + console.log(TAG + `acceptConnect failed` ); + }) + } + + createSessionFromWant(collabParam: Record): number { + let sessionId = -1; + const peerInfo = collabParam['PeerInfo'] as abilityConnectionManager.PeerInfo; + if (peerInfo == undefined) { + return sessionId; + } + // 定义连接选项 + const options = collabParam['ConnectOption'] as abilityConnectionManager.ConnectOptions; + try { + sessionId = abilityConnectionManager.createAbilityConnectionSession('collabTest', this.context, peerInfo, options); + } catch (error) { + console.error(error); + } + return sessionId; + } + // [End collab] + // [Start abilityconnectionmanager_on] + registerSessionEvent(sessionId: number) { + abilityConnectionManager.on('connect',sessionId,(callbackInfo) => { + AppStorage.setOrCreate('isConnected', true); + AppStorage.setOrCreate('receiveMessage', 'connect success'); + }); + abilityConnectionManager.on('disconnect',sessionId,(callbackInfo) => { + abilityConnectionManager.destroyAbilityConnectionSession(sessionId) + AppStorage.setOrCreate('isConnected', false); + AppStorage.setOrCreate('receiveMessage', 'session disconnect'); + }) + abilityConnectionManager.on('receiveMessage',sessionId,(callbackInfo) => { + AppStorage.setOrCreate('receiveMessage', callbackInfo.msg); + if (callbackInfo.msg == 'startStream') { + hilog.info(0x0000, 'testTag', 'startStream'); + } + }) + abilityConnectionManager.on('receiveData',sessionId,(callbackInfo) => { + let decoder = util.TextDecoder.create('utf-8'); + let str = decoder.decodeWithStream(new Uint8Array(callbackInfo.data)); + AppStorage.setOrCreate('receiveMessage', str); + }) + } + // [End abilityconnectionmanager_on] + 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.'); + }); + } +} + diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/DistributedAppDev/DistributedCollab/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a97e21bd7a15599af76a806695860ff1eb0ebfe --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,31 @@ +/* + * 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'; + +const DOMAIN = 0x0000; + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + hilog.info(DOMAIN, 'testTag', 'onBackup ok'); + await Promise.resolve(); + } + + async onRestore(bundleVersion: BundleVersion) { + hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + await Promise.resolve(); + } +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/ets/pages/Index.ets b/DistributedAppDev/DistributedCollab/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bb13d6b9411a3fe80938fae75db9d7906256383 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,325 @@ +/* + * 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 abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; +// [Start import_abilityConnectionManager] +import {abilityConnectionManager, distributedDeviceManager } from '@kit.DistributedServiceKit'; +// [End import_abilityConnectionManager] +import { util } from '@kit.ArkTS'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; + +export default interface XComponentContext { + drawPattern(): void; + getStatus(): XComponentContextStatus; +}; + +interface XComponentContextStatus { + hasDraw: boolean; + hasChangeColor: boolean; +} + +const TAG: string = "IndexPage_DemoTest"; + +// [Start source_1] +let dmClass: distributedDeviceManager.DeviceManager; + +function initDmClass(): void { + // 其中createDeviceManager接口为系统API + try { + dmClass = distributedDeviceManager.createDeviceManager('com.example.remotephotodemo'); + } catch (err) { + hilog.info(0x0000, 'testTag', 'createDeviceManager err'); + } +} + +// 获取设备B的设备ID +function getRemoteDeviceId(): string | undefined { + initDmClass(); + if (typeof dmClass === 'object' && dmClass !== null) { + hilog.info(0x0000, 'testTag', 'getRemoteDeviceId begin'); + let list = dmClass.getAvailableDeviceListSync(); + if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') { + hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: list is null'); + return; + } + if (list.length === 0) { + hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: list is empty'); + return; + } + // 弹框选择设备 + return list[0].networkId; + } else { + hilog.info(0x0000, 'testTag', 'getRemoteDeviceId err: dmClass is null'); + return; + } +} +// [End source_1] + +@Entry +@Component +struct Index { + @State currentStatus: string = "init"; + @StorageLink('isConnected') isConnected: boolean = false; + @StorageLink('receiveMessage') receiveMessage: string = ""; + @StorageLink('sessionId') sessionId: number = -1; + private xComponentContext: XComponentContext | undefined = undefined; + @StorageLink('pixelMap') currentPixelMap: PixelMap |null= null; + // XComponentController控制器 + private mComponentController: XComponentController = new XComponentController(); + private scroller: Scroller = new Scroller(); + + async requestPermission() { + // 申请权限 + let permissionNames: Permissions[] = [ + 'ohos.permission.CAMERA', + 'ohos.permission.MICROPHONE', + 'ohos.permission.READ_MEDIA', + 'ohos.permission.WRITE_MEDIA', + 'ohos.permission.DISTRIBUTED_DATASYNC' + ]; + let atManager = abilityAccessCtrl.createAtManager(); + await atManager.requestPermissionsFromUser(this.getUIContext().getHostContext(), permissionNames).then((data) => { + console.info(TAG + 'getPermission success'); + }); + } + + onPageShow() { + this.requestPermission(); + } + + // [Start source_2] + createSession(): void { + // 定义peer信息 + const peerInfo: abilityConnectionManager.PeerInfo = { + deviceId: getRemoteDeviceId()!, + bundleName: 'com.example.myapplication', + moduleName: 'entry', + abilityName: 'EntryAbility', + }; + const myRecord: Record = { + 'newKey1': 'value1', + }; + + // 定义连接选项 + const connectOption: abilityConnectionManager.ConnectOptions = { + needSendData: true, + startOptions: abilityConnectionManager.StartOptionParams.START_IN_FOREGROUND, + parameters: myRecord + }; + console.info(TAG + JSON.stringify(peerInfo)) + console.info(TAG + JSON.stringify(connectOption)) + let context = this.getUIContext().getHostContext(); + try { + this.sessionId = abilityConnectionManager.createAbilityConnectionSession('collabTest', context, peerInfo, connectOption); + hilog.info(0x0000, 'testTag', 'createSession sessionId is', this.sessionId); + abilityConnectionManager.connect(this.sessionId).then((connectResult) => { + if (!connectResult.isConnected) { + hilog.info(0x0000, 'testTag', 'connect failed'); + return; + } + }).catch(() => { + hilog.error(0x0000, 'testTag', 'connect failed'); + }) + } catch (error) { + hilog.error(0x0000, 'testTag', error); + } + } + // [End source_2] + + registerSessionEvent() { + if (this.sessionId == -1) { + return; + } + + abilityConnectionManager.on('connect', this.sessionId,(callbackInfo) => { + this.receiveMessage = 'connect'; + }); + + abilityConnectionManager.on('disconnect', this.sessionId,(callbackInfo) => { + this.receiveMessage = 'disconnect'; + abilityConnectionManager.destroyAbilityConnectionSession(this.sessionId); + }) + + abilityConnectionManager.on('receiveMessage', this.sessionId,(callbackInfo) => { + this.receiveMessage = callbackInfo.msg!; + }) + + abilityConnectionManager.on('receiveData',this.sessionId,(callbackInfo) => { + let decoder = util.TextDecoder.create('utf-8'); + let str = decoder.decodeWithStream(new Uint8Array(callbackInfo.data)); + this.receiveMessage = str; + }) + } + + connectRemoteAbility(): void { + this.createSession(); + if (this.sessionId == -1) { + return; + } + this.receiveMessage = 'start connect'; + this.registerSessionEvent(); + abilityConnectionManager.connect(this.sessionId).then((connectResult:abilityConnectionManager.ConnectResult) => { + if (!connectResult.isConnected) { + return; + } + this.receiveMessage = 'connect success'; + this.isConnected = true; + }).catch((error: BusinessError) => { + // 处理异常情况 + hilog.error(0x0000, 'testTag', `sendMsg failed with ${error}`); + console.log(`error: ${error}`); + }); + } + + sendMessage(): void { + if (!this.isConnected) { + hilog.error(0x0000, 'testTag', 'session disconnect'); + } + console.log(TAG + `sendMessage, sessionId is ` + this.sessionId ); + this.receiveMessage = 'send message'; + // [start sendMessage] + abilityConnectionManager.sendMessage(this.sessionId, 'message send success').then(() => { + hilog.info(0x0000, 'testTag', 'sendMessage success'); + console.log(TAG + `sendMessage success, sessionId is ` + this.sessionId ); + }).catch((error: BusinessError) => { + hilog.error(0x0000, 'testTag', 'connect failed'); + }); + // [end sendMessage] + } + + sendData(): void { + if (!this.isConnected) { + hilog.error(0x0000, 'testTag', 'session disconnect'); + } + this.receiveMessage = 'send data'; + let textEncoder = util.TextEncoder.create('utf-8'); + const arrayBuffer = textEncoder.encodeInto('data send success'); + console.log(TAG + `sendData, sessionId is ` + this.sessionId ); + abilityConnectionManager.sendData(this.sessionId, arrayBuffer.buffer).then(() => { + console.log(`sendData success, sessionId is ` + this.sessionId ); + }).catch((error: BusinessError) => { + hilog.error(0x0000, 'testTag', 'send data failed'); + }); + } +// [Start disconnect] + disconnectRemoteAbility(): void { + if (this.sessionId == -1) { + hilog.info(0x0000, 'testTag', 'Invalid session ID.'); + return; + } + abilityConnectionManager.disconnect(this.sessionId); + this.receiveMessage = 'disConnect'; + } + + destroySession(): void { + try { + abilityConnectionManager.destroyAbilityConnectionSession(this.sessionId); + this.receiveMessage = 'destroy'; + } catch (err) { + console.log(TAG, 'createDeviceManager err: ' + JSON.stringify(err)); + hilog.error(0x0000, 'testTag', 'connect failed'); + } +// [End disconnect] + } + + build() { + + Scroll(this.scroller) { + Column() { + TextInput({ + text: this.receiveMessage, + }) + .fontWeight(400) + .fontSize(20) + .borderWidth(2) + .borderColor(Color.Black) + .textAlign(TextAlign.Center) + .align(Alignment.Center) + .height(40) + .width('65%') + .onChange((value: string) => { + this.receiveMessage = value; + }) + .type(InputType.Normal) + .backgroundColor(Color.Transparent) + .margin({ top: 5 }) + .restoreId(2) + .id('textInput') + + Column() { + Button('start connect') + .fontSize('16fp') + .fontWeight(500) + .margin({ top: 8 }) + .onClick(() => this.connectRemoteAbility()) + .width('50%') + .height(40) + + Button('send message') + .fontSize('16fp') + .fontWeight(500) + .margin({ top: 8 }) + .onClick(() => this.sendMessage()) + .width('50%') + .height(40) + + Button('send data') + .fontSize('16fp') + .fontWeight(500) + .margin({ top: 8 }) + .onClick(() => this.sendData()) + .width('50%') + .height(40) + + Button('disconnect') + .fontSize('16fp') + .fontWeight(500) + .margin({ top: 8 }) + .onClick(() => this.disconnectRemoteAbility()) + .width('50%') + .height(40) + + Button('destroy connection') + .fontSize('16fp') + .fontWeight(500) + .margin({ top: 8 }) + .onClick(() => this.destroySession()) + .width('50%') + .height(40) + } + .width('100%') + .height('auto') + .justifyContent(FlexAlign.Start) + } + } + .width('100%') + .height(800) + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.Off) + .align(Alignment.Center) + .friction(0.6) + .edgeEffect(EdgeEffect.Spring) + .onScrollEdge(() => { + // To the edge + }) + .onScrollStop(() => { + // Scroll Stop + }) + .onAreaChange((oldArea: Area, newArea: Area) => { + // Scroll + }) + } +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/module.json5 b/DistributedAppDev/DistributedCollab/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..67273aa6e30514237ea5f8e720023057d0af3de6 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/module.json5 @@ -0,0 +1,86 @@ +/* + * 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": [ + "phone" + ], + "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": [ + "ohos.want.action.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "EntryBackupAbility", + "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", + "type": "backup", + "exported": false, + "metadata": [ + { + "name": "ohos.extension.backup", + "resource": "$profile:backup_config" + } + ], + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC", + "reason": "$string:module_desc", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } + }, + // 创建网络Scoket HAP + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.GET_NETWORK_INFO" + }, + { + "name": "ohos.permission.SET_NETWORK_INFO" + } + ] + } +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/color.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/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/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/float.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..33ea22304f9b1485b5f22d811023701b5d4e35b6 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "page_text_font_size", + "value": "50fp" + } + ] +} diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/string.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/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": "label" + } + ] +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/background.png b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..923f2b3f27e915d6871871deea0420eb45ce102f Binary files /dev/null and b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/background.png differ diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/foreground.png b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..97014d3e10e5ff511409c378cd4255713aecd85f Binary files /dev/null and b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/foreground.png differ diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/layered_image.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/DistributedAppDev/DistributedCollab/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/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/startIcon.png b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b Binary files /dev/null and b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/media/startIcon.png differ diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/backup_config.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/main_pages.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/DistributedAppDev/DistributedCollab/entry/src/main/resources/dark/element/color.json b/DistributedAppDev/DistributedCollab/entry/src/main/resources/dark/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/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/DistributedAppDev/DistributedCollab/entry/src/mock/mock-config.json5 b/DistributedAppDev/DistributedCollab/entry/src/mock/mock-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7a73a41bfdf76d6f793007240d80983a52f15f97 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/mock/mock-config.json5 @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/Ability.test.ets b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f30942b81554a399e89aa253c7089eca4f8d8d1 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,49 @@ +/* + * 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/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/List.test.ets b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c64e0b06938d246ce044186d4b2d02b500a89e14 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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/DistributedAppDev/DistributedCollab/entry/src/ohosTest/module.json5 b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1cafc28b86d7d9f2b34f24d26a75c0dbd7299715 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/ohosTest/module.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. + */ +{ + "module": { + "name": "entry_test", + "type": "feature", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false + } +} diff --git a/DistributedAppDev/DistributedCollab/entry/src/test/List.test.ets b/DistributedAppDev/DistributedCollab/entry/src/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a60c87c5cbb0badf7c3fd8975034590e6fafa992 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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/DistributedAppDev/DistributedCollab/entry/src/test/LocalUnit.test.ets b/DistributedAppDev/DistributedCollab/entry/src/test/LocalUnit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..841bfd77e56060e50ec0924302a5ae624e76e3aa --- /dev/null +++ b/DistributedAppDev/DistributedCollab/entry/src/test/LocalUnit.test.ets @@ -0,0 +1,47 @@ +/* + * 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/DistributedAppDev/DistributedCollab/hvigor/hvigor-config.json5 b/DistributedAppDev/DistributedCollab/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..3b057578a1bb4d591ee53054e39ab0154fc2e43a --- /dev/null +++ b/DistributedAppDev/DistributedCollab/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * 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": "6.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | 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 */ + // "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */ + }, + "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/DistributedAppDev/DistributedCollab/hvigorfile.ts b/DistributedAppDev/DistributedCollab/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae9086af35844176c08f1be3772d081d95d267c6 --- /dev/null +++ b/DistributedAppDev/DistributedCollab/hvigorfile.ts @@ -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 { 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. */ +} \ No newline at end of file diff --git a/DistributedAppDev/DistributedCollab/oh-package.json5 b/DistributedAppDev/DistributedCollab/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..837c0ff9f35a6bb9eea849fead7955c19bcdec8d --- /dev/null +++ b/DistributedAppDev/DistributedCollab/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * 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": "6.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.24", + "@ohos/hamock": "1.0.0" + } +} diff --git "a/DistributedAppDev/DistributedCollab/\346\265\213\350\257\225\347\224\250\344\276\213\345\275\222\346\241\243.md" "b/DistributedAppDev/DistributedCollab/\346\265\213\350\257\225\347\224\250\344\276\213\345\275\222\346\241\243.md" new file mode 100644 index 0000000000000000000000000000000000000000..a49dd96faa8e0b4281be2b36526ab8a092f3bd97 --- /dev/null +++ "b/DistributedAppDev/DistributedCollab/\346\265\213\350\257\225\347\224\250\344\276\213\345\275\222\346\241\243.md" @@ -0,0 +1,11 @@ +# 测试用例归档 + +## 用例表 + +| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 | +|-----------|---------|-------------------------|--------------------|------|------| +| 发起连接 | 设备正常运行 | 拉起端点击start connect | 成功拉起应用 | 否 | Pass | +| 发送Message | 成功拉起应用 | 拉起端点击start send message | 对端显示send message成功 | 否 | Pass | +| 发送data | 成功拉起应用 | 本端点击send data | 对端显示send data成功 | 否 | Pass | +| 断开连接 | 成功拉起应用 | 本端点击disconnect | 对端显示断连成功 | 否 | Pass | +| 销毁会话 | 成功拉起应用 | 本端点击destroy | 对端显示断连成功 | 否 | Pass |