From 19e7ced8af6506aaeeb0f364cf2894939b40a8f0 Mon Sep 17 00:00:00 2001 From: "@shi-xiaoxiao-iris" Date: Mon, 18 Jul 2022 17:41:32 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=A1=AC=E4=BB=B6API=20MOCK=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @shi-xiaoxiao-iris --- .../ohos_distributedHardware_deviceManager.js | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index 5b2df6cb..9947c73e 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -16,6 +16,43 @@ import { paramMock } from "../utils" export function mockDeviceManager() { + const wantAgent = { + DeviceType: { + UNKNOWN_TYPE: 0, + SPEAKER: 0x0A, + PHONE: 0x0E, + TABLET: 0x11, + WEARABLE: 0x6D, + CAR: 0x83, + TV: 0x9C + }, + DeviceStateChangeAction: { + ONLINE: 0, + READY: 1, + OFFLINE: 2, + CHANGE: 3 + }, + DiscoverMode: { + DISCOVER_MODE_PASSIVE: 0x55, + DISCOVER_MODE_ACTIVE: 0xAA + }, + ExchangeMedium: { + AUTO: 0, + BLE: 1, + COAP: 2, + USB: 3 + }, + ExchangeFreq: { + LOW: 0, + MID: 1, + HIGH: 2, + SUPER_HIGH: 3 + }, + SubscribeCap: { + SUBSCRIBE_CAPABILITY_DDMP: 0, + SUBSCRIBE_CAPABILITY_OSD: 1 + }, + } const deviceInfoMock = { deviceId: "[PC Preview] unknow mDeviceId", deviceName: "[PC Preview] unknow mDeviceName", @@ -26,6 +63,24 @@ export function mockDeviceManager() { action: 0, device: deviceInfoMock } + const subscribeInfoMock = { + subscribeId: "[PC Preview] unknow mSubscribeId", + mode: "[PC Preview] unknow mMode", + medium: "[PC Preview] unknow mMedium", + freq: "[PC Preview] unknow mFreq", + isSameAccount: "[PC Preview] unknow mIsSameAccount", + isWakeRemote: "[PC Preview] unknow mIsWakeRemote", + capability: "[PC Preview] unknow mCapability" + } + const authParamMock = { + authType: "[PC Preview] unknow mAuthType", + extraInfo: "[PC Preview] unknow mExtraInfo" + } + const authInfoMock = { + authType: "[PC Preview] unknow mAuthType", + token: "[PC Preview] unknow mToken", + extraInfo: "[PC Preview] unknow mExtraInfo" + } const deviceManagerMock = { release: function () { console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + From 4a69e46587c86cbf87c9ce142d7380d53a43c54a Mon Sep 17 00:00:00 2001 From: "@shi-xiaoxiao-iris" Date: Tue, 19 Jul 2022 15:44:55 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=A1=AC=E4=BB=B6API=20MOCK=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @shi-xiaoxiao-iris --- .../ohos_distributedHardware_deviceManager.js | 72 +++++++++---------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index 9947c73e..ce0a5933 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -16,43 +16,6 @@ import { paramMock } from "../utils" export function mockDeviceManager() { - const wantAgent = { - DeviceType: { - UNKNOWN_TYPE: 0, - SPEAKER: 0x0A, - PHONE: 0x0E, - TABLET: 0x11, - WEARABLE: 0x6D, - CAR: 0x83, - TV: 0x9C - }, - DeviceStateChangeAction: { - ONLINE: 0, - READY: 1, - OFFLINE: 2, - CHANGE: 3 - }, - DiscoverMode: { - DISCOVER_MODE_PASSIVE: 0x55, - DISCOVER_MODE_ACTIVE: 0xAA - }, - ExchangeMedium: { - AUTO: 0, - BLE: 1, - COAP: 2, - USB: 3 - }, - ExchangeFreq: { - LOW: 0, - MID: 1, - HIGH: 2, - SUPER_HIGH: 3 - }, - SubscribeCap: { - SUBSCRIBE_CAPABILITY_DDMP: 0, - SUBSCRIBE_CAPABILITY_OSD: 1 - }, - } const deviceInfoMock = { deviceId: "[PC Preview] unknow mDeviceId", deviceName: "[PC Preview] unknow mDeviceName", @@ -82,6 +45,41 @@ export function mockDeviceManager() { extraInfo: "[PC Preview] unknow mExtraInfo" } const deviceManagerMock = { + DeviceType: { + UNKNOWN_TYPE: 0, + SPEAKER: 0x0A, + PHONE: 0x0E, + TABLET: 0x11, + WEARABLE: 0x6D, + CAR: 0x83, + TV: 0x9C, + }, + DeviceStateChangeAction: { + ONLINE: 0, + READY: 1, + OFFLINE: 2, + CHANGE: 3, + }, + DiscoverMode: { + DISCOVER_MODE_PASSIVE: 0x55, + DISCOVER_MODE_ACTIVE: 0xAA, + }, + ExchangeMedium: { + AUTO: 0, + BLE: 1, + COAP: 2, + USB: 3, + }, + ExchangeFreq: { + LOW: 0, + MID: 1, + HIGH: 2, + SUPER_HIGH: 3, + }, + SubscribeCap: { + SUBSCRIBE_CAPABILITY_DDMP: 0, + SUBSCRIBE_CAPABILITY_OSD: 1, + }, release: function () { console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") From faba632a49687d422949e8f8940eb4b7d68788db Mon Sep 17 00:00:00 2001 From: "@shi-xiaoxiao-iris" Date: Tue, 19 Jul 2022 17:22:11 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=A1=AC=E4=BB=B6API=20MOCK=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @shi-xiaoxiao-iris --- .../ohos_distributedHardware_deviceManager.js | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index ce0a5933..8d678e05 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -44,42 +44,42 @@ export function mockDeviceManager() { token: "[PC Preview] unknow mToken", extraInfo: "[PC Preview] unknow mExtraInfo" } + const DeviceType = { + UNKNOWN_TYPE: 0, + SPEAKER: 0x0A, + PHONE: 0x0E, + TABLET: 0x11, + WEARABLE: 0x6D, + CAR: 0x83, + TV: 0x9C + } + const DeviceStateChangeAction = { + ONLINE: 0, + READY: 1, + OFFLINE: 2, + CHANGE: 3 + } + const DiscoverMode = { + DISCOVER_MODE_PASSIVE: 0x55, + DISCOVER_MODE_ACTIVE: 0xAA + } + const ExchangeMedium = { + AUTO: 0, + BLE: 1, + COAP: 2, + USB: 3 + } + const ExchangeFreq = { + LOW: 0, + MID: 1, + HIGH: 2, + SUPER_HIGH: 3 + } + const SubscribeCap = { + SUBSCRIBE_CAPABILITY_DDMP: 0, + SUBSCRIBE_CAPABILITY_OSD: 1 + } const deviceManagerMock = { - DeviceType: { - UNKNOWN_TYPE: 0, - SPEAKER: 0x0A, - PHONE: 0x0E, - TABLET: 0x11, - WEARABLE: 0x6D, - CAR: 0x83, - TV: 0x9C, - }, - DeviceStateChangeAction: { - ONLINE: 0, - READY: 1, - OFFLINE: 2, - CHANGE: 3, - }, - DiscoverMode: { - DISCOVER_MODE_PASSIVE: 0x55, - DISCOVER_MODE_ACTIVE: 0xAA, - }, - ExchangeMedium: { - AUTO: 0, - BLE: 1, - COAP: 2, - USB: 3, - }, - ExchangeFreq: { - LOW: 0, - MID: 1, - HIGH: 2, - SUPER_HIGH: 3, - }, - SubscribeCap: { - SUBSCRIBE_CAPABILITY_DDMP: 0, - SUBSCRIBE_CAPABILITY_OSD: 1, - }, release: function () { console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") From ed356d5311a94e153c96ad575777b93a3ff1824a Mon Sep 17 00:00:00 2001 From: "@shi-xiaoxiao-iris" Date: Tue, 19 Jul 2022 20:59:34 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=A1=AC=E4=BB=B6API=20MOCK=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @shi-xiaoxiao-iris --- .../ohos_distributedHardware_deviceManager.js | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index 8d678e05..df191752 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -16,34 +16,6 @@ import { paramMock } from "../utils" export function mockDeviceManager() { - const deviceInfoMock = { - deviceId: "[PC Preview] unknow mDeviceId", - deviceName: "[PC Preview] unknow mDeviceName", - deviceType: 0x0E, - networkId: "[PC Preview] unknow mNetworkId" - } - const deviceStateChangeMock = { - action: 0, - device: deviceInfoMock - } - const subscribeInfoMock = { - subscribeId: "[PC Preview] unknow mSubscribeId", - mode: "[PC Preview] unknow mMode", - medium: "[PC Preview] unknow mMedium", - freq: "[PC Preview] unknow mFreq", - isSameAccount: "[PC Preview] unknow mIsSameAccount", - isWakeRemote: "[PC Preview] unknow mIsWakeRemote", - capability: "[PC Preview] unknow mCapability" - } - const authParamMock = { - authType: "[PC Preview] unknow mAuthType", - extraInfo: "[PC Preview] unknow mExtraInfo" - } - const authInfoMock = { - authType: "[PC Preview] unknow mAuthType", - token: "[PC Preview] unknow mToken", - extraInfo: "[PC Preview] unknow mExtraInfo" - } const DeviceType = { UNKNOWN_TYPE: 0, SPEAKER: 0x0A, @@ -79,6 +51,34 @@ export function mockDeviceManager() { SUBSCRIBE_CAPABILITY_DDMP: 0, SUBSCRIBE_CAPABILITY_OSD: 1 } + const deviceInfoMock = { + deviceId: "[PC Preview] unknow mDeviceId", + deviceName: "[PC Preview] unknow mDeviceName", + deviceType: DeviceType, + networkId: "[PC Preview] unknow mNetworkId" + } + const deviceStateChangeMock = { + action: 0, + device: deviceInfoMock + } + const subscribeInfo = { + subscribeId: "[PC Preview] unknow mSubscribeId", + mode: DiscoverMode, + medium: ExchangeMedium, + freq: ExchangeFreq, + isSameAccount: "[PC Preview] unknow mIsSameAccount", + isWakeRemote: "[PC Preview] unknow mIsWakeRemote", + capability: SubscribeCap + } + const authParam = { + authType: "[PC Preview] unknow mAuthType", + extraInfo: "[PC Preview] unknow mExtraInfo" + } + const authInfo = { + authType: "[PC Preview] unknow mAuthType", + token: "[PC Preview] unknow mToken", + extraInfo: "[PC Preview] unknow mExtraInfo" + } const deviceManagerMock = { release: function () { console.warn("DeviceManager.release interface mocked in the Previewer. How this interface works on the Previewer" + From 8938be87c38a546478972356ef07042dbb786093 Mon Sep 17 00:00:00 2001 From: "@shi-xiaoxiao-iris" Date: Fri, 22 Jul 2022 09:43:35 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E3=80=90=E4=BB=BB=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=A1=AC=E4=BB=B6API=20MOCK=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @shi-xiaoxiao-iris --- .../napi/ohos_distributedHardware_deviceManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index df191752..2a3dba73 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -72,12 +72,12 @@ export function mockDeviceManager() { } const authParam = { authType: "[PC Preview] unknow mAuthType", - extraInfo: "[PC Preview] unknow mExtraInfo" + extraInfo: {"key":"unknow any"} } const authInfo = { authType: "[PC Preview] unknow mAuthType", token: "[PC Preview] unknow mToken", - extraInfo: "[PC Preview] unknow mExtraInfo" + extraInfo: {"key":"unknow any"} } const deviceManagerMock = { release: function () { From 3f87454d964438967cc5055cd5eb0255a6de517b Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 22 Jul 2022 15:12:12 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- .../napi/ohos_distributedHardware_deviceManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index 2a3dba73..3547881e 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -61,7 +61,7 @@ export function mockDeviceManager() { action: 0, device: deviceInfoMock } - const subscribeInfo = { + const SubscribeInfo = { subscribeId: "[PC Preview] unknow mSubscribeId", mode: DiscoverMode, medium: ExchangeMedium, @@ -70,11 +70,11 @@ export function mockDeviceManager() { isWakeRemote: "[PC Preview] unknow mIsWakeRemote", capability: SubscribeCap } - const authParam = { + const AuthParam = { authType: "[PC Preview] unknow mAuthType", extraInfo: {"key":"unknow any"} } - const authInfo = { + const AuthInfo = { authType: "[PC Preview] unknow mAuthType", token: "[PC Preview] unknow mToken", extraInfo: {"key":"unknow any"} From 62e4645649c87151cf1778962f634115c9911c87 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 29 Jul 2022 17:29:10 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Signed-off-by:=20wangy?= =?UTF-8?q?b0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../napi/ohos_distributedHardware_deviceManager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js index 3547881e..03c9826b 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js +++ b/runtime/main/extend/systemplugin/napi/ohos_distributedHardware_deviceManager.js @@ -184,7 +184,15 @@ export function mockDeviceManager() { } } const deviceManager = { - deviceManagerMock, + DeviceType, + DeviceStateChangeAction, + DiscoverMode, + ExchangeMedium, + ExchangeFreq, + SubscribeCap, + SubscribeInfo, + AuthParam, + AuthInfo, createDeviceManager: function (...args) { console.warn("distributedHardware.deviceManager.createDeviceManager interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.")