From c692cab4c9e58f3e8540a7ff73e4be7abd50caf9 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Sat, 24 Dec 2022 15:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0setBlendingGammaParam,setBlen?= =?UTF-8?q?dingPowerParam,setBlendingAlphaParam,setBlendingCorrection?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/ClientConnection.ts | 78 +++++++++++++++++- src/entities/WSProtocol.ts | 141 ++++++++++++++++++++++++++++++++- 2 files changed, 216 insertions(+), 3 deletions(-) diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 91e6af8..5f33df5 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -1253,10 +1253,16 @@ export default class ClientConnection { } } - public async testA() { + public async testA( + x: number, + y: number, + w: number, + h: number, + angle: number + ) { try { return await this.doRpc( - new Protocol.RpcTestARequestEntity() + new Protocol.RpcTestARequestEntity(x, y, w, h, angle) ); } catch (e) { console.error(e); @@ -1313,6 +1319,74 @@ export default class ClientConnection { ); } + public async setBlendingCorrection( + row: number, + column: number, + correction_type: number, + control_point: number, + x: number, + y: number + ) { + return await this.doRpc( + new Protocol.SetBlendingCorrectionRequestEntity( + row, + column, + correction_type, + control_point, + x, + y + ) + ); + } + + public async setBlendingAlphaParam( + row: number, + column: number, + location: number, + value: number + ) { + return await this.doRpc( + new Protocol.SetBlendingAlphaParamRequestEntity( + row, + column, + location, + value + ) + ); + } + + public async setBlendingPowerParam( + row: number, + column: number, + location: number, + value: number + ) { + return await this.doRpc( + new Protocol.SetBlendingPowerParamRequestEntity( + row, + column, + location, + value + ) + ); + } + + public async setBlendingGammaParam( + row: number, + column: number, + location: number, + value: number + ) { + return await this.doRpc( + new Protocol.SetBlendingGammaParamRequestEntity( + row, + column, + location, + value + ) + ); + } + public destory() { this.ws?.close(); if (this.ws) { diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index db26a97..abd19c7 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -487,6 +487,19 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "RpcTestA"; } + public static get kSetBlendingCorrection() { + return Commands.PROTOCOL_PREFIX + "SetBlendingCorrection"; + } + public static get kSetBlendingAlphaParam() { + return Commands.PROTOCOL_PREFIX + "SetBlendingAlphaParam"; + } + public static get kSetBlendingPowerParam() { + return Commands.PROTOCOL_PREFIX + "SetBlendingPowerParam"; + } + public static get kSetBlendingGammaParam() { + return Commands.PROTOCOL_PREFIX + "SetBlendingGammaParam"; + } + static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -606,6 +619,10 @@ export namespace Protocol { Commands.kRpcGetMagicWallConfig, Commands.kRpcSetMagicWallConfig, Commands.kRpcTestA, + Commands.kSetBlendingCorrection, + Commands.kSetBlendingAlphaParam, + Commands.kSetBlendingPowerParam, + Commands.kSetBlendingGammaParam, ]); public static get AllCommands() { return this._all_commands; @@ -3095,13 +3112,32 @@ export namespace Protocol { } export class RpcTestARequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor( + x: number, + y: number, + w: number, + h: number, + angle: number, + rpc_id = 0 + ) { super(); super.command = Commands.kRpcTestA; super.flag = PacketEntity.FLAG_REQUEST; super.rpc_id = rpc_id; + + this.x = x ?? 0; + this.y = y ?? 0; + this.w = w ?? 0.5; + this.h = h ?? 0.5; + this.angle = angle ?? 0; } timestamp = 0; + + x: number; + y: number; + w: number; + h: number; + angle: number; } export class RpcTestAResponseEntity extends PacketEntity { @@ -3118,4 +3154,107 @@ export namespace Protocol { lb_b = 0; lb_l = 0; } + + /** */ + export class SetBlendingCorrectionRequestEntity extends PacketEntity { + constructor( + row: number, + column: number, + correction_type: number, + control_point: number, + x: number, + y: number, + rpc_id = 0 + ) { + super(); + super.command = Commands.kSetBlendingCorrection; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.x = x ?? 0; + this.y = y ?? 0; + this.row = row ?? 0; + this.column = column ?? 0; + this.correction_type = correction_type ?? 0; + this.control_point = control_point ?? 0; + } + row = 0; + column = 0; + correction_type = 0; //4:四点校正,9:曲面校正 + control_point = 0; //控制点编号,1开始,从上到下从左到右 + x = 0; + y = 0; + } + + export class SetBlendingAlphaParamRequestEntity extends PacketEntity { + constructor( + row: number, + column: number, + location: number, + value: number, + rpc_id = 0 + ) { + super(); + super.command = Commands.kSetBlendingAlphaParam; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.row = row ?? 0; + this.column = column ?? 0; + this.location = location ?? 0; + this.value = value ?? 0; + } + row = 0; + column = 0; + location = 0; //0:左融合带,1:上融合带,2:右融合带,3:下融合带 + value = 0.0; + } + + export class SetBlendingPowerParamRequestEntity extends PacketEntity { + constructor( + row: number, + column: number, + location: number, + value: number, + rpc_id = 0 + ) { + super(); + super.command = Commands.kSetBlendingPowerParam; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.row = row ?? 0; + this.column = column ?? 0; + this.location = location ?? 0; + this.value = value ?? 0; + } + row = 0; + column = 0; + location = 0; //0:左融合带,1:上融合带,2:右融合带,3:下融合带 + value = 0.0; + } + + export class SetBlendingGammaParamRequestEntity extends PacketEntity { + constructor( + row: number, + column: number, + location: number, + value: number, + rpc_id = 0 + ) { + super(); + super.command = Commands.kSetBlendingGammaParam; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.row = row ?? 0; + this.column = column ?? 0; + this.location = location ?? 0; + this.value = value ?? 0; + } + row = 0; + column = 0; + location = 0; //0:左融合带,1:上融合带,2:右融合带,3:下融合带 + value = 0.0; + } }