添加开关机功能,删除无效资源文件
After Width: | Height: | Size: 966 B |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 1009 B |
Before Width: | Height: | Size: 1021 B |
Before Width: | Height: | Size: 1.3 KiB |
|
@ -903,6 +903,22 @@ export default class ClientConnection {
|
|||
);
|
||||
}
|
||||
|
||||
public async wakeUpDevice() {
|
||||
return await this.doRpc<Protocol.SetDevicePowerResponseEntity>(
|
||||
new Protocol.SetDevicePowerRequestEntity(
|
||||
Protocol.SetDevicePowerRequestEntity.kPowerStatePowerOn
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public async deviceStandByMode() {
|
||||
return await this.doRpc<Protocol.SetDevicePowerResponseEntity>(
|
||||
new Protocol.SetDevicePowerRequestEntity(
|
||||
Protocol.SetDevicePowerRequestEntity.kPowerStateStandBy
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public setEdgeBlendingPoint(point: EdgeBlendingPoint) {
|
||||
this.ws?.send(
|
||||
JSON.stringify(new Protocol.SetEdgeBlendingPointRequestEntity(point))
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import BaseEntity from "./BaseEntity";
|
||||
|
||||
export class ExternalControlTableEntity extends BaseEntity {
|
||||
name = "";
|
||||
command = "";
|
||||
icon = "";
|
||||
number = 0;
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
export enum ESerialPortParity {
|
||||
None = 0,
|
||||
Odd,
|
||||
Even,
|
||||
}
|
||||
|
||||
export const kSerialPortParityMap = new Map<ESerialPortParity, string>([
|
||||
[ESerialPortParity.None, "ESerialPortParity.None"],
|
||||
[ESerialPortParity.Odd, "ESerialPortParity.Odd"],
|
||||
[ESerialPortParity.Even, "ESerialPortParity.Even"],
|
||||
]);
|
||||
|
||||
export class ESerialPortParityHelper {
|
||||
toString(e: ESerialPortParity) {
|
||||
if (kSerialPortParityMap.has(e)) {
|
||||
return kSerialPortParityMap.get(e);
|
||||
}
|
||||
return "ESerialPortParity.None";
|
||||
}
|
||||
|
||||
fromString(str: string) {
|
||||
let ret = ESerialPortParity.None;
|
||||
for (const item of kSerialPortParityMap.entries()) {
|
||||
if (item && item[1] == str) {
|
||||
ret = item[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
export enum ESerialPortStopBits {
|
||||
One = 0,
|
||||
OnePointFive,
|
||||
Two,
|
||||
}
|
||||
|
||||
export const kSerialPortStopBitsMap = new Map<ESerialPortStopBits, string>([
|
||||
[ESerialPortStopBits.One, "ESerialPortStopBits.One"],
|
||||
[ESerialPortStopBits.OnePointFive, "ESerialPortStopBits.OnePointFive"],
|
||||
[ESerialPortStopBits.Two, "ESerialPortStopBits.Two"],
|
||||
]);
|
||||
|
||||
export class ESerialPortStopBitsHelper {
|
||||
toString(e: ESerialPortStopBits) {
|
||||
if (kSerialPortStopBitsMap.has(e)) {
|
||||
return kSerialPortStopBitsMap.get(e);
|
||||
}
|
||||
return "ESerialPortStopBits.One";
|
||||
}
|
||||
|
||||
fromString(str: string) {
|
||||
let ret = ESerialPortStopBits.One;
|
||||
for (const item of kSerialPortStopBitsMap.entries()) {
|
||||
if (item && item[1] == str) {
|
||||
ret = item[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
export enum ESerialPortFlowControl {
|
||||
None = 0,
|
||||
Software,
|
||||
Hardware,
|
||||
}
|
||||
|
||||
export const kSerialPortFlowControlMap = new Map<
|
||||
ESerialPortFlowControl,
|
||||
string
|
||||
>([
|
||||
[ESerialPortFlowControl.None, "ESerialPortFlowControl.None"],
|
||||
[ESerialPortFlowControl.Software, "ESerialPortFlowControl.Software"],
|
||||
[ESerialPortFlowControl.Hardware, "ESerialPortFlowControl.Hardware"],
|
||||
]);
|
||||
|
||||
export class ESerialPortFlowControlHelper {
|
||||
toString(e: ESerialPortFlowControl) {
|
||||
if (kSerialPortFlowControlMap.has(e)) {
|
||||
return kSerialPortFlowControlMap.get(e);
|
||||
}
|
||||
return "ESerialPortStopBits.One";
|
||||
}
|
||||
|
||||
fromString(str: string) {
|
||||
let ret = ESerialPortFlowControl.None;
|
||||
for (const item of kSerialPortFlowControlMap.entries()) {
|
||||
if (item && item[1] == str) {
|
||||
ret = item[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
export class SerialPortConfigEntity {
|
||||
baud_rate = 9600;
|
||||
character_size = 8;
|
||||
parity: ESerialPortParity = ESerialPortParity.None;
|
||||
stop_bits: ESerialPortStopBits = ESerialPortStopBits.One;
|
||||
flow_control: ESerialPortFlowControl = ESerialPortFlowControl.None;
|
||||
}
|
|
@ -6,6 +6,8 @@ import { PlanEntity } from "./PlanEntity";
|
|||
import SubtitleEntity from "./SubtitleEntity";
|
||||
import { PollingEntity, PollingGroupEntity } from "./PollingEntity";
|
||||
import { EdgeBlendingPoint } from "./EdgeBlendingEntities";
|
||||
import { ExternalControlTableEntity } from "./ExternalControlTableEntity";
|
||||
import { SerialPortConfigEntity } from "./SerialPortConfigEntity";
|
||||
|
||||
export namespace Protocol {
|
||||
export class Commands {
|
||||
|
@ -354,6 +356,29 @@ export namespace Protocol {
|
|||
return Commands.PROTOCOL_PREFIX + "RpcFileOperator";
|
||||
}
|
||||
|
||||
public static get kRpcGetExternalControlDatas() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlDatas";
|
||||
}
|
||||
|
||||
public static get kRpcDeleteExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcDeleteExternalControlData";
|
||||
}
|
||||
public static get kRpcEditExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcEditExternalControlData";
|
||||
}
|
||||
public static get kRpcAddExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcAddExternalControlData";
|
||||
}
|
||||
public static get kCallExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "CallExternalControlData";
|
||||
}
|
||||
public static get kRpcGetExternalControlSerialPortConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlSerialPortConfig";
|
||||
}
|
||||
public static get kRpcSetExternalControlSerialPortConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcSetExternalControlSerialPortConfig";
|
||||
}
|
||||
|
||||
static _all_commands = new Set([
|
||||
Commands.kUnKnowCommand,
|
||||
Commands.kSearchDevice,
|
||||
|
@ -441,6 +466,13 @@ export namespace Protocol {
|
|||
Commands.kSetEdgeBlendingPoint,
|
||||
Commands.kRpcSetDevicePowerMode,
|
||||
Commands.kRpcFileOperator,
|
||||
Commands.kRpcGetExternalControlDatas,
|
||||
Commands.kRpcDeleteExternalControlData,
|
||||
Commands.kRpcEditExternalControlData,
|
||||
Commands.kRpcAddExternalControlData,
|
||||
Commands.kCallExternalControlData,
|
||||
Commands.kRpcGetExternalControlSerialPortConfig,
|
||||
Commands.kRpcSetExternalControlSerialPortConfig,
|
||||
]);
|
||||
|
||||
public static get AllCommands() {
|
||||
|
@ -2171,4 +2203,196 @@ export namespace Protocol {
|
|||
this.command = Commands.kRpcFileOperator;
|
||||
}
|
||||
}
|
||||
|
||||
export class SetDevicePowerRequestEntity extends PacketEntity {
|
||||
power_state: string;
|
||||
|
||||
static kPowerStatePowerOn = "POWER_ON";
|
||||
static kPowerStatePowerOff = "POWER_OFF";
|
||||
static kPowerStateStandBy = "STAND_BY";
|
||||
constructor(power_state: string, rpcid?: number) {
|
||||
super();
|
||||
this.rpc_id = rpcid ?? 0;
|
||||
this.command = Commands.kRpcSetDevicePowerMode;
|
||||
this.power_state = power_state;
|
||||
}
|
||||
}
|
||||
|
||||
export class SetDevicePowerResponseEntity extends PacketEntity {
|
||||
success = true;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.command = Commands.kRpcSetDevicePowerMode;
|
||||
}
|
||||
}
|
||||
|
||||
export class RpcGetExternalControlDatasRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcGetExternalControlDatas;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
export class RpcGetExternalControlDatasResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
|
||||
datas: ExternalControlTableEntity[] = [];
|
||||
}
|
||||
|
||||
export class RpcDeleteExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
uuid = "";
|
||||
}
|
||||
|
||||
export class RpcDeleteExternalControlDataResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
RpcDeleteExternalControlDataResponseEntity() {}
|
||||
|
||||
success = false;
|
||||
}
|
||||
|
||||
export class ExternalControlDataDeleteNotifyEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_NOTIFY;
|
||||
super.rpc_id = 0;
|
||||
}
|
||||
|
||||
uuid = "";
|
||||
}
|
||||
|
||||
export class RpcEditExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcEditExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
entity: ExternalControlTableEntity = new ExternalControlTableEntity();
|
||||
}
|
||||
|
||||
export class RpcEditExternalControlDataResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
RpcEditExternalControlDataResponseEntity() {}
|
||||
|
||||
success = false;
|
||||
}
|
||||
|
||||
export class ExternalControlDataEditNotifyEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_NOTIFY;
|
||||
super.rpc_id = 0;
|
||||
}
|
||||
|
||||
entity = new ExternalControlTableEntity();
|
||||
}
|
||||
|
||||
export class RpcAddExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcAddExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
entity = new ExternalControlTableEntity();
|
||||
}
|
||||
|
||||
export class RpcAddExternalControlDataResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
RpcAddExternalControlDataResponseEntity() {}
|
||||
|
||||
success = false;
|
||||
}
|
||||
|
||||
export class ExternalControlDataAddNotifyEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_NOTIFY;
|
||||
super.rpc_id = 0;
|
||||
}
|
||||
|
||||
entity = new ExternalControlTableEntity();
|
||||
}
|
||||
|
||||
export class CallExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kCallExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
uuid = "";
|
||||
}
|
||||
|
||||
export class RpcGetExternalControlSerialPortConfigRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcGetExternalControlSerialPortConfig;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
export class RpcGetExternalControlSerialPortConfigResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
RpcGetExternalControlSerialPortConfigResponseEntity() {}
|
||||
|
||||
config = new SerialPortConfigEntity();
|
||||
}
|
||||
|
||||
export class RpcSetExternalControlSerialPortConfigRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcSetExternalControlSerialPortConfig;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
||||
config = new SerialPortConfigEntity();
|
||||
}
|
||||
|
||||
export class RpcSetExternalControlSerialPortConfigResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
RpcSetExternalControlSerialPortConfigResponseEntity() {}
|
||||
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -437,4 +437,7 @@ export default {
|
|||
"file count": "文件数量",
|
||||
"directoriy count": "文件夹数量",
|
||||
"free space": "剩余空间",
|
||||
"center contorl": "中控",
|
||||
"power on": "开机",
|
||||
"power off": "关机",
|
||||
};
|
||||
|
|
|
@ -151,6 +151,36 @@
|
|||
@click="stopPlan"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
stretch
|
||||
flat
|
||||
stack
|
||||
icon="img:new_icon/power_off.png"
|
||||
:label="$t('power off')"
|
||||
class="q-mr-sm"
|
||||
@click="powerOff"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
stretch
|
||||
flat
|
||||
stack
|
||||
icon="img:new_icon/power_on.png"
|
||||
:label="$t('power on')"
|
||||
class="q-mr-sm"
|
||||
@click="powerOn"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
stretch
|
||||
flat
|
||||
stack
|
||||
icon="img:new_icon/center_control.png"
|
||||
:label="$t('center contorl')"
|
||||
class="q-mr-sm"
|
||||
@click="$refs.center_control_dialog.showDialog()"
|
||||
/>
|
||||
|
||||
<q-space />
|
||||
<q-btn-dropdown
|
||||
stretch
|
||||
|
@ -570,6 +600,28 @@ export default defineComponent({
|
|||
</div>`,
|
||||
});
|
||||
},
|
||||
async powerOff() {
|
||||
let success = false;
|
||||
try {
|
||||
const response = await GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.deviceStandByMode();
|
||||
if (response) {
|
||||
success = response?.success ?? false;
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
async powerOn() {
|
||||
let success = false;
|
||||
try {
|
||||
const response = await GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.wakeUpDevice();
|
||||
if (response) {
|
||||
success = response?.success ?? false;
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|