fix: 前后端修复七段数码管无法正常工作的问题
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
toFileParameterOrUndefined,
|
||||
} from "@/utils/Common";
|
||||
import { AuthManager } from "@/utils/AuthManager";
|
||||
import { HubConnection } from "@microsoft/signalr";
|
||||
import { HubConnection, HubConnectionState } from "@microsoft/signalr";
|
||||
import {
|
||||
getHubProxyFactory,
|
||||
getReceiverRegister,
|
||||
@@ -220,7 +220,6 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
|
||||
async function matrixKeypadSetKeyStates(keyStates: boolean[]) {
|
||||
const release = await matrixKeypadClientMutex.acquire();
|
||||
console.log("set Key !!!!!!!!!!!!");
|
||||
try {
|
||||
const matrixKeypadClient =
|
||||
AuthManager.createAuthenticatedMatrixKeyClient();
|
||||
@@ -241,9 +240,9 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
async function matrixKeypadEnable(enable: boolean) {
|
||||
const release = await matrixKeypadClientMutex.acquire();
|
||||
try {
|
||||
const matrixKeypadClient =
|
||||
AuthManager.createAuthenticatedMatrixKeyClient();
|
||||
if (enable) {
|
||||
const matrixKeypadClient =
|
||||
AuthManager.createAuthenticatedMatrixKeyClient();
|
||||
const resp = await matrixKeypadClient.enabelMatrixKey(
|
||||
boardAddr.value,
|
||||
boardPort.value,
|
||||
@@ -251,8 +250,6 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
enableMatrixKey.value = resp;
|
||||
return resp;
|
||||
} else {
|
||||
const matrixKeypadClient =
|
||||
AuthManager.createAuthenticatedMatrixKeyClient();
|
||||
const resp = await matrixKeypadClient.disableMatrixKey(
|
||||
boardAddr.value,
|
||||
boardPort.value,
|
||||
@@ -305,7 +302,8 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
async function sevenSegmentDisplaySetOnOff(enable: boolean) {
|
||||
if (!sevenSegmentDisplayHub.value || !sevenSegmentDisplayHubProxy.value)
|
||||
return;
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
if (sevenSegmentDisplayHub.value.state === HubConnectionState.Disconnected)
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
|
||||
if (enable) {
|
||||
await sevenSegmentDisplayHubProxy.value.startScan();
|
||||
@@ -317,7 +315,8 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
async function sevenSegmentDisplaySetFrequency(frequency: number) {
|
||||
if (!sevenSegmentDisplayHub.value || !sevenSegmentDisplayHubProxy.value)
|
||||
return;
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
if (sevenSegmentDisplayHub.value.state === HubConnectionState.Disconnected)
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
|
||||
await sevenSegmentDisplayHubProxy.value.setFrequency(frequency);
|
||||
}
|
||||
@@ -325,7 +324,8 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
async function sevenSegmentDisplayGetStatus() {
|
||||
if (!sevenSegmentDisplayHub.value || !sevenSegmentDisplayHubProxy.value)
|
||||
return;
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
if (sevenSegmentDisplayHub.value.state === HubConnectionState.Disconnected)
|
||||
await sevenSegmentDisplayHub.value.start();
|
||||
|
||||
return await sevenSegmentDisplayHubProxy.value.getStatus();
|
||||
}
|
||||
@@ -338,7 +338,7 @@ export const useEquipments = defineStore("equipments", () => {
|
||||
onMounted(async () => {
|
||||
// 每次挂载都重新创建连接
|
||||
sevenSegmentDisplayHub.value =
|
||||
AuthManager.createAuthenticatedJtagHubConnection();
|
||||
AuthManager.createAuthenticatedDigitalTubesHubConnection();
|
||||
sevenSegmentDisplayHubProxy.value = getHubProxyFactory(
|
||||
"IDigitalTubesHub",
|
||||
).createHubProxy(sevenSegmentDisplayHub.value);
|
||||
|
||||
Reference in New Issue
Block a user