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 @@