diff --git a/public/login_background.png b/public/login_background.png new file mode 100644 index 0000000..2b720e0 Binary files /dev/null and b/public/login_background.png differ diff --git a/public/new_icon/center_control.png b/public/new_icon/center_control.png index 5e70814..53ffe09 100644 Binary files a/public/new_icon/center_control.png and b/public/new_icon/center_control.png differ diff --git a/public/new_icon/power_off.png b/public/new_icon/power_off.png index 255c1c8..87687e8 100644 Binary files a/public/new_icon/power_off.png and b/public/new_icon/power_off.png differ diff --git a/public/new_icon/power_on.png b/public/new_icon/power_on.png index b1409c9..e36cc1a 100644 Binary files a/public/new_icon/power_on.png and b/public/new_icon/power_on.png differ diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 0e5f610..641c90b 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -8,6 +8,8 @@ import SubtitleEntity from "src/entities/SubtitleEntity"; import { Protocol } from "src/entities/WSProtocol"; import EventBus, { EventNamesDefine } from "./EventBus"; import { EdgeBlendingPoint } from "src/entities/EdgeBlendingEntities"; +import { ExternalControlTableEntity } from "src/entities/ExternalControlTableEntity"; +import { SerialPortConfigEntity } from "src/entities/SerialPortConfigEntity"; class _RpcInfo { send_timestamp: number; @@ -919,6 +921,49 @@ export default class ClientConnection { ); } + public async getExternalControlDatas() { + return await this.doRpc( + new Protocol.RpcGetExternalControlDatasRequestEntity() + ); + } + + public async deleteExternalControlData(uuid: string) { + return await this.doRpc( + new Protocol.RpcDeleteExternalControlDataRequestEntity(uuid) + ); + } + + public async editExternalControlData(entity: ExternalControlTableEntity) { + return await this.doRpc( + new Protocol.RpcEditExternalControlDataRequestEntity(entity) + ); + } + + public async addExternalControlData(entity: ExternalControlTableEntity) { + return await this.doRpc( + new Protocol.RpcAddExternalControlDataRequestEntity(entity) + ); + } + + public async getExternalControlSerialPortConfig() { + return await this.doRpc( + new Protocol.RpcGetExternalControlSerialPortConfigRequestEntity() + ); + } + + public async setExternalControlSerialPortConfig( + config: SerialPortConfigEntity + ) { + return await this.doRpc( + new Protocol.RpcSetExternalControlSerialPortConfigRequestEntity(config) + ); + } + + public callExternalControlData(uuid: string) { + this.ws?.send( + JSON.stringify(new Protocol.CallExternalControlDataRequestEntity(uuid)) + ); + } public setEdgeBlendingPoint(point: EdgeBlendingPoint) { this.ws?.send( JSON.stringify(new Protocol.SetEdgeBlendingPointRequestEntity(point)) diff --git a/src/components/CenterControlButtonDialog.vue b/src/components/CenterControlButtonDialog.vue new file mode 100644 index 0000000..8ced2f3 --- /dev/null +++ b/src/components/CenterControlButtonDialog.vue @@ -0,0 +1,267 @@ + + + + + diff --git a/src/components/CenterControlDialog.vue b/src/components/CenterControlDialog.vue new file mode 100644 index 0000000..7d5f533 --- /dev/null +++ b/src/components/CenterControlDialog.vue @@ -0,0 +1,491 @@ + + + + + diff --git a/src/entities/ExternalControlTableEntity.ts b/src/entities/ExternalControlTableEntity.ts index a31c149..8a7090e 100644 --- a/src/entities/ExternalControlTableEntity.ts +++ b/src/entities/ExternalControlTableEntity.ts @@ -2,7 +2,7 @@ import BaseEntity from "./BaseEntity"; export class ExternalControlTableEntity extends BaseEntity { name = ""; - command = ""; + command: number[] = []; icon = ""; number = 0; } diff --git a/src/entities/SerialPortConfigEntity.ts b/src/entities/SerialPortConfigEntity.ts index 650170e..17e5ffa 100644 --- a/src/entities/SerialPortConfigEntity.ts +++ b/src/entities/SerialPortConfigEntity.ts @@ -5,20 +5,20 @@ export enum ESerialPortParity { } export const kSerialPortParityMap = new Map([ - [ESerialPortParity.None, "ESerialPortParity.None"], - [ESerialPortParity.Odd, "ESerialPortParity.Odd"], - [ESerialPortParity.Even, "ESerialPortParity.Even"], + [ESerialPortParity.None, "ESerialPortParity::None"], + [ESerialPortParity.Odd, "ESerialPortParity::Odd"], + [ESerialPortParity.Even, "ESerialPortParity::Even"], ]); export class ESerialPortParityHelper { - toString(e: ESerialPortParity) { + static toString(e: ESerialPortParity) { if (kSerialPortParityMap.has(e)) { return kSerialPortParityMap.get(e); } - return "ESerialPortParity.None"; + return "ESerialPortParity::None"; } - fromString(str: string) { + static fromString(str: string) { let ret = ESerialPortParity.None; for (const item of kSerialPortParityMap.entries()) { if (item && item[1] == str) { @@ -37,20 +37,20 @@ export enum ESerialPortStopBits { } export const kSerialPortStopBitsMap = new Map([ - [ESerialPortStopBits.One, "ESerialPortStopBits.One"], - [ESerialPortStopBits.OnePointFive, "ESerialPortStopBits.OnePointFive"], - [ESerialPortStopBits.Two, "ESerialPortStopBits.Two"], + [ESerialPortStopBits.One, "ESerialPortStopBits::One"], + [ESerialPortStopBits.OnePointFive, "ESerialPortStopBits::OnePointFive"], + [ESerialPortStopBits.Two, "ESerialPortStopBits::Two"], ]); export class ESerialPortStopBitsHelper { - toString(e: ESerialPortStopBits) { + static toString(e: ESerialPortStopBits) { if (kSerialPortStopBitsMap.has(e)) { return kSerialPortStopBitsMap.get(e); } - return "ESerialPortStopBits.One"; + return "ESerialPortStopBits::One"; } - fromString(str: string) { + static fromString(str: string) { let ret = ESerialPortStopBits.One; for (const item of kSerialPortStopBitsMap.entries()) { if (item && item[1] == str) { @@ -72,20 +72,20 @@ export const kSerialPortFlowControlMap = new Map< ESerialPortFlowControl, string >([ - [ESerialPortFlowControl.None, "ESerialPortFlowControl.None"], - [ESerialPortFlowControl.Software, "ESerialPortFlowControl.Software"], - [ESerialPortFlowControl.Hardware, "ESerialPortFlowControl.Hardware"], + [ESerialPortFlowControl.None, "ESerialPortFlowControl::None"], + [ESerialPortFlowControl.Software, "ESerialPortFlowControl::Software"], + [ESerialPortFlowControl.Hardware, "ESerialPortFlowControl::Hardware"], ]); export class ESerialPortFlowControlHelper { - toString(e: ESerialPortFlowControl) { + static toString(e: ESerialPortFlowControl) { if (kSerialPortFlowControlMap.has(e)) { return kSerialPortFlowControlMap.get(e); } - return "ESerialPortStopBits.One"; + return "ESerialPortStopBits::One"; } - fromString(str: string) { + static fromString(str: string) { let ret = ESerialPortFlowControl.None; for (const item of kSerialPortFlowControlMap.entries()) { if (item && item[1] == str) { diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index b939e75..052e6a9 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -2248,11 +2248,12 @@ export namespace Protocol { } export class RpcDeleteExternalControlDataRequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor(uuid: string, rpc_id = 0) { super(); super.command = Commands.kRpcDeleteExternalControlData; super.flag = PacketEntity.FLAG_REQUEST; super.rpc_id = rpc_id; + this.uuid = uuid; } uuid = ""; @@ -2280,14 +2281,15 @@ export namespace Protocol { } export class RpcEditExternalControlDataRequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor(entity: ExternalControlTableEntity, rpc_id = 0) { super(); super.command = Commands.kRpcEditExternalControlData; super.flag = PacketEntity.FLAG_REQUEST; super.rpc_id = rpc_id; + this.entity = entity; } - entity: ExternalControlTableEntity = new ExternalControlTableEntity(); + entity: ExternalControlTableEntity; } export class RpcEditExternalControlDataResponseEntity extends PacketEntity { @@ -2312,14 +2314,15 @@ export namespace Protocol { } export class RpcAddExternalControlDataRequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor(entity: ExternalControlTableEntity, rpc_id = 0) { super(); super.command = Commands.kRpcAddExternalControlData; super.flag = PacketEntity.FLAG_REQUEST; super.rpc_id = rpc_id; + this.entity = entity; } - entity = new ExternalControlTableEntity(); + entity: ExternalControlTableEntity; } export class RpcAddExternalControlDataResponseEntity extends PacketEntity { @@ -2344,14 +2347,15 @@ export namespace Protocol { } export class CallExternalControlDataRequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor(uuid:string) { super(); super.command = Commands.kCallExternalControlData; super.flag = PacketEntity.FLAG_REQUEST; - super.rpc_id = rpc_id; + super.rpc_id = 0; + this.uuid = uuid } - uuid = ""; + uuid:string; } export class RpcGetExternalControlSerialPortConfigRequestEntity extends PacketEntity { @@ -2376,14 +2380,15 @@ export namespace Protocol { } export class RpcSetExternalControlSerialPortConfigRequestEntity extends PacketEntity { - constructor(rpc_id = 0) { + constructor(config: SerialPortConfigEntity, rpc_id = 0) { super(); super.command = Commands.kRpcSetExternalControlSerialPortConfig; super.flag = PacketEntity.FLAG_REQUEST; super.rpc_id = rpc_id; + this.config = config; } - config = new SerialPortConfigEntity(); + config: SerialPortConfigEntity; } export class RpcSetExternalControlSerialPortConfigResponseEntity extends PacketEntity { diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index d9a8052..95ae568 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -440,4 +440,24 @@ export default { "center contorl": "中控", "power on": "开机", "power off": "关机", + "center control": "中控", + control: "控制", + "serial port setting": "串口设置", + "stop bits": "停止位", + parity: "校验位", + "character size": "数据位", + "baud rate": "波特率", + submit: "提交", + "set serialport": "设置串口", + "send command": "发送指令", + command: "命令", + name: "名称", + icon: "图标", + "new button": "新建按钮", + "edit button": "修改按钮", + example: "例", + "Please input vaild hex str": "请输入合法的十六进制字符串", + button: "按钮", + "send power on command": "发送开机指令", + "send power off command": "发送关机指令", }; diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 0a16725..42dea72 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -308,6 +308,7 @@ +