中控添加TCP连接和UDP连接功能
This commit is contained in:
parent
0032e8c17c
commit
8f7ed9e39f
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "media_player_client",
|
"name": "media_player_client",
|
||||||
"version": "1.5.4",
|
"version": "1.5.5",
|
||||||
"description": "A Quasar Framework app",
|
"description": "A Quasar Framework app",
|
||||||
"productName": "MediaPlayerClient",
|
"productName": "MediaPlayerClient",
|
||||||
"author": "fangxiang <fangxiang@cloudview.work>",
|
"author": "fangxiang <fangxiang@cloudview.work>",
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
"core-js": "^3.21.0",
|
"core-js": "^3.21.0",
|
||||||
"element-resize-detector": "^1.2.4",
|
"element-resize-detector": "^1.2.4",
|
||||||
"qrcode.vue": "^3.3.3",
|
"qrcode.vue": "^3.3.3",
|
||||||
"quasar": "^2.10.0",
|
"quasar": "^2.10.1",
|
||||||
"reconnecting-websocket": "^4.4.0",
|
"reconnecting-websocket": "^4.4.0",
|
||||||
"sortablejs": "^1.15.0",
|
"sortablejs": "^1.15.0",
|
||||||
"to": "^0.2.9",
|
"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>(
|
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(
|
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>(
|
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) {
|
public async callExternalControlData(number: number) {
|
||||||
this.ws?.send(
|
return await this.doRpc<Protocol.RpcCallExternalControlDataResponseEntity>(
|
||||||
JSON.stringify(new Protocol.CallExternalControlDataRequestEntity(uuid))
|
new Protocol.RpcCallExternalControlDataRequestEntity(number)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setEdgeBlendingPoint(point: EdgeBlendingPoint) {
|
public setEdgeBlendingPoint(point: EdgeBlendingPoint) {
|
||||||
this.ws?.send(
|
this.ws?.send(
|
||||||
JSON.stringify(new Protocol.SetEdgeBlendingPointRequestEntity(point))
|
JSON.stringify(new Protocol.SetEdgeBlendingPointRequestEntity(point))
|
||||||
|
|
|
@ -57,9 +57,9 @@
|
||||||
:disable="loading"
|
:disable="loading"
|
||||||
/>
|
/>
|
||||||
<q-tab
|
<q-tab
|
||||||
name="serial_port_setting"
|
name="connection_setting"
|
||||||
no-caps
|
no-caps
|
||||||
:label="$t('serial port setting')"
|
:label="$t('connection setting')"
|
||||||
:disable="loading"
|
:disable="loading"
|
||||||
/>
|
/>
|
||||||
</q-tabs>
|
</q-tabs>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
:label="buttons[(row - 1) * 4 + (col - 1)].name"
|
:label="buttons[(row - 1) * 4 + (col - 1)].name"
|
||||||
@click="
|
@click="
|
||||||
centerControlCommand(
|
centerControlCommand(
|
||||||
buttons[(row - 1) * 4 + (col - 1)].uuid
|
buttons[(row - 1) * 4 + (col - 1)].number
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -122,11 +122,43 @@
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
||||||
<q-tab-panel
|
<q-tab-panel
|
||||||
name="serial_port_setting"
|
name="connection_setting"
|
||||||
class="q-pa-none q-ma-none fit"
|
class="q-pa-none q-ma-none fit"
|
||||||
>
|
>
|
||||||
<q-scroll-area style="height: 57vh">
|
<q-scroll-area style="height: 57vh">
|
||||||
<q-list>
|
<q-list>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section avatar class="header_label">
|
||||||
|
{{ $t("connection type") }}
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-select
|
||||||
|
v-model="current_type"
|
||||||
|
:loading="loading"
|
||||||
|
:disable="loading"
|
||||||
|
:options="[
|
||||||
|
{
|
||||||
|
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>
|
||||||
<q-item-section avatar class="header_label">
|
<q-item-section avatar class="header_label">
|
||||||
{{ $t("baud rate") }}
|
{{ $t("baud rate") }}
|
||||||
|
@ -137,8 +169,9 @@
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:disable="loading"
|
:disable="loading"
|
||||||
:options="[
|
:options="[
|
||||||
110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200,
|
110, 300, 600, 1200, 2400, 4800, 9600, 14400,
|
||||||
38400, 56000, 57600, 115200 /*, 2304000, 380400,
|
19200, 38400, 56000, 57600,
|
||||||
|
115200 /*, 2304000, 380400,
|
||||||
460800, 921600,*/,
|
460800, 921600,*/,
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
|
@ -217,6 +250,104 @@
|
||||||
/>
|
/>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</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-list>
|
||||||
</q-scroll-area>
|
</q-scroll-area>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
@ -229,7 +360,7 @@
|
||||||
:label="$t('revert')"
|
:label="$t('revert')"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="onRevertSerialportConfig"
|
@click="onRevertConfig"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|
@ -239,7 +370,7 @@
|
||||||
:label="$t('submit')"
|
:label="$t('submit')"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="onSubmitSerialportConfig"
|
@click="onSubmitConfig"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -255,11 +386,7 @@
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.header_label {
|
.header_label {
|
||||||
width: 15%;
|
width: 20%;
|
||||||
}
|
|
||||||
.header_label_2 {
|
|
||||||
width: 15%;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -278,6 +405,7 @@ import {
|
||||||
ESerialPortStopBitsHelper,
|
ESerialPortStopBitsHelper,
|
||||||
SerialPortConfigEntity,
|
SerialPortConfigEntity,
|
||||||
} from "src/entities/SerialPortConfigEntity";
|
} from "src/entities/SerialPortConfigEntity";
|
||||||
|
import { Protocol } from "src/entities/WSProtocol";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentCenterControlDialog",
|
name: "ComponentCenterControlDialog",
|
||||||
|
@ -297,6 +425,21 @@ export default defineComponent({
|
||||||
);
|
);
|
||||||
const old_serial_port_setting = new SerialPortConfigEntity();
|
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);
|
const center_control_button_dialog: Ref<any> = ref(null);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -306,6 +449,11 @@ export default defineComponent({
|
||||||
buttons,
|
buttons,
|
||||||
serial_port_setting,
|
serial_port_setting,
|
||||||
center_control_button_dialog,
|
center_control_button_dialog,
|
||||||
|
current_type,
|
||||||
|
tcp_address,
|
||||||
|
tcp_port,
|
||||||
|
udp_address,
|
||||||
|
udp_port,
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
loga(a: any) {
|
loga(a: any) {
|
||||||
console.log(a);
|
console.log(a);
|
||||||
|
@ -336,20 +484,27 @@ export default defineComponent({
|
||||||
.getCurrentClient()
|
.getCurrentClient()
|
||||||
?.getExternalControlSerialPortConfig();
|
?.getExternalControlSerialPortConfig();
|
||||||
if (response) {
|
if (response) {
|
||||||
serial_port_setting.baud_rate = response.config.baud_rate;
|
serial_port_setting.baud_rate = response.serial_port.baud_rate;
|
||||||
serial_port_setting.character_size = response.config.character_size;
|
serial_port_setting.character_size =
|
||||||
|
response.serial_port.character_size;
|
||||||
serial_port_setting.parity = ESerialPortParityHelper.fromString(
|
serial_port_setting.parity = ESerialPortParityHelper.fromString(
|
||||||
(<unknown>response.config.parity) as string
|
(<unknown>response.serial_port.parity) as string
|
||||||
);
|
);
|
||||||
serial_port_setting.stop_bits =
|
serial_port_setting.stop_bits =
|
||||||
ESerialPortStopBitsHelper.fromString(
|
ESerialPortStopBitsHelper.fromString(
|
||||||
(<unknown>response.config.stop_bits) as string
|
(<unknown>response.serial_port.stop_bits) as string
|
||||||
);
|
);
|
||||||
serial_port_setting.flow_control =
|
serial_port_setting.flow_control =
|
||||||
ESerialPortFlowControlHelper.fromString(
|
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.baud_rate = serial_port_setting.baud_rate;
|
||||||
old_serial_port_setting.character_size =
|
old_serial_port_setting.character_size =
|
||||||
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.stop_bits = serial_port_setting.stop_bits;
|
||||||
old_serial_port_setting.flow_control =
|
old_serial_port_setting.flow_control =
|
||||||
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 {}
|
} catch {}
|
||||||
|
|
||||||
|
@ -366,41 +529,98 @@ export default defineComponent({
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
async onRevertSerialportConfig() {
|
async onRevertConfig() {
|
||||||
serial_port_setting.baud_rate = old_serial_port_setting.baud_rate;
|
serial_port_setting.baud_rate = old_serial_port_setting.baud_rate;
|
||||||
serial_port_setting.character_size =
|
serial_port_setting.character_size =
|
||||||
old_serial_port_setting.character_size;
|
old_serial_port_setting.character_size;
|
||||||
serial_port_setting.parity = old_serial_port_setting.parity;
|
serial_port_setting.parity = old_serial_port_setting.parity;
|
||||||
serial_port_setting.stop_bits = old_serial_port_setting.stop_bits;
|
serial_port_setting.stop_bits = old_serial_port_setting.stop_bits;
|
||||||
serial_port_setting.flow_control = old_serial_port_setting.flow_control;
|
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;
|
loading.value = true;
|
||||||
let success = false;
|
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 {
|
try {
|
||||||
const request_param = new SerialPortConfigEntity();
|
let request_serial_prot_config =
|
||||||
request_param.baud_rate = serial_port_setting.baud_rate;
|
old_response.serial_port ?? new SerialPortConfigEntity();
|
||||||
request_param.character_size = serial_port_setting.character_size;
|
let request_tcp_address = old_response.tcp_address ?? "192.168.2.2";
|
||||||
(<any>request_param.parity) = ESerialPortParityHelper.toString(
|
let request_tcp_port = old_response.tcp_port ?? 1000;
|
||||||
serial_port_setting.parity
|
let request_udp_address = old_response.udp_address ?? "192.168.2.2";
|
||||||
);
|
let request_udp_port = old_response.udp_port ?? 1000;
|
||||||
(<any>request_param.stop_bits) = ESerialPortStopBitsHelper.toString(
|
|
||||||
|
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
|
serial_port_setting.stop_bits
|
||||||
);
|
);
|
||||||
(<any>request_param.flow_control) =
|
(<any>request_serial_prot_config.flow_control) =
|
||||||
ESerialPortFlowControlHelper.toString(
|
ESerialPortFlowControlHelper.toString(
|
||||||
serial_port_setting.flow_control
|
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()
|
const response = await GlobalData.getInstance()
|
||||||
.getCurrentClient()
|
.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) {
|
if (response) {
|
||||||
success = response.success;
|
success = response.success;
|
||||||
console.log(response);
|
|
||||||
console.log(success);
|
|
||||||
|
|
||||||
old_serial_port_setting.baud_rate = serial_port_setting.baud_rate;
|
old_serial_port_setting.baud_rate = serial_port_setting.baud_rate;
|
||||||
old_serial_port_setting.character_size =
|
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.stop_bits = serial_port_setting.stop_bits;
|
||||||
old_serial_port_setting.flow_control =
|
old_serial_port_setting.flow_control =
|
||||||
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 {}
|
} catch {}
|
||||||
|
|
||||||
|
@ -424,19 +651,38 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
},
|
},
|
||||||
centerControlCommand(uuid?: string) {
|
async centerControlCommand(number?: number) {
|
||||||
if (uuid) {
|
let success = false;
|
||||||
GlobalData.getInstance()
|
try {
|
||||||
|
if (
|
||||||
|
typeof number != "undefined" &&
|
||||||
|
number != null &&
|
||||||
|
!isNaN(number)
|
||||||
|
) {
|
||||||
|
const resposne = await GlobalData.getInstance()
|
||||||
.getCurrentClient()
|
.getCurrentClient()
|
||||||
?.callExternalControlData(uuid);
|
?.callExternalControlData(number);
|
||||||
$q.notify({
|
|
||||||
color: "positive",
|
if (resposne) {
|
||||||
icon: "done",
|
success = resposne.success;
|
||||||
message: $t.t("send command") + $t.t("success") + "!",
|
|
||||||
position: "top",
|
|
||||||
timeout: 1500,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} 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) {
|
async editCenterControlButton(data?: ExternalControlTableEntity) {
|
||||||
if (data) {
|
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() {
|
public static get kRpcAddExternalControlData() {
|
||||||
return Commands.PROTOCOL_PREFIX + "RpcAddExternalControlData";
|
return Commands.PROTOCOL_PREFIX + "RpcAddExternalControlData";
|
||||||
}
|
}
|
||||||
public static get kCallExternalControlData() {
|
public static get kRpcCallExternalControlData() {
|
||||||
return Commands.PROTOCOL_PREFIX + "CallExternalControlData";
|
return Commands.PROTOCOL_PREFIX + "RpcCallExternalControlData";
|
||||||
}
|
}
|
||||||
public static get kRpcGetExternalControlSerialPortConfig() {
|
public static get kRpcGetExternalControlConfig() {
|
||||||
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlSerialPortConfig";
|
return Commands.PROTOCOL_PREFIX + "RpcGetExternalControlConfig";
|
||||||
}
|
}
|
||||||
public static get kRpcSetExternalControlSerialPortConfig() {
|
public static get kRpcSetExternalControlConfig() {
|
||||||
return Commands.PROTOCOL_PREFIX + "RpcSetExternalControlSerialPortConfig";
|
return Commands.PROTOCOL_PREFIX + "RpcSetExternalControlConfig";
|
||||||
}
|
}
|
||||||
public static get kRpcGetConnectionList() {
|
public static get kRpcGetConnectionList() {
|
||||||
return Commands.PROTOCOL_PREFIX + "RpcGetConnectionList";
|
return Commands.PROTOCOL_PREFIX + "RpcGetConnectionList";
|
||||||
|
@ -555,9 +555,9 @@ export namespace Protocol {
|
||||||
Commands.kRpcDeleteExternalControlData,
|
Commands.kRpcDeleteExternalControlData,
|
||||||
Commands.kRpcEditExternalControlData,
|
Commands.kRpcEditExternalControlData,
|
||||||
Commands.kRpcAddExternalControlData,
|
Commands.kRpcAddExternalControlData,
|
||||||
Commands.kCallExternalControlData,
|
Commands.kRpcCallExternalControlData,
|
||||||
Commands.kRpcGetExternalControlSerialPortConfig,
|
Commands.kRpcGetExternalControlConfig,
|
||||||
Commands.kRpcSetExternalControlSerialPortConfig,
|
Commands.kRpcSetExternalControlConfig,
|
||||||
Commands.kRpcGetConnectionList,
|
Commands.kRpcGetConnectionList,
|
||||||
Commands.kRpcSetConnectionItem,
|
Commands.kRpcSetConnectionItem,
|
||||||
Commands.kWindowFullScreen,
|
Commands.kWindowFullScreen,
|
||||||
|
@ -2426,15 +2426,15 @@ export namespace Protocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RpcDeleteExternalControlDataRequestEntity extends PacketEntity {
|
export class RpcDeleteExternalControlDataRequestEntity extends PacketEntity {
|
||||||
constructor(uuid: string, rpc_id = 0) {
|
constructor(number: number, rpc_id = 0) {
|
||||||
super();
|
super();
|
||||||
super.command = Commands.kRpcDeleteExternalControlData;
|
super.command = Commands.kRpcDeleteExternalControlData;
|
||||||
super.flag = PacketEntity.FLAG_REQUEST;
|
super.flag = PacketEntity.FLAG_REQUEST;
|
||||||
super.rpc_id = rpc_id;
|
super.rpc_id = rpc_id;
|
||||||
this.uuid = uuid;
|
this.number = number ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuid = "";
|
number = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RpcDeleteExternalControlDataResponseEntity extends PacketEntity {
|
export class RpcDeleteExternalControlDataResponseEntity extends PacketEntity {
|
||||||
|
@ -2513,7 +2513,7 @@ export namespace Protocol {
|
||||||
export class ExternalControlDataAddNotifyEntity extends PacketEntity {
|
export class ExternalControlDataAddNotifyEntity extends PacketEntity {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
super.command = Commands.kRpcDeleteExternalControlData;
|
super.command = Commands.kRpcAddExternalControlData;
|
||||||
super.flag = PacketEntity.FLAG_NOTIFY;
|
super.flag = PacketEntity.FLAG_NOTIFY;
|
||||||
super.rpc_id = 0;
|
super.rpc_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -2521,22 +2521,31 @@ export namespace Protocol {
|
||||||
entity = new ExternalControlTableEntity();
|
entity = new ExternalControlTableEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CallExternalControlDataRequestEntity extends PacketEntity {
|
export class RpcCallExternalControlDataRequestEntity extends PacketEntity {
|
||||||
constructor(uuid: string) {
|
constructor(number: number) {
|
||||||
super();
|
super();
|
||||||
super.command = Commands.kCallExternalControlData;
|
super.command = Commands.kRpcCallExternalControlData;
|
||||||
super.flag = PacketEntity.FLAG_REQUEST;
|
super.flag = PacketEntity.FLAG_REQUEST;
|
||||||
super.rpc_id = 0;
|
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 {
|
export class RpcGetExternalControlSerialPortConfigRequestEntity extends PacketEntity {
|
||||||
constructor(rpc_id = 0) {
|
constructor(rpc_id = 0) {
|
||||||
super();
|
super();
|
||||||
super.command = Commands.kRpcGetExternalControlSerialPortConfig;
|
super.command = Commands.kRpcGetExternalControlConfig;
|
||||||
super.flag = PacketEntity.FLAG_REQUEST;
|
super.flag = PacketEntity.FLAG_REQUEST;
|
||||||
super.rpc_id = rpc_id;
|
super.rpc_id = rpc_id;
|
||||||
}
|
}
|
||||||
|
@ -2550,19 +2559,42 @@ export namespace Protocol {
|
||||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
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 {
|
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();
|
||||||
super.command = Commands.kRpcSetExternalControlSerialPortConfig;
|
super.command = Commands.kRpcSetExternalControlConfig;
|
||||||
super.flag = PacketEntity.FLAG_REQUEST;
|
super.flag = PacketEntity.FLAG_REQUEST;
|
||||||
super.rpc_id = rpc_id;
|
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 {
|
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 ":
|
||||||
"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",
|
"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 ":
|
"row multiply column should be less than or equal to ":
|
||||||
"行乘以列的值不能大于",
|
"行乘以列的值不能大于",
|
||||||
"please select window rotation": "请选择窗口旋转",
|
"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"
|
resolved "https://registry.npmmirror.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee"
|
||||||
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
|
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
|
||||||
|
|
||||||
quasar@^2.10.0:
|
quasar@^2.10.1:
|
||||||
version "2.10.0"
|
version "2.10.1"
|
||||||
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.10.0.tgz#c9af5adad0d7ebe8f14c61c5403c943e7c935453"
|
resolved "https://registry.npmmirror.com/quasar/-/quasar-2.10.1.tgz#843888c73d997a53b3808d7f4f358b1aee3a91f2"
|
||||||
integrity sha512-PHGcrzPQfFa4tv9a5Z/3D2uat48D4WC9Ad/imzHk/k3G41t0eFMH6glCjAvpCWF2q8dBYIg4nEchiPhlujbKsw==
|
integrity sha512-W0SEbTdfFS4xvO5OyTyuJent+11MpjBJUYLga69ZFigRh7SV6wFpGNfCuxAifM0L83bp4rWrL2KGoIjEoDsjOw==
|
||||||
|
|
||||||
query-string@^5.0.1:
|
query-string@^5.0.1:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
|
|
Loading…
Reference in New Issue