From ec365027e9600c3d7bd9be2a859dc5d1d3368401 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 18 Nov 2022 09:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BE=93=E5=87=BA=E6=9D=BF?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=E7=B4=A2=E5=BC=95=E4=BF=AE=E6=94=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 17 +++ src/components/custom/ISVVideoWallDialog.vue | 120 +++++++++++++++++-- src/entities/WSProtocol.ts | 27 +++++ 3 files changed, 152 insertions(+), 12 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 2301931..23b8d75 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -895,6 +895,23 @@ export default class ClientConnection { console.error(e); } } + + public async setOutputBoardSpliceIndex( + device_index: number, + splice_index: number + ) { + try { + return await this.doRpc( + new Protocol.RpcOutputBoardSpliceIndexRequestEntity( + device_index, + splice_index + ) + ); + } catch (e) { + console.error(e); + } + } + public async setWindowVolume(window_id: number, volume: number) { this.ws?.send( JSON.stringify( diff --git a/src/components/custom/ISVVideoWallDialog.vue b/src/components/custom/ISVVideoWallDialog.vue index 74b2bb1..7cf19c4 100644 --- a/src/components/custom/ISVVideoWallDialog.vue +++ b/src/components/custom/ISVVideoWallDialog.vue @@ -101,7 +101,7 @@
- - {{ (row - 1) * preview_cols + col }} - - - (180°) - +
+
+ +   OI:{{ (row - 1) * preview_cols + col }} + +
+ +   NI:{{ + (outputs[(row - 1) * preview_cols + col - 1] + .output_index ?? (row - 1) * preview_cols + col) + 1 + }} +
+ + (180°) + +
+ + + {{ + $t("set splice index") + }} + + +
@@ -236,6 +269,9 @@ export default defineComponent({ const preview_cols = ref(3); const preview_rotation = ref(0); const previce_grid_height = ref(100); + const outputs: Ref = ref( + [] + ); class parseSpliceModeResult { rotation = 0; @@ -326,6 +362,7 @@ export default defineComponent({ preview_cols, preview_rotation, previce_grid_height, + outputs, async showDialog() { { @@ -345,6 +382,7 @@ export default defineComponent({ const video_wall_config = await GlobalData.getInstance() .getCurrentClient() ?.customConnection.getVideoWallConfig(); + outputs.value = video_wall_config?.outputs ?? []; if (video_wall_config) { if (screen_mode.value == 0) { splice_mode.value = @@ -436,6 +474,64 @@ export default defineComponent({ }); loading.value = false; }, + setSpliceIndex(device_index: number, splice_index: number) { + let items = []; + for (let i = 0; i < 25; ++i) { + items.push({ + label: (i + 1).toString(), + value: i.toString(), + }); + } + $q.dialog({ + title: $t.t("set splice index"), + message: $t.t("please select new index") + "!", + options: { + type: "radio", + model: splice_index.toString(), + items: items, + isValid: (v) => v != splice_index.toString(), + }, + ok: { + label: $t.t("ok"), + noCaps: true, + flat: true, + }, + cancel: { + label: $t.t("cancel"), + noCaps: true, + flat: true, + }, + }).onOk(async (data) => { + const temp = parseInt(data); + let success = false; + if (!isNaN(temp)) { + const response = await GlobalData.getInstance() + .getCurrentClient() + ?.setOutputBoardSpliceIndex(device_index, temp); + if (response) { + success = response.success; + if (success) { + const item = outputs.value.find( + (e) => e && e.index == response.device_index + ); + if (item) { + item.output_index = response.splice_index; + } + } + } + } + $q.notify({ + color: success ? "positive" : "negative", + icon: success ? "done" : "warning", + message: + $t.t("set splice index") + + $t.t(success ? "success" : "failed") + + "!", + position: "top", + timeout: 2500, + }); + }); + }, }; }, }); diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index f3baac6..ade9141 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -295,6 +295,10 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "SwitchOutputBoardSplitState"; } + public static get kRpcOutputBoardSpliceIndex() { + return Commands.PROTOCOL_PREFIX + "RpcOutputBoardSpliceIndex"; + } + public static get kSetWindowVolume() { return Commands.PROTOCOL_PREFIX + "SetWindowVolume"; } @@ -537,6 +541,7 @@ export namespace Protocol { Commands.kOutputBoardSettingNotify, Commands.kRpcSetOutputBoardSetting, Commands.kRpcGetOutputBoardSetting, + Commands.kRpcOutputBoardSpliceIndex, Commands.kSetWindowVolume, Commands.kMuteWidow, Commands.kUnMuteWidow, @@ -1957,6 +1962,28 @@ export namespace Protocol { } } + export class RpcOutputBoardSpliceIndexRequestEntity extends Protocol.PacketEntity { + device_index = 0; + splice_index = 0; + constructor(device_index: number, splice_index: number, rcp_id?: number) { + super(); + this.rpc_id = rcp_id ?? 0; + this.command = Protocol.Commands.kRpcOutputBoardSpliceIndex; + this.device_index = device_index; + this.splice_index = splice_index; + } + } + + export class RpcOutputBoardSpliceIndexResponseEntity extends Protocol.PacketEntity { + success = false; + device_index = 0; + splice_index = 0; + constructor() { + super(); + this.command = Protocol.Commands.kRpcOutputBoardSpliceIndex; + } + } + export class OutputBoardSettingNotify extends Protocol.PacketEntity { splicing = false; wall_rows = 2;