From 0b6554f13910a4ec3d285dab090191a8db2db2af Mon Sep 17 00:00:00 2001 From: QI Mingxuan Date: Fri, 22 May 2026 15:55:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=8E=A2=E6=B5=8B=E5=99=A8=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9ASimulated?= =?UTF-8?q?Detector=E5=AE=9E=E7=8E=B0ApplyParametersInternalAsync=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XP.Hardware.Detector/Implementations/SimulatedDetector.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/XP.Hardware.Detector/Implementations/SimulatedDetector.cs b/XP.Hardware.Detector/Implementations/SimulatedDetector.cs index 3c27c52..f9c343a 100644 --- a/XP.Hardware.Detector/Implementations/SimulatedDetector.cs +++ b/XP.Hardware.Detector/Implementations/SimulatedDetector.cs @@ -84,6 +84,9 @@ namespace XP.Hardware.Detector.Implementations protected override Task BadPixelCorrectionInternalAsync(CancellationToken cancellationToken) => Task.FromResult(DetectorResult.Success("模拟坏像素校正完成")); + protected override Task ApplyParametersInternalAsync(int binningIndex, int pga, decimal frameRate, CancellationToken cancellationToken) + => Task.FromResult(DetectorResult.Success("模拟参数应用完成")); + public override DetectorInfo GetInfo() => new DetectorInfo { Type = DetectorType.Simulated, From cf15ed740fdeefa04a35c8653b0e5192cff6fb14 Mon Sep 17 00:00:00 2001 From: TianSong Date: Mon, 25 May 2026 08:26:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?XP.SCAN=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?socket=E9=80=9A=E8=AE=AF=EF=BC=8C=E5=90=8E=E6=9C=9F=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E8=BD=AF=E4=BB=B6=E4=B8=8E=E6=8E=A7=E5=88=B6=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=E5=90=8C=E4=B8=80=E7=94=B5=E8=84=91=E8=BF=9B?= =?UTF-8?q?=E8=A1=8Csocket=E9=80=9A=E8=AE=AF=E4=BC=A0=E9=80=92=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E9=87=8D=E6=9E=84=EF=BC=8C=E5=90=8E=E6=9C=9F=E5=8F=AF?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E4=BF=AE=E6=94=B9IP=E9=80=82=E9=85=8D?= =?UTF-8?q?=E4=B8=A4=E5=8F=B0=E7=94=B5=E8=84=91=E7=9A=84socket=E9=80=9A?= =?UTF-8?q?=E8=AE=AF=E9=87=8D=E5=BB=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XP.Scan/Models/ReconstructionMode.cs | 14 ++++ .../Services/IReconstructionNotifyService.cs | 15 ++++ .../Services/ReconstructionNotifyService.cs | 72 +++++++++++++++++++ XplorePlane/App.config | 8 +++ 4 files changed, 109 insertions(+) create mode 100644 XP.Scan/Models/ReconstructionMode.cs create mode 100644 XP.Scan/Services/IReconstructionNotifyService.cs create mode 100644 XP.Scan/Services/ReconstructionNotifyService.cs diff --git a/XP.Scan/Models/ReconstructionMode.cs b/XP.Scan/Models/ReconstructionMode.cs new file mode 100644 index 0000000..459d760 --- /dev/null +++ b/XP.Scan/Models/ReconstructionMode.cs @@ -0,0 +1,14 @@ +namespace XP.Scan.Models +{ + /// + /// CT 重建模式 | CT Reconstruction Mode + /// + public enum ReconstructionMode + { + /// 平面CT重建 | Planar CT reconstruction + Planar = 2001, + + /// 立式CT重建 | Vertical CT reconstruction + Vertical = 2002 + } +} diff --git a/XP.Scan/Services/IReconstructionNotifyService.cs b/XP.Scan/Services/IReconstructionNotifyService.cs new file mode 100644 index 0000000..3daeaed --- /dev/null +++ b/XP.Scan/Services/IReconstructionNotifyService.cs @@ -0,0 +1,15 @@ +namespace XP.Scan.Services +{ + /// + /// 重建通知服务接口 | Reconstruction notification service interface + /// 负责通过 Socket 通知本地重建软件启动重建任务 + /// + public interface IReconstructionNotifyService + { + /// + /// 发送重建通知消息 + /// + /// 扫描配置文件路径 + void SendReconstructionNotify(string configPath); + } +} diff --git a/XP.Scan/Services/ReconstructionNotifyService.cs b/XP.Scan/Services/ReconstructionNotifyService.cs new file mode 100644 index 0000000..87b4720 --- /dev/null +++ b/XP.Scan/Services/ReconstructionNotifyService.cs @@ -0,0 +1,72 @@ +using System; +using System.Net; +using System.Net.Sockets; +using System.Text; +using XP.Common.Logging.Interfaces; +using XP.Scan.Models; + +namespace XP.Scan.Services +{ + /// + /// 重建通知服务 | Reconstruction notification service + /// 通过 TCP Socket 向本地重建软件发送配置路径 + 重建模式码 + /// + public class ReconstructionNotifyService : IReconstructionNotifyService + { + private readonly ILoggerService _logger; + private readonly string _host; + private readonly int _port; + private readonly ReconstructionMode _mode; + + /// + /// 构造函数 + /// + /// 日志服务 + /// 重建软件 IP 地址(本机默认 127.0.0.1) + /// 重建软件监听端口 + /// CT 重建模式(Planar=2001, Vertical=2002) + public ReconstructionNotifyService( + ILoggerService loggerService, + string host = "127.0.0.1", + int port = 11000, + ReconstructionMode mode = ReconstructionMode.Planar) + { + _logger = loggerService.ForModule(); + _host = host; + _port = port; + _mode = mode; + } + + /// + /// 发送重建通知消息 + /// 消息格式: configPath + 模式码(2001=平面CT, 2002=立式CT) + /// + /// 扫描配置文件路径 + public void SendReconstructionNotify(string configPath) + { + try + { + using var sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + var ipAddress = IPAddress.Parse(_host); + var remoteEP = new IPEndPoint(ipAddress, _port); + + sender.Connect(remoteEP); + + // 拼接消息: 配置路径 + 重建模式码 + string message = configPath + ((int)_mode).ToString(); + byte[] msg = Encoding.UTF8.GetBytes(message); + sender.Send(msg); + + _logger.Info($"重建通知已发送 | Reconstruction notify sent: {message}"); + } + catch (SocketException ex) + { + _logger.Error($"重建通知发送失败(Socket) | Reconstruction notify failed: {ex.Message}"); + } + catch (Exception ex) + { + _logger.Error($"重建通知发送异常 | Reconstruction notify error: {ex.Message}"); + } + } + } +} diff --git a/XplorePlane/App.config b/XplorePlane/App.config index 9825512..e6d2dab 100644 --- a/XplorePlane/App.config +++ b/XplorePlane/App.config @@ -175,6 +175,14 @@ + + + + + + + +