From 36495b7cbbdf47b813dbba795373838812b59967 Mon Sep 17 00:00:00 2001 From: g82tt Date: Sun, 17 May 2026 04:29:35 +0800 Subject: [PATCH] =?UTF-8?q?PhaseG3=5Fregister:=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=99=A8=E6=B3=A8=E5=86=8C=E5=88=B0Host=EF=BC=8C=E5=85=A8?= =?UTF-8?q?=E9=93=BE=E8=B7=AF=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/IntegrationGateway.Host/Program.cs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/gateway/src/IntegrationGateway.Host/Program.cs b/gateway/src/IntegrationGateway.Host/Program.cs index 930aba9..c75e03e 100644 --- a/gateway/src/IntegrationGateway.Host/Program.cs +++ b/gateway/src/IntegrationGateway.Host/Program.cs @@ -30,8 +30,27 @@ var volProUrl = gwCfg["VolProBaseUrl"] ?? "http://localhost:9100"; var httpFactory = app.Services.GetRequiredService(); var clientFactory = new GatewayClientFactory(httpFactory, volProUrl); -// 适配器将在 Phase G2/G3 注册,此处预留 -Console.WriteLine("[Gateway] AdapterRegistry initialized, awaiting adapters..."); +// 注册 OwlAdapter +var owlHttp = app.Services.GetRequiredService().CreateClient("VolPro"); +var owlAdapter = new IntegrationGateway.Adapters.Owl.OwlAdapter( + "Owl:main", owlHttp, + owlCfg["BaseUrl"] ?? "http://localhost:15123", + owlCfg["Username"] ?? "admin", + owlCfg["Password"] ?? "admin" +); +registry.Register(owlAdapter); + +// 注册 MC4Adapter +var mc4Http = app.Services.GetRequiredService().CreateClient("VolPro"); +var mc4Adapter = new IntegrationGateway.Adapters.MC4.Mc4Adapter( + "MC4:31ku", mc4Http, + mc4Cfg["BaseUrl"] ?? "http://localhost:3000" +); +registry.Register(mc4Adapter); + +// 并行初始化适配器 +await registry.InitializeAllAsync(); +Console.WriteLine($"[Gateway] {registry.All.Count} adapter(s) registered"); // ═══ B 组路由 ═══