中控添加TCP连接和UDP连接功能
This commit is contained in:
parent
0032e8c17c
commit
8f7ed9e39f
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "media_player_client",
|
||||
"version": "1.5.4",
|
||||
"version": "1.5.5",
|
||||
"description": "A Quasar Framework app",
|
||||
"productName": "MediaPlayerClient",
|
||||
"author": "fangxiang <fangxiang@cloudview.work>",
|
||||
|
@ -18,7 +18,7 @@
|
|||
"core-js": "^3.21.0",
|
||||
"element-resize-detector": "^1.2.4",
|
||||
"qrcode.vue": "^3.3.3",
|
||||
"quasar": "^2.10.0",
|
||||
"quasar": "^2.10.1",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"sortablejs": "^1.15.0",
|
||||
"to": "^0.2.9",
|
||||
|
|
|
@ -1055,9 +1055,9 @@ export default class ClientConnection {
|
|||
);
|
||||
}
|
||||
|
||||
public async deleteExternalControlData(uuid: string) {
|
||||
public async deleteExternalControlData(number: number) {
|
||||
return await this.doRpc<Protocol.RpcDeleteExternalControlDataResponseEntity>(
|
||||
new Protocol.RpcDeleteExternalControlDataRequestEntity(uuid)
|
||||
new Protocol.RpcDeleteExternalControlDataRequestEntity(number)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1080,18 +1080,31 @@ export default class ClientConnection {
|
|||
}
|
||||
|
||||
public async setExternalControlSerialPortConfig(
|
||||
config: SerialPortConfigEntity
|
||||
serial_port: SerialPortConfigEntity,
|
||||
tcp_address: string,
|
||||
tcp_port: number,
|
||||
udp_address: string,
|
||||
udp_port: number,
|
||||
current_type: string
|
||||
) {
|
||||
return await this.doRpc<Protocol.RpcSetExternalControlSerialPortConfigResponseEntity>(
|
||||
new Protocol.RpcSetExternalControlSerialPortConfigRequestEntity(config)
|
||||
new Protocol.RpcSetExternalControlSerialPortConfigRequestEntity(
|
||||
serial_port,
|
||||
tcp_address,
|
||||
tcp_port,
|
||||
udp_address,
|
||||
udp_port,
|
||||
current_type
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public callExternalControlData(uuid: string) {
|
||||
this.ws?.send(
|
||||
JSON.stringify(new Protocol.CallExternalControlDataRequestEntity(uuid))
|
||||
public async callExternalControlData(number: number) {
|
||||
return await this.doRpc<Protocol.RpcCallExternalControlDataResponseEntity>(
|
||||
new Protocol.RpcCallExternalControlDataRequestEntity(number)
|
||||
);
|
||||
}
|
||||
|
||||
public setEdgeBlendingPoint(point: EdgeBlendingPoint) {
|
||||
this.ws?.send(
|
||||
JSON.stringify(new Protocol.SetEdgeBlendingPointRequestEntity(point))
|
||||
|
|
|
@ -57,9 +57,9 @@
|
|||
:disable="loading"
|
||||
/>
|
||||
<q-tab
|
||||
name="serial_port_setting"
|
||||
name="connection_setting"
|
||||
no-caps
|
||||
:label="$t('serial port setting')"
|
||||
:label="$t('connection setting')"
|
||||
:disable="loading"
|
||||
/>
|
||||
</q-tabs>
|
||||
|
@ -90,7 +90,7 @@
|
|||
:label="buttons[(row - 1) * 4 + (col - 1)].name"
|
||||
@click="
|
||||
centerControlCommand(
|
||||
buttons[(row - 1) * 4 + (col - 1)].uuid
|
||||
buttons[(row - 1) * 4 + (col - 1)].number
|
||||
)
|
||||
"
|
||||
>
|
||||
|
@ -122,101 +122,232 @@
|
|||
</q-tab-panel>
|
||||
|
||||
<q-tab-panel
|
||||
name="serial_port_setting"
|
||||
name="connection_setting"
|
||||
class="q-pa-none q-ma-none fit"
|
||||
>
|
||||
<q-scroll-area style="height: 57vh">
|
||||
<q-list>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("baud rate") }}
|
||||
{{ $t("connection type") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.baud_rate"
|
||||
v-model="current_type"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
:options="[
|
||||
110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200,
|
||||
38400, 56000, 57600, 115200 /*, 2304000, 380400,
|
||||
{
|
||||
label: $t('serial port'),
|
||||
value: 'SERIAL_PORT',
|
||||
},
|
||||
{
|
||||
label: $t('tcp'),
|
||||
value: 'TCP',
|
||||
},
|
||||
{
|
||||
label: $t('udp'),
|
||||
value: 'UDP',
|
||||
},
|
||||
]"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
option-label="label"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<div v-if="current_type == 'SERIAL_PORT'">
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("baud rate") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.baud_rate"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
:options="[
|
||||
110, 300, 600, 1200, 2400, 4800, 9600, 14400,
|
||||
19200, 38400, 56000, 57600,
|
||||
115200 /*, 2304000, 380400,
|
||||
460800, 921600,*/,
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("character size") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.character_size"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
:options="[5, 6, 7, 8]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("parity") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.parity"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
option-label="label"
|
||||
:options="[
|
||||
{
|
||||
label: 'NONE',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'ODD',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: 'EVEN',
|
||||
value: 2,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("stop bits") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.stop_bits"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
option-label="label"
|
||||
:options="[
|
||||
{
|
||||
label: '1 Bit',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '1.5 Bit',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '2 Bit',
|
||||
value: 2,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("character size") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.character_size"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
:options="[5, 6, 7, 8]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("parity") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.parity"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
option-label="label"
|
||||
:options="[
|
||||
{
|
||||
label: 'NONE',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'ODD',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: 'EVEN',
|
||||
value: 2,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("stop bits") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-select
|
||||
v-model="serial_port_setting.stop_bits"
|
||||
:loading="loading"
|
||||
:disable="loading"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
option-label="label"
|
||||
:options="[
|
||||
{
|
||||
label: '1 Bit',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '1.5 Bit',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '2 Bit',
|
||||
value: 2,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
<div v-else-if="current_type == 'TCP'">
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("ip address") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-input
|
||||
v-model="tcp_address"
|
||||
:rules="[
|
||||
(val) =>
|
||||
(val && val.length > 0) ||
|
||||
$t('Please type something'),
|
||||
(val) =>
|
||||
isIpAddress(val) ||
|
||||
$t('Please input vaild ip address'),
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("port") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-input
|
||||
v-model="tcp_port"
|
||||
max="65535"
|
||||
min="1"
|
||||
:rules="[
|
||||
(val) =>
|
||||
(val != null &&
|
||||
val != undefined &&
|
||||
val.toString().length > 0) ||
|
||||
$t('Please type something'),
|
||||
(val) =>
|
||||
(parseInt(val) >= 1 &&
|
||||
parseInt(val) <= 65535) ||
|
||||
$t(
|
||||
'the port number must be between 1 and 65535'
|
||||
),
|
||||
]"
|
||||
maxlength="5"
|
||||
type="number"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
<div v-else-if="current_type == 'UDP'">
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("ip address") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-input
|
||||
v-model="udp_address"
|
||||
:rules="[
|
||||
(val) =>
|
||||
(val && val.length > 0) ||
|
||||
$t('Please type something'),
|
||||
(val) =>
|
||||
isIpAddress(val) ||
|
||||
$t('Please input vaild ip address'),
|
||||
]"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar class="header_label">
|
||||
{{ $t("port") }}
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-input
|
||||
v-model="udp_port"
|
||||
max="65535"
|
||||
min="1"
|
||||
:rules="[
|
||||
(val) =>
|
||||
(val != null &&
|
||||
val != undefined &&
|
||||
val.toString().length > 0) ||
|
||||
$t('Please type something'),
|
||||
(val) =>
|
||||
(parseInt(val) >= 1 &&
|
||||
parseInt(val) <= 65535) ||
|
||||
$t(
|
||||
'the port number must be between 1 and 65535'
|
||||
),
|
||||
]"
|
||||
maxlength="5"
|
||||
type="number"
|
||||
/>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span class="h2">{{ $t("unknow type") }}</span>
|
||||
</div>
|
||||
</q-list>
|
||||
</q-scroll-area>
|
||||
<q-separator />
|
||||
|
@ -229,7 +360,7 @@
|
|||
:label="$t('revert')"
|
||||
:loading="loading"
|
||||
color="primary"
|
||||
@click="onRevertSerialportConfig"
|
||||
@click="onRevertConfig"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
@ -239,7 +370,7 @@
|
|||
:label="$t('submit')"
|
||||
:loading="loading"
|
||||
color="primary"
|
||||
@click="onSubmitSerialportConfig"
|
||||
@click="onSubmitConfig"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -255,11 +386,7 @@
|
|||
|
||||
<style scoped>
|
||||
.header_label {
|
||||
width: 15%;
|
||||
}
|
||||
.header_label_2 {
|
||||
width: 15%;
|
||||
align-items: center;
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -278,6 +405,7 @@ import {
|
|||
ESerialPortStopBitsHelper,
|
||||
SerialPortConfigEntity,
|
||||
} from "src/entities/SerialPortConfigEntity";
|
||||
import { Protocol } from "src/entities/WSProtocol";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ComponentCenterControlDialog",
|
||||
|
@ -297,6 +425,21 @@ export default defineComponent({
|
|||
);
|
||||
const old_serial_port_setting = new SerialPortConfigEntity();
|
||||
|
||||
const current_type = ref("SERIAL_PORT");
|
||||
const tcp_address = ref("192.168.2.2");
|
||||
const tcp_port = ref("10000");
|
||||
const udp_address = ref("192.168.2.2");
|
||||
const udp_port = ref("10000");
|
||||
|
||||
let old_current_type = "SERIAL_PORT";
|
||||
let old_tcp_address = "192.168.2.2";
|
||||
let old_tcp_port = "10000";
|
||||
let old_udp_address = "192.168.2.2";
|
||||
let old_udp_port = "10000";
|
||||
|
||||
let old_response: Protocol.RpcGetExternalControlSerialPortConfigResponseEntity =
|
||||
new Protocol.RpcGetExternalControlSerialPortConfigResponseEntity();
|
||||
|
||||
const center_control_button_dialog: Ref<any> = ref(null);
|
||||
|
||||
return {
|
||||
|
@ -306,6 +449,11 @@ export default defineComponent({
|
|||
buttons,
|
||||
serial_port_setting,
|
||||
center_control_button_dialog,
|
||||
current_type,
|
||||
tcp_address,
|
||||
tcp_port,
|
||||
udp_address,
|
||||
udp_port,
|
||||
copyToClipboard,
|
||||
loga(a: any) {
|
||||
console.log(a);
|
||||
|
@ -336,20 +484,27 @@ export default defineComponent({
|
|||
.getCurrentClient()
|
||||
?.getExternalControlSerialPortConfig();
|
||||
if (response) {
|
||||
serial_port_setting.baud_rate = response.config.baud_rate;
|
||||
serial_port_setting.character_size = response.config.character_size;
|
||||
serial_port_setting.baud_rate = response.serial_port.baud_rate;
|
||||
serial_port_setting.character_size =
|
||||
response.serial_port.character_size;
|
||||
serial_port_setting.parity = ESerialPortParityHelper.fromString(
|
||||
(<unknown>response.config.parity) as string
|
||||
(<unknown>response.serial_port.parity) as string
|
||||
);
|
||||
serial_port_setting.stop_bits =
|
||||
ESerialPortStopBitsHelper.fromString(
|
||||
(<unknown>response.config.stop_bits) as string
|
||||
(<unknown>response.serial_port.stop_bits) as string
|
||||
);
|
||||
serial_port_setting.flow_control =
|
||||
ESerialPortFlowControlHelper.fromString(
|
||||
(<unknown>response.config.flow_control) as string
|
||||
(<unknown>response.serial_port.flow_control) as string
|
||||
);
|
||||
|
||||
current_type.value = response.current_type;
|
||||
tcp_address.value = response.tcp_address;
|
||||
tcp_port.value = response.tcp_port.toString();
|
||||
udp_address.value = response.udp_address;
|
||||
udp_port.value = response.udp_port.toString();
|
||||
|
||||
old_serial_port_setting.baud_rate = serial_port_setting.baud_rate;
|
||||
old_serial_port_setting.character_size =
|
||||
serial_port_setting.character_size;
|
||||
|
@ -357,6 +512,14 @@ export default defineComponent({
|
|||
old_serial_port_setting.stop_bits = serial_port_setting.stop_bits;
|
||||
old_serial_port_setting.flow_control =
|
||||
serial_port_setting.flow_control;
|
||||
|
||||
old_current_type = current_type.value;
|
||||
old_tcp_address = tcp_address.value;
|
||||
old_tcp_port = tcp_port.value;
|
||||
old_udp_address = udp_address.value;
|
||||
old_udp_port = udp_port.value;
|
||||
|
||||
old_response = response;
|
||||
}
|
||||
} catch {}
|
||||
|
||||
|
@ -366,41 +529,98 @@ export default defineComponent({
|
|||
loading.value = false;
|
||||
},
|
||||
|
||||
async onRevertSerialportConfig() {
|
||||
async onRevertConfig() {
|
||||
serial_port_setting.baud_rate = old_serial_port_setting.baud_rate;
|
||||
serial_port_setting.character_size =
|
||||
old_serial_port_setting.character_size;
|
||||
serial_port_setting.parity = old_serial_port_setting.parity;
|
||||
serial_port_setting.stop_bits = old_serial_port_setting.stop_bits;
|
||||
serial_port_setting.flow_control = old_serial_port_setting.flow_control;
|
||||
|
||||
tcp_address.value = old_tcp_address;
|
||||
tcp_port.value = old_tcp_port;
|
||||
|
||||
udp_address.value = old_udp_address;
|
||||
udp_port.value = old_udp_port;
|
||||
current_type.value = old_current_type;
|
||||
},
|
||||
|
||||
async onSubmitSerialportConfig() {
|
||||
async onSubmitConfig() {
|
||||
loading.value = true;
|
||||
let success = false;
|
||||
|
||||
let request_current_type = current_type.value;
|
||||
console.log(request_current_type);
|
||||
if (
|
||||
request_current_type != "SERIAL_PORT" &&
|
||||
request_current_type != "UDP" &&
|
||||
request_current_type != "TCP"
|
||||
) {
|
||||
request_current_type = "SERIAL_PORT";
|
||||
}
|
||||
|
||||
try {
|
||||
const request_param = new SerialPortConfigEntity();
|
||||
request_param.baud_rate = serial_port_setting.baud_rate;
|
||||
request_param.character_size = serial_port_setting.character_size;
|
||||
(<any>request_param.parity) = ESerialPortParityHelper.toString(
|
||||
serial_port_setting.parity
|
||||
);
|
||||
(<any>request_param.stop_bits) = ESerialPortStopBitsHelper.toString(
|
||||
serial_port_setting.stop_bits
|
||||
);
|
||||
(<any>request_param.flow_control) =
|
||||
ESerialPortFlowControlHelper.toString(
|
||||
serial_port_setting.flow_control
|
||||
);
|
||||
let request_serial_prot_config =
|
||||
old_response.serial_port ?? new SerialPortConfigEntity();
|
||||
let request_tcp_address = old_response.tcp_address ?? "192.168.2.2";
|
||||
let request_tcp_port = old_response.tcp_port ?? 1000;
|
||||
let request_udp_address = old_response.udp_address ?? "192.168.2.2";
|
||||
let request_udp_port = old_response.udp_port ?? 1000;
|
||||
|
||||
switch (request_current_type) {
|
||||
case "SERIAL_PORT":
|
||||
request_serial_prot_config.baud_rate =
|
||||
serial_port_setting.baud_rate;
|
||||
request_serial_prot_config.character_size =
|
||||
serial_port_setting.character_size;
|
||||
(<any>request_serial_prot_config.parity) =
|
||||
ESerialPortParityHelper.toString(serial_port_setting.parity);
|
||||
(<any>request_serial_prot_config.stop_bits) =
|
||||
ESerialPortStopBitsHelper.toString(
|
||||
serial_port_setting.stop_bits
|
||||
);
|
||||
(<any>request_serial_prot_config.flow_control) =
|
||||
ESerialPortFlowControlHelper.toString(
|
||||
serial_port_setting.flow_control
|
||||
);
|
||||
break;
|
||||
case "TCP":
|
||||
{
|
||||
request_tcp_address = tcp_address.value;
|
||||
const temp = parseInt(tcp_port.value);
|
||||
if (isNaN(temp)) {
|
||||
request_tcp_port = 1000;
|
||||
} else {
|
||||
request_tcp_port = temp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "UDP":
|
||||
{
|
||||
request_udp_address = udp_address.value;
|
||||
const temp = parseInt(udp_port.value);
|
||||
if (isNaN(temp)) {
|
||||
request_udp_port = 1000;
|
||||
} else {
|
||||
request_udp_port = temp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const response = await GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.setExternalControlSerialPortConfig(request_param);
|
||||
?.setExternalControlSerialPortConfig(
|
||||
request_serial_prot_config,
|
||||
request_tcp_address,
|
||||
request_tcp_port,
|
||||
request_udp_address,
|
||||
request_udp_port,
|
||||
request_current_type
|
||||
);
|
||||
|
||||
if (response) {
|
||||
success = response.success;
|
||||
console.log(response);
|
||||
console.log(success);
|
||||
|
||||
old_serial_port_setting.baud_rate = serial_port_setting.baud_rate;
|
||||
old_serial_port_setting.character_size =
|
||||
|
@ -409,6 +629,13 @@ export default defineComponent({
|
|||
old_serial_port_setting.stop_bits = serial_port_setting.stop_bits;
|
||||
old_serial_port_setting.flow_control =
|
||||
serial_port_setting.flow_control;
|
||||
|
||||
old_current_type = current_type.value;
|
||||
old_tcp_address = tcp_address.value;
|
||||
old_tcp_port = tcp_port.value;
|
||||
old_udp_address = udp_address.value;
|
||||
old_udp_port = udp_port.value;
|
||||
old_current_type = current_type.value;
|
||||
}
|
||||
} catch {}
|
||||
|
||||
|
@ -424,19 +651,38 @@ export default defineComponent({
|
|||
});
|
||||
loading.value = false;
|
||||
},
|
||||
centerControlCommand(uuid?: string) {
|
||||
if (uuid) {
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.callExternalControlData(uuid);
|
||||
$q.notify({
|
||||
color: "positive",
|
||||
icon: "done",
|
||||
message: $t.t("send command") + $t.t("success") + "!",
|
||||
position: "top",
|
||||
timeout: 1500,
|
||||
});
|
||||
async centerControlCommand(number?: number) {
|
||||
let success = false;
|
||||
try {
|
||||
if (
|
||||
typeof number != "undefined" &&
|
||||
number != null &&
|
||||
!isNaN(number)
|
||||
) {
|
||||
const resposne = await GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.callExternalControlData(number);
|
||||
|
||||
if (resposne) {
|
||||
success = resposne.success;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
$q.notify({
|
||||
color: success ? "positive" : "negative",
|
||||
icon: success ? "done" : "warning",
|
||||
message:
|
||||
$t.t("send command") +
|
||||
$t.t(success ? "success" : "failed") +
|
||||
(success
|
||||
? ""
|
||||
: "," + $t.t(" ") + $t.t("please check connection config")) +
|
||||
"!",
|
||||
position: "top",
|
||||
timeout: 2500,
|
||||
});
|
||||
},
|
||||
async editCenterControlButton(data?: ExternalControlTableEntity) {
|
||||
if (data) {
|
||||
|
@ -487,6 +733,14 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
},
|
||||
isIpAddress(str: string) {
|
||||
return (
|
||||
str == "localhost" ||
|
||||
/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(
|
||||
str
|
||||
)
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
@ -380,14 +380,14 @@ export namespace Protocol {
|
|||
public static get kRpcAddExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcAddExternalControlData";
|
||||
}
|
||||
public static get kCallExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "CallExternalControlData";
|
||||
public static get kRpcCallExternalControlData() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcCallExternalControlData";
|
||||
}
|
||||
public static get kRpcGetExternalControlSerialPortConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlSerialPortConfig";
|
||||
public static get kRpcGetExternalControlConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlConfig";
|
||||
}
|
||||
public static get kRpcSetExternalControlSerialPortConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcSetExternalControlSerialPortConfig";
|
||||
public static get kRpcSetExternalControlConfig() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcSetExternalControlConfig";
|
||||
}
|
||||
public static get kRpcGetConnectionList() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetConnectionList";
|
||||
|
@ -555,9 +555,9 @@ export namespace Protocol {
|
|||
Commands.kRpcDeleteExternalControlData,
|
||||
Commands.kRpcEditExternalControlData,
|
||||
Commands.kRpcAddExternalControlData,
|
||||
Commands.kCallExternalControlData,
|
||||
Commands.kRpcGetExternalControlSerialPortConfig,
|
||||
Commands.kRpcSetExternalControlSerialPortConfig,
|
||||
Commands.kRpcCallExternalControlData,
|
||||
Commands.kRpcGetExternalControlConfig,
|
||||
Commands.kRpcSetExternalControlConfig,
|
||||
Commands.kRpcGetConnectionList,
|
||||
Commands.kRpcSetConnectionItem,
|
||||
Commands.kWindowFullScreen,
|
||||
|
@ -2426,15 +2426,15 @@ export namespace Protocol {
|
|||
}
|
||||
|
||||
export class RpcDeleteExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(uuid: string, rpc_id = 0) {
|
||||
constructor(number: number, rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
this.uuid = uuid;
|
||||
this.number = number ?? -1;
|
||||
}
|
||||
|
||||
uuid = "";
|
||||
number = -1;
|
||||
}
|
||||
|
||||
export class RpcDeleteExternalControlDataResponseEntity extends PacketEntity {
|
||||
|
@ -2513,7 +2513,7 @@ export namespace Protocol {
|
|||
export class ExternalControlDataAddNotifyEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.command = Commands.kRpcDeleteExternalControlData;
|
||||
super.command = Commands.kRpcAddExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_NOTIFY;
|
||||
super.rpc_id = 0;
|
||||
}
|
||||
|
@ -2521,22 +2521,31 @@ export namespace Protocol {
|
|||
entity = new ExternalControlTableEntity();
|
||||
}
|
||||
|
||||
export class CallExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(uuid: string) {
|
||||
export class RpcCallExternalControlDataRequestEntity extends PacketEntity {
|
||||
constructor(number: number) {
|
||||
super();
|
||||
super.command = Commands.kCallExternalControlData;
|
||||
super.command = Commands.kRpcCallExternalControlData;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = 0;
|
||||
this.uuid = uuid;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
uuid: string;
|
||||
number: number;
|
||||
}
|
||||
|
||||
export class RpcCallExternalControlDataResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
|
||||
success: boolean = false;
|
||||
}
|
||||
|
||||
export class RpcGetExternalControlSerialPortConfigRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcGetExternalControlSerialPortConfig;
|
||||
super.command = Commands.kRpcGetExternalControlConfig;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
|
@ -2550,19 +2559,42 @@ export namespace Protocol {
|
|||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
|
||||
config = new SerialPortConfigEntity();
|
||||
serial_port = new SerialPortConfigEntity();
|
||||
tcp_address = "192.168.2.2";
|
||||
tcp_port = 1000;
|
||||
udp_address = "192.168.2.2";
|
||||
udp_port = 1000;
|
||||
current_type = "SERIAL_PORT";
|
||||
}
|
||||
|
||||
export class RpcSetExternalControlSerialPortConfigRequestEntity extends PacketEntity {
|
||||
constructor(config: SerialPortConfigEntity, rpc_id = 0) {
|
||||
constructor(
|
||||
serial_port: SerialPortConfigEntity,
|
||||
tcp_address: string,
|
||||
tcp_port: number,
|
||||
udp_address: string,
|
||||
udp_port: number,
|
||||
current_type: string,
|
||||
rpc_id = 0
|
||||
) {
|
||||
super();
|
||||
super.command = Commands.kRpcSetExternalControlSerialPortConfig;
|
||||
super.command = Commands.kRpcSetExternalControlConfig;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
this.config = config;
|
||||
this.serial_port = serial_port ?? new SerialPortConfigEntity();
|
||||
this.tcp_address = tcp_address ?? "192.168.2.2";
|
||||
this.tcp_port = tcp_port ?? 1000;
|
||||
this.udp_address = udp_address ?? "192.168.2.2";
|
||||
this.udp_port = udp_port ?? 1000;
|
||||
this.current_type = current_type ?? "SERIAL_PORT";
|
||||
}
|
||||
|
||||
config: SerialPortConfigEntity;
|
||||
serial_port = new SerialPortConfigEntity();
|
||||
tcp_address = "192.168.2.2";
|
||||
tcp_port = 1000;
|
||||
udp_address = "192.168.2.2";
|
||||
udp_port = 1000;
|
||||
current_type = "SERIAL_PORT";
|
||||
}
|
||||
|
||||
export class RpcSetExternalControlSerialPortConfigResponseEntity extends PacketEntity {
|
||||
|
|
|
@ -376,4 +376,11 @@ export default {
|
|||
"row multiply column should be less than or equal to ":
|
||||
"Row Multiply Column Should Be Less Than Or Equal To ",
|
||||
"please select window rotation": "Please Select Window Rotation",
|
||||
"send command": "Send Command",
|
||||
"please check connection config": "Please Check Connection Config",
|
||||
"connection setting": "Connection Setting",
|
||||
"connection type": "Connection Type",
|
||||
tcp: "TCP",
|
||||
udp: "UDP",
|
||||
"serial port": "Serial Port",
|
||||
};
|
||||
|
|
|
@ -648,4 +648,10 @@ export default {
|
|||
"row multiply column should be less than or equal to ":
|
||||
"行乘以列的值不能大于",
|
||||
"please select window rotation": "请选择窗口旋转",
|
||||
"please check connection config": "请检查连接配置",
|
||||
"connection setting": "连接设置",
|
||||
"connection type": "连接类型",
|
||||
tcp: "TCP",
|
||||
udp: "UDP",
|
||||
"serial port": "串口",
|
||||
};
|
||||
|
|
|
@ -8890,10 +8890,10 @@ qs@6.9.6:
|
|||
resolved "https://registry.npmmirror.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee"
|
||||
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
|
||||
|
||||
quasar@^2.10.0:
|
||||
version "2.10.0"
|
||||
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.10.0.tgz#c9af5adad0d7ebe8f14c61c5403c943e7c935453"
|
||||
integrity sha512-PHGcrzPQfFa4tv9a5Z/3D2uat48D4WC9Ad/imzHk/k3G41t0eFMH6glCjAvpCWF2q8dBYIg4nEchiPhlujbKsw==
|
||||
quasar@^2.10.1:
|
||||
version "2.10.1"
|
||||
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.10.1.tgz#843888c73d997a53b3808d7f4f358b1aee3a91f2"
|
||||
integrity sha512-W0SEbTdfFS4xvO5OyTyuJent+11MpjBJUYLga69ZFigRh7SV6wFpGNfCuxAifM0L83bp4rWrL2KGoIjEoDsjOw==
|
||||
|
||||
query-string@^5.0.1:
|
||||
version "5.1.1"
|
||||
|
|
Loading…
Reference in New Issue