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,