From 61ee7a9ae65e6979f3a41119e36d915800ffbc15 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Wed, 27 Apr 2022 16:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=AD=E6=8E=A7=E3=80=81=E8=BE=93=E5=87=BA=E6=9D=BF?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 16 +++++ src/common/Initializer.ts | 16 ++++- src/common/RemoteDataExangeProcesser.ts | 10 +++ src/components/AdvancedDebugDialog.vue | 83 ++++++++++++++++++++++++- src/components/RegisterDialog.vue | 52 +++++++++++++++- src/entities/WSProtocol.ts | 70 +++++++++++++++++++++ src/i18n/zh-CN/index.ts | 4 ++ src/pad/TopToolbar.vue | 2 +- src/pages/TopToolBar.vue | 19 +++++- src/store/index.ts | 8 +++ 10 files changed, 273 insertions(+), 7 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index ed2d54d..15ef25f 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -538,6 +538,22 @@ export default class ClientConnection { } } + public async getDeviceAttribute() { + try { + return await this.doRpc( + new Protocol.GetDeviceAttributeRequestEntity() + ); + } catch (e) { + console.error(e); + } + } + + public setDeviceAttribute(attribute: number) { + this.ws?.send( + JSON.stringify(new Protocol.SetDeviceAttributeRequestEntity(attribute)) + ); + } + public moveWindow(window_id: number, x: number, y: number) { this.ws?.send( JSON.stringify(new Protocol.MoveWindowRequestEntity(window_id, x, y)) diff --git a/src/common/Initializer.ts b/src/common/Initializer.ts index c307085..09c9781 100644 --- a/src/common/Initializer.ts +++ b/src/common/Initializer.ts @@ -172,7 +172,21 @@ export default class Initializer { await Common.waitFor(100); } - await this.getApplicationConfig(); + // get device attribute + { + await this.getApplicationConfig(); + GlobalData.getInstance() + .getCurrentClient() + ?.getDeviceAttribute() + .then((response) => { + if (response && typeof response.attribute != "undefined") { + this.options.$store.commit( + "setDeviceAttribute", + response.attribute + ); + } + }); + } this.initSignalSourceTree(); this.initModeTree(); diff --git a/src/common/RemoteDataExangeProcesser.ts b/src/common/RemoteDataExangeProcesser.ts index 570455b..7a909ea 100644 --- a/src/common/RemoteDataExangeProcesser.ts +++ b/src/common/RemoteDataExangeProcesser.ts @@ -563,6 +563,16 @@ export default class RemoteDataExangeProcesser { } } break; + case Protocol.Commands.kSetDeviceAttribute: + { + const temp = JSON.parse( + notify.data + ) as Protocol.SetDeviceAttributeNotifyEntity; + if (temp) { + $store.commit("setDeviceAttribute", temp.attribute); + } + } + break; } } catch {} } diff --git a/src/components/AdvancedDebugDialog.vue b/src/components/AdvancedDebugDialog.vue index 044fafa..9b3aac5 100644 --- a/src/components/AdvancedDebugDialog.vue +++ b/src/components/AdvancedDebugDialog.vue @@ -39,8 +39,38 @@ + {{ $t("function") }}: - Restart + + + + + + + + + + + + + {{ $t("restart") }} @@ -65,11 +95,12 @@