添加声音设置选项,修复RPC超时不抛出异常的BUG
This commit is contained in:
parent
810f213bc2
commit
54742f2d8d
|
@ -52,7 +52,7 @@ export default class ClientConnection {
|
||||||
password?: string | null
|
password?: string | null
|
||||||
) {
|
) {
|
||||||
this.reconnectTo(url, user_name, password);
|
this.reconnectTo(url, user_name, password);
|
||||||
setTimeout(() => {
|
setInterval(() => {
|
||||||
this.checkRpcTimeout();
|
this.checkRpcTimeout();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,8 @@ export default class ClientConnection {
|
||||||
const current_datetime = new Date().getTime();
|
const current_datetime = new Date().getTime();
|
||||||
this.rpc_map.forEach((v, k, m) => {
|
this.rpc_map.forEach((v, k, m) => {
|
||||||
if (current_datetime - v.send_timestamp > v.timeout_timestamp) {
|
if (current_datetime - v.send_timestamp > v.timeout_timestamp) {
|
||||||
|
v.reject();
|
||||||
|
m.delete(k);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -635,29 +637,15 @@ export default class ClientConnection {
|
||||||
public async setSystemNetwork(
|
public async setSystemNetwork(
|
||||||
request: Protocol.SetSystemNetworkRequestEntity
|
request: Protocol.SetSystemNetworkRequestEntity
|
||||||
) {
|
) {
|
||||||
try {
|
|
||||||
return await this.doRpc<Protocol.SetSystemNetworkResponseEntity>(request);
|
return await this.doRpc<Protocol.SetSystemNetworkResponseEntity>(request);
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public async setSystemGraphics(
|
public async setSystemGraphics(
|
||||||
request: Protocol.SetSystemGraphicsRequestEntity
|
request: Protocol.SetSystemGraphicsRequestEntity
|
||||||
) {
|
) {
|
||||||
try {
|
return await this.doRpc<Protocol.SetSystemGraphicsResponseEntity>(request);
|
||||||
return await this.doRpc<Protocol.SetSystemGraphicsResponseEntity>(
|
|
||||||
request
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public async setSystemOther(request: Protocol.SetSystemOtherRequestEntity) {
|
public async setSystemOther(request: Protocol.SetSystemOtherRequestEntity) {
|
||||||
try {
|
|
||||||
return await this.doRpc<Protocol.SetSystemOtherResponseEntity>(request);
|
return await this.doRpc<Protocol.SetSystemOtherResponseEntity>(request);
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public async getSupportResolutions() {
|
public async getSupportResolutions() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -293,9 +293,59 @@
|
||||||
|
|
||||||
<q-tab-panel name="other" class="_panel">
|
<q-tab-panel name="other" class="_panel">
|
||||||
<q-card class="fit">
|
<q-card class="fit">
|
||||||
|
<q-scroll-area style="height: 55vh">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-form ref="other_form" @submit="applyOther">
|
<q-form ref="other_form" @submit="applyOther">
|
||||||
<q-list>
|
<q-list>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar class="width_5_3">{{
|
||||||
|
$t("output audio card") + ":"
|
||||||
|
}}</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-select
|
||||||
|
v-model="output_audio_card"
|
||||||
|
:loading="loading"
|
||||||
|
:disable="loading"
|
||||||
|
:options="output_audio_card_options"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar class="width_5_3">{{
|
||||||
|
$t("muted") + ":"
|
||||||
|
}}</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-select
|
||||||
|
v-model="system_muted"
|
||||||
|
:loading="loading"
|
||||||
|
:disable="loading"
|
||||||
|
:options="[$t('on'), $t('off')]"
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item v-if="system_muted == $t('off')">
|
||||||
|
<q-item-section avatar class="width_5_3">{{
|
||||||
|
$t("volume") + ":"
|
||||||
|
}}</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-input
|
||||||
|
v-model="system_volume"
|
||||||
|
:loading="loading"
|
||||||
|
:disable="loading"
|
||||||
|
type="number"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
(val != null &&
|
||||||
|
val != undefined &&
|
||||||
|
val.toString().length > 0) ||
|
||||||
|
$t('Please type something'),
|
||||||
|
]"
|
||||||
|
lazy-rules
|
||||||
|
/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section avatar class="width_5_3">{{
|
<q-item-section avatar class="width_5_3">{{
|
||||||
$t("use ntp") + ":"
|
$t("use ntp") + ":"
|
||||||
|
@ -397,6 +447,7 @@
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-form>
|
</q-form>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
</q-scroll-area>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
||||||
|
@ -734,6 +785,13 @@ export default defineComponent({
|
||||||
let output_board_resolution = ref("");
|
let output_board_resolution = ref("");
|
||||||
let output_board_resolution_options = ref(["1", "2", "3"]);
|
let output_board_resolution_options = ref(["1", "2", "3"]);
|
||||||
|
|
||||||
|
let system_muted = ref($t.t("off"));
|
||||||
|
let system_volume = ref(100);
|
||||||
|
let output_audio_card_options = ref([
|
||||||
|
{ label: "3.5mm", value: "3.5mm" },
|
||||||
|
{ label: "HDMI1", value: "HDMI1" },
|
||||||
|
]);
|
||||||
|
let output_audio_card = ref(output_audio_card_options.value[0].value);
|
||||||
let use_ntp = ref($t.t("enable"));
|
let use_ntp = ref($t.t("enable"));
|
||||||
let ntp_server = ref("");
|
let ntp_server = ref("");
|
||||||
let ntp_sync_delay = ref(180);
|
let ntp_sync_delay = ref(180);
|
||||||
|
@ -836,6 +894,14 @@ export default defineComponent({
|
||||||
const refresh_other = () => {
|
const refresh_other = () => {
|
||||||
const config = GlobalData.getInstance()?.applicationConfig;
|
const config = GlobalData.getInstance()?.applicationConfig;
|
||||||
if (config) {
|
if (config) {
|
||||||
|
output_audio_card.value = config.output_audio_card;
|
||||||
|
let muted = parseInt(config.system_muted.toString());
|
||||||
|
if (isNaN(muted)) {
|
||||||
|
muted = 0;
|
||||||
|
}
|
||||||
|
system_muted.value = muted ? $t.t("on") : $t.t("off");
|
||||||
|
system_volume.value = config.system_volume;
|
||||||
|
|
||||||
use_ntp.value =
|
use_ntp.value =
|
||||||
config.use_ntp != "0" ? $t.t("enable") : $t.t("disable");
|
config.use_ntp != "0" ? $t.t("enable") : $t.t("disable");
|
||||||
ntp_server.value = config.ntp_server;
|
ntp_server.value = config.ntp_server;
|
||||||
|
@ -881,6 +947,7 @@ export default defineComponent({
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyNetwork = async () => {
|
const applyNetwork = async () => {
|
||||||
|
loading.value = true;
|
||||||
const request = new Protocol.SetSystemNetworkRequestEntity();
|
const request = new Protocol.SetSystemNetworkRequestEntity();
|
||||||
request.auto_ip = auto_ip.value == $t.t("enable");
|
request.auto_ip = auto_ip.value == $t.t("enable");
|
||||||
request.ip_address = ip_address.value;
|
request.ip_address = ip_address.value;
|
||||||
|
@ -918,10 +985,12 @@ export default defineComponent({
|
||||||
(success ? $t.t("success") : $t.t("fail")) +
|
(success ? $t.t("success") : $t.t("fail")) +
|
||||||
"!",
|
"!",
|
||||||
position: "top",
|
position: "top",
|
||||||
timeout: 1000,
|
timeout: 2500,
|
||||||
});
|
});
|
||||||
|
loading.value = false;
|
||||||
};
|
};
|
||||||
const applyGraphics = async () => {
|
const applyGraphics = async () => {
|
||||||
|
loading.value = true;
|
||||||
const request = new Protocol.SetSystemGraphicsRequestEntity();
|
const request = new Protocol.SetSystemGraphicsRequestEntity();
|
||||||
request.brightness = brightness.value;
|
request.brightness = brightness.value;
|
||||||
request.contrast = contrast.value;
|
request.contrast = contrast.value;
|
||||||
|
@ -945,7 +1014,7 @@ export default defineComponent({
|
||||||
(success ? $t.t("success") : $t.t("fail")) +
|
(success ? $t.t("success") : $t.t("fail")) +
|
||||||
"!",
|
"!",
|
||||||
position: "top",
|
position: "top",
|
||||||
timeout: 1000,
|
timeout: 2500,
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
old_resolution != device_resolution.value ||
|
old_resolution != device_resolution.value ||
|
||||||
|
@ -965,10 +1034,17 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyOther = async () => {
|
const applyOther = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
const request = new Protocol.SetSystemOtherRequestEntity();
|
const request = new Protocol.SetSystemOtherRequestEntity();
|
||||||
|
|
||||||
|
request.system_volume = parseInt(system_volume.value.toString());
|
||||||
|
request.system_muted = system_muted.value == $t.t("on");
|
||||||
|
request.output_audio_card = output_audio_card.value;
|
||||||
request.use_ntp = use_ntp.value == $t.t("enable");
|
request.use_ntp = use_ntp.value == $t.t("enable");
|
||||||
request.ntp_sync_delay = ntp_sync_delay.value;
|
request.ntp_sync_delay = ntp_sync_delay.value;
|
||||||
request.ntp_server = ntp_server.value;
|
request.ntp_server = ntp_server.value;
|
||||||
|
@ -996,11 +1072,13 @@ export default defineComponent({
|
||||||
(success ? $t.t("success") : $t.t("fail")) +
|
(success ? $t.t("success") : $t.t("fail")) +
|
||||||
"!",
|
"!",
|
||||||
position: "top",
|
position: "top",
|
||||||
timeout: 1000,
|
timeout: 2500,
|
||||||
});
|
});
|
||||||
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyOutputBoard = async () => {
|
const applyOutputBoard = async () => {
|
||||||
|
loading.value = true;
|
||||||
const request = new Protocol.SetOutputBoardSettingRequestEntity();
|
const request = new Protocol.SetOutputBoardSettingRequestEntity();
|
||||||
request.wall_col = output_board_wall_col.value;
|
request.wall_col = output_board_wall_col.value;
|
||||||
request.wall_row = output_board_wall_row.value;
|
request.wall_row = output_board_wall_row.value;
|
||||||
|
@ -1026,8 +1104,9 @@ export default defineComponent({
|
||||||
(success ? $t.t("success") : $t.t("fail")) +
|
(success ? $t.t("success") : $t.t("fail")) +
|
||||||
"!",
|
"!",
|
||||||
position: "top",
|
position: "top",
|
||||||
timeout: 1000,
|
timeout: 2500,
|
||||||
});
|
});
|
||||||
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const apply = () => {
|
const apply = () => {
|
||||||
|
@ -1047,30 +1126,6 @@ export default defineComponent({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const apply1 = async () => {
|
|
||||||
loading.value = true;
|
|
||||||
try {
|
|
||||||
switch (tab.value) {
|
|
||||||
case "network":
|
|
||||||
await applyNetwork();
|
|
||||||
break;
|
|
||||||
case "graphics":
|
|
||||||
await applyGraphics();
|
|
||||||
break;
|
|
||||||
case "other":
|
|
||||||
await applyOther();
|
|
||||||
break;
|
|
||||||
case "output_board":
|
|
||||||
await applyOutputBoard();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
loading.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const restoreOutputBoard = () => {
|
const restoreOutputBoard = () => {
|
||||||
GlobalData.getInstance().getCurrentClient()?.restoreOutputBoard();
|
GlobalData.getInstance().getCurrentClient()?.restoreOutputBoard();
|
||||||
};
|
};
|
||||||
|
@ -1093,6 +1148,10 @@ export default defineComponent({
|
||||||
device_resolution_options,
|
device_resolution_options,
|
||||||
output_board_resolution,
|
output_board_resolution,
|
||||||
output_board_resolution_options,
|
output_board_resolution_options,
|
||||||
|
output_audio_card,
|
||||||
|
output_audio_card_options,
|
||||||
|
system_muted,
|
||||||
|
system_volume,
|
||||||
use_ntp,
|
use_ntp,
|
||||||
ntp_server,
|
ntp_server,
|
||||||
ntp_sync_delay,
|
ntp_sync_delay,
|
||||||
|
|
|
@ -22,4 +22,7 @@ export default class ApplicationConfigEntity {
|
||||||
graphics_contrast: number = 100;
|
graphics_contrast: number = 100;
|
||||||
graphics_hue: number = 100;
|
graphics_hue: number = 100;
|
||||||
device_rotate: number = 0;
|
device_rotate: number = 0;
|
||||||
|
system_volume: number = 100;
|
||||||
|
system_muted: number = 0;
|
||||||
|
output_audio_card: string = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1197,6 +1197,9 @@ export namespace Protocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SetSystemOtherRequestEntity extends Protocol.PacketEntity {
|
export class SetSystemOtherRequestEntity extends Protocol.PacketEntity {
|
||||||
|
system_muted: boolean = false;
|
||||||
|
system_volume: number = 100;
|
||||||
|
output_audio_card: string = "";
|
||||||
use_ntp: boolean = false;
|
use_ntp: boolean = false;
|
||||||
ntp_server: string = "ntp.ntsc.ac.cn";
|
ntp_server: string = "ntp.ntsc.ac.cn";
|
||||||
ntp_sync_delay: number = 60;
|
ntp_sync_delay: number = 60;
|
||||||
|
|
|
@ -263,4 +263,6 @@ export default {
|
||||||
"set output board": "设置输出板",
|
"set output board": "设置输出板",
|
||||||
"major graphics parameters have been changed and need to be restarted to take effect. Restart the system":
|
"major graphics parameters have been changed and need to be restarted to take effect. Restart the system":
|
||||||
"重要图形参数已更改,需要重启后生效,是否重启",
|
"重要图形参数已更改,需要重启后生效,是否重启",
|
||||||
|
"output audio card": "输出声卡",
|
||||||
|
muted: "静音",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue