增加替换窗口、轮询窗口的功能
This commit is contained in:
parent
95f667bfc8
commit
228c814f3d
|
@ -615,6 +615,26 @@ export default class ClientConnection {
|
|||
this.ws?.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
public replaceWindow(data: Protocol.ReplaceWindowRequestEntity) {
|
||||
this.ws?.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
public replaceWindow2(
|
||||
window_id: number,
|
||||
signal_source: string,
|
||||
polling?: boolean,
|
||||
ext_data?: string
|
||||
) {
|
||||
this.replaceWindow(
|
||||
new Protocol.ReplaceWindowRequestEntity(
|
||||
window_id,
|
||||
signal_source,
|
||||
polling,
|
||||
ext_data
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public openPolling(data: Protocol.OpenPollingRequestEntity) {
|
||||
this.ws?.send(JSON.stringify(data));
|
||||
}
|
||||
|
|
|
@ -79,6 +79,10 @@ export namespace Protocol {
|
|||
return Commands.PROTOCOL_PREFIX + "OpenWindow";
|
||||
}
|
||||
|
||||
public static get kReplaceWindow() {
|
||||
return Commands.PROTOCOL_PREFIX + "ReplaceWindow";
|
||||
}
|
||||
|
||||
public static get kOpenPolling() {
|
||||
return Commands.PROTOCOL_PREFIX + "OpenPolling";
|
||||
}
|
||||
|
@ -458,6 +462,7 @@ export namespace Protocol {
|
|||
Commands.kResizeWindow,
|
||||
Commands.kSetWindowGeometry,
|
||||
Commands.kOpenWindow,
|
||||
Commands.kReplaceWindow,
|
||||
Commands.kOpenPolling,
|
||||
Commands.kCloseWindow,
|
||||
Commands.kTopWindow,
|
||||
|
@ -791,6 +796,26 @@ export namespace Protocol {
|
|||
}
|
||||
}
|
||||
|
||||
export class ReplaceWindowRequestEntity extends PacketEntity {
|
||||
window_id: number = 0;
|
||||
signal_source: string = "";
|
||||
ext_data: string = "";
|
||||
polling: boolean = false;
|
||||
constructor(
|
||||
window_id: number,
|
||||
signal_source: string,
|
||||
polling?: boolean,
|
||||
ext_data?: string
|
||||
) {
|
||||
super();
|
||||
this.command = Commands.kReplaceWindow;
|
||||
this.window_id = window_id;
|
||||
this.signal_source = signal_source ?? "";
|
||||
this.polling = typeof polling != "boolean" ? false : polling;
|
||||
this.ext_data = ext_data ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
export class OpenPollingRequestEntity extends PacketEntity {
|
||||
polling_uuid: string = "";
|
||||
x: number = 0;
|
||||
|
|
|
@ -331,4 +331,5 @@ export default {
|
|||
"send power on command": "Send Power On Command",
|
||||
"send power off command": "Send Power Off Command",
|
||||
"set subtitle success": "Set OSD Success",
|
||||
"stop polling": "Stop Signal Loop",
|
||||
};
|
||||
|
|
|
@ -732,20 +732,6 @@ export default defineComponent({
|
|||
let width = window.width;
|
||||
let height = window.height;
|
||||
|
||||
client.closeWindow(window.window_id);
|
||||
const open_window_request =
|
||||
new Protocol.OpenPollingRequestEntity(
|
||||
evt.data.uuid,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
);
|
||||
open_window_request.muted = window.muted;
|
||||
open_window_request.volume = window.volume;
|
||||
open_window_request.paused = window.paused;
|
||||
open_window_request.play_speed = window.play_speed;
|
||||
|
||||
setTimeout(() => {
|
||||
if (!window) {
|
||||
return;
|
||||
|
@ -753,21 +739,16 @@ export default defineComponent({
|
|||
switch (evt.type) {
|
||||
case "polling":
|
||||
{
|
||||
const open_polling_request =
|
||||
new Protocol.OpenPollingRequestEntity(
|
||||
if (signal_sources.length) {
|
||||
const signal_source = signal_sources[0];
|
||||
if (signal_source) {
|
||||
client?.replaceWindow2(
|
||||
window.window_id,
|
||||
evt.data.uuid,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
true
|
||||
);
|
||||
open_polling_request.muted = window.muted;
|
||||
open_polling_request.volume = window.volume;
|
||||
open_polling_request.paused = window.paused;
|
||||
open_polling_request.play_speed = window.play_speed;
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.openPolling(open_polling_request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -776,24 +757,13 @@ export default defineComponent({
|
|||
if (signal_sources.length) {
|
||||
const signal_source = signal_sources[0];
|
||||
if (signal_source) {
|
||||
const open_window_request =
|
||||
new Protocol.OpenWindowRequestEntity(
|
||||
signal_source.uuid,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height
|
||||
client?.replaceWindow2(
|
||||
window.window_id,
|
||||
signal_source.uuid
|
||||
);
|
||||
open_window_request.muted = window.muted;
|
||||
open_window_request.volume = window.volume;
|
||||
open_window_request.paused = window.paused;
|
||||
open_window_request.play_speed =
|
||||
window.play_speed;
|
||||
client?.openWindow(open_window_request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}, 50);
|
||||
|
|
|
@ -884,12 +884,6 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
if (find_flag) {
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.closeWindow(find_window);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (!window) {
|
||||
return;
|
||||
|
@ -897,6 +891,11 @@ export default defineComponent({
|
|||
switch (type) {
|
||||
case "polling":
|
||||
{
|
||||
if (find_flag) {
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.replaceWindow2(find_window, uuid, true);
|
||||
} else {
|
||||
const open_polling_request =
|
||||
new Protocol.OpenPollingRequestEntity(
|
||||
uuid,
|
||||
|
@ -912,10 +911,19 @@ export default defineComponent({
|
|||
.getCurrentClient()
|
||||
?.openPolling(open_polling_request);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "signal_source":
|
||||
{
|
||||
if (signal_sources.length) {
|
||||
const signal_source = signal_sources[0];
|
||||
if (signal_source) {
|
||||
if (find_flag) {
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.replaceWindow2(find_window, uuid);
|
||||
} else {
|
||||
const open_window_request =
|
||||
new Protocol.OpenWindowRequestEntity(
|
||||
uuid,
|
||||
|
@ -927,15 +935,13 @@ export default defineComponent({
|
|||
open_window_request.muted = muted;
|
||||
open_window_request.paused = paused;
|
||||
open_window_request.play_speed = play_speed;
|
||||
if (signal_sources.length) {
|
||||
const signal_source = signal_sources[0];
|
||||
if (signal_source) {
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.openWindow(open_window_request);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1253,27 +1259,9 @@ export default defineComponent({
|
|||
.getCurrentClient()
|
||||
?.addSignalSource(entity);
|
||||
if (response && response.success) {
|
||||
const open_window_request =
|
||||
new Protocol.OpenWindowRequestEntity(
|
||||
response.uuid,
|
||||
old_window.x,
|
||||
old_window.y,
|
||||
old_window.width,
|
||||
old_window.height
|
||||
);
|
||||
|
||||
open_window_request.muted = old_window.muted;
|
||||
open_window_request.volume = old_window.volume;
|
||||
open_window_request.paused = old_window.paused;
|
||||
open_window_request.play_speed = old_window.play_speed;
|
||||
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.closeWindow(old_window.window_id);
|
||||
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.openWindow(open_window_request);
|
||||
?.replaceWindow2(old_window.window_id, response.uuid);
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,9 @@ export default store(function (/* { ssrContext } */) {
|
|||
},
|
||||
pushWindow(state: StateInterface, playload?: WindowOpenNotifyEntity) {
|
||||
if (playload) {
|
||||
if (state.windows.find((e) => e && e.uuid == playload.uuid)) {
|
||||
if (
|
||||
state.windows.find((e) => e && e.window_id == playload.window_id)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue