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