增加MagicWall配置接口

This commit is contained in:
fangxiang 2022-12-09 14:30:14 +08:00
parent 3a44fb1fbf
commit 35c6baba37
4 changed files with 95 additions and 0 deletions

View File

@ -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<Protocol.RpcGetMagicWallConfigResponseEntity>(
new Protocol.RpcGetMagicWallConfigRequestEntity()
);
} catch (e) {
console.error(e);
}
}
public async setMagicWallConfig(config: MagicWallConfig) {
try {
return await this.doRpc<Protocol.RpcSetMagicWallConfigResponseEntity>(
new Protocol.RpcSetMagicWallConfigRequestEntity(config)
);
} catch (e) {
console.error(e);
}
}
public async setHdmiInDecodeType(index: number, type: string) {
try {
return await this.doRpc<Protocol.SetHdmiInDecodeTypeResponseEntity>(

View File

@ -0,0 +1,8 @@
import RectF from "./RectF";
export default class MagicWallConfig {
magic_wall_enable = false;
row = 0;
col = 0;
windows: RectF[] = [];
}

14
src/entities/RectF.ts Normal file
View File

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

View File

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