diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index a512d2d..ef3e41e 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -15,6 +15,7 @@ import TimingTaskEntity from "src/entities/TimingTaskEntity"; import JointActionEquipmentTableEntity from "src/entities/JointActionEquipmentTableEntity"; import { CustomProtocol } from "src/entities/WSProtocolCustom"; import ClientConnectionCustom from "./ClientConnectionCustom"; +import MagicWallConfig from "src/entities/MagicWallConfig"; class _RpcInfo { send_timestamp: number; @@ -1232,6 +1233,26 @@ export default class ClientConnection { } } + public async getMagicWallConfig() { + try { + return await this.doRpc( + new Protocol.RpcGetMagicWallConfigRequestEntity() + ); + } catch (e) { + console.error(e); + } + } + + public async setMagicWallConfig(config: MagicWallConfig) { + try { + return await this.doRpc( + new Protocol.RpcSetMagicWallConfigRequestEntity(config) + ); + } catch (e) { + console.error(e); + } + } + public async setHdmiInDecodeType(index: number, type: string) { try { return await this.doRpc( diff --git a/src/entities/MagicWallConfig.ts b/src/entities/MagicWallConfig.ts new file mode 100644 index 0000000..5950e39 --- /dev/null +++ b/src/entities/MagicWallConfig.ts @@ -0,0 +1,8 @@ +import RectF from "./RectF"; + +export default class MagicWallConfig { + magic_wall_enable = false; + row = 0; + col = 0; + windows: RectF[] = []; +} diff --git a/src/entities/RectF.ts b/src/entities/RectF.ts new file mode 100644 index 0000000..09048f5 --- /dev/null +++ b/src/entities/RectF.ts @@ -0,0 +1,14 @@ +export default class RectF { + lt: PointF = new PointF(0, 0); + w: number = 0; + h: number = 0; +} + +export class PointF { + constructor(x: number, y: number) { + this.x = x; + this.y = y; + } + x: number = 0; + y: number = 0; +} diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index ade9141..f0b8f1a 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -12,6 +12,7 @@ import { SerialPortConfigEntity } from "./SerialPortConfigEntity"; import { ConnectTableEntity } from "./ConnectTableEntity"; import TimingTaskEntity from "./TimingTaskEntity"; import JointActionEquipmentTableEntity from "./JointActionEquipmentTableEntity"; +import MagicWallConfig from "./MagicWallConfig"; export namespace Protocol { export class Commands { @@ -474,6 +475,14 @@ export namespace Protocol { return Commands.PROTOCOL_PREFIX + "SetHDMIRotation"; } + public static get kRpcSetMagicWallConfig() { + return Commands.PROTOCOL_PREFIX + "RpcSetMagicWallConfig"; + } + + public static get kRpcGetMagicWallConfig() { + return Commands.PROTOCOL_PREFIX + "RpcGetMagicWallConfig"; + } + static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -590,6 +599,8 @@ export namespace Protocol { Commands.kRpcDeleteJointActionEquipment, Commands.kCleanBrowserCache, Commands.kSetHDMIRotation, + Commands.kRpcGetMagicWallConfig, + Commands.kRpcSetMagicWallConfig, ]); public static get AllCommands() { return this._all_commands; @@ -3036,4 +3047,45 @@ export namespace Protocol { this.rotation = rotation; } } + + export class RpcGetMagicWallConfigRequestEntity extends PacketEntity { + constructor(rpc_id = 0) { + super(); + super.command = Commands.kRpcGetMagicWallConfig; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + } + timestamp = Date.now(); + } + + export class RpcGetMagicWallConfigResponseEntity extends PacketEntity { + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + + config: MagicWallConfig = new MagicWallConfig(); + success = false; + } + + export class RpcSetMagicWallConfigRequestEntity extends PacketEntity { + constructor(config: MagicWallConfig, rpc_id = 0) { + super(); + super.command = Commands.kRpcSetMagicWallConfig; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + + this.config = config ?? new MagicWallConfig(); + } + config: MagicWallConfig = new MagicWallConfig(); + } + + export class RpcSetMagicWallConfigResponseEntity extends PacketEntity { + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + config: MagicWallConfig = new MagicWallConfig(); + success = false; + } }