From 2e9e378457ab3e314024169142c22b6a044ade16 Mon Sep 17 00:00:00 2001 From: alivender <13898766233@163.com> Date: Fri, 1 Aug 2025 20:21:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E9=83=A8=E5=88=86jta?= =?UTF-8?q?g=E8=BE=B9=E7=95=8C=E6=89=AB=E6=8F=8Fwebsocket=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/Hubs/JtagHub.cs | 3 +++ server/src/Peripherals/JtagClient.cs | 2 +- server/src/UdpClientPool.cs | 2 +- src/components/equipments/MotherBoardCaps.vue | 1 - src/stores/equipments.ts | 5 +++-- src/views/Project/Index.vue | 4 ++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/server/src/Hubs/JtagHub.cs b/server/src/Hubs/JtagHub.cs index 0568585..7647043 100644 --- a/server/src/Hubs/JtagHub.cs +++ b/server/src/Hubs/JtagHub.cs @@ -1,4 +1,6 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Mvc; using System.Security.Claims; using Microsoft.AspNetCore.SignalR; using DotNext; @@ -23,6 +25,7 @@ public interface IJtagReceiver } [Authorize] +[EnableCors("Users")] public class JtagHub : Hub, IJtagHub { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); diff --git a/server/src/Peripherals/JtagClient.cs b/server/src/Peripherals/JtagClient.cs index d2a7f8e..c8cbea2 100644 --- a/server/src/Peripherals/JtagClient.cs +++ b/server/src/Peripherals/JtagClient.cs @@ -439,7 +439,7 @@ public class Jtag if (retPackLen != 4) return new(new Exception($"RecvDataPackage BodyData Length not Equal to 4: Total {retPackLen} bytes")); - return Convert.ToUInt32(Common.Number.BytesToUInt64(retPackOpts.Data).Value); + return Convert.ToUInt32(Common.Number.BytesToUInt32(retPackOpts.Data).Value); } async ValueTask> WriteFIFO diff --git a/server/src/UdpClientPool.cs b/server/src/UdpClientPool.cs index 23e4501..b2cd059 100644 --- a/server/src/UdpClientPool.cs +++ b/server/src/UdpClientPool.cs @@ -336,7 +336,7 @@ public class UDPClientPool $"Device {address} receive data is {retData.Length} bytes instead of 4 bytes")); // Check result - var retCode = Convert.ToUInt32(Common.Number.BytesToUInt64(retData).Value); + var retCode = Convert.ToUInt32(Common.Number.BytesToUInt32(retData).Value); if (Common.Number.BitsCheck(retCode, result, resultMask)) return true; } catch (Exception error) diff --git a/src/components/equipments/MotherBoardCaps.vue b/src/components/equipments/MotherBoardCaps.vue index 8437f09..9093ac6 100644 --- a/src/components/equipments/MotherBoardCaps.vue +++ b/src/components/equipments/MotherBoardCaps.vue @@ -22,7 +22,6 @@
{ new Error("JtagClient Mutex Timeout!"), ); const jtagHubConnection = new HubConnectionBuilder() - .withUrl("/hubs/JtagHub") + .withUrl("http://localhost:5000/hubs/JtagHub") .withAutomaticReconnect() .build(); const jtagHubProxy = @@ -43,7 +43,7 @@ export const useEquipments = defineStore("equipments", () => { }, ); onMounted(() => { - jtagHubConnection.start(); + }); // Matrix Key @@ -87,6 +87,7 @@ export const useEquipments = defineStore("equipments", () => { } async function jtagBoundaryScanSetOnOff(enable: boolean) { + jtagHubConnection.start(); enableJtagBoundaryScan.value = enable; if (enable) { jtagHubProxy.startBoundaryScan(jtagBoundaryScanFreq.value); diff --git a/src/views/Project/Index.vue b/src/views/Project/Index.vue index 134c0d3..2e30907 100644 --- a/src/views/Project/Index.vue +++ b/src/views/Project/Index.vue @@ -306,8 +306,8 @@ async function checkAndInitializeBoard() { // 根据实验板信息更新equipment store function updateEquipmentFromBoard(board: Board) { - equipments.setAddr(board.ipAddr); - equipments.setPort(board.port); + equipments.boardAddr = board.ipAddr; + equipments.boardPort = board.port; console.log(`实验板信息已更新到equipment store:`, { address: board.ipAddr,