From 9680ab0ad309442310b7318b065bdc81f01a6830 Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Thu, 3 Sep 2026 12:26:56 +0200 Subject: [PATCH] bind composite discovery and add emulated POS895 Epson printers answer ENPC and POS895/POS896 answer SPRT; only the composite discovery service sees both. Wire CompositeDiscoveryService (wrapping DiscoveryService + SprtDiscoveryService) into production DI, and add a 576px emulated POS895 (127.0.0.4) alongside the existing TM-U220II/TM-T30III emulation entries so receipt layouts can be checked without hardware. Claude-Session: https://claude.ai/code/session_01E6N3P4nSZLtp4BC2LXVref --- EpsonPrintService/PrintServerBootstrapper.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/EpsonPrintService/PrintServerBootstrapper.cs b/EpsonPrintService/PrintServerBootstrapper.cs index 40f5906..81a319f 100644 --- a/EpsonPrintService/PrintServerBootstrapper.cs +++ b/EpsonPrintService/PrintServerBootstrapper.cs @@ -53,17 +53,19 @@ public class PrintServerBootstrapper { ["127.0.0.2"] = ("emulation/u220.html", 0x13, 258), ["127.0.0.3"] = ("emulation/t30.html", 0x01, 384), + ["127.0.0.4"] = ("emulation/pos895.html", 0x20, 576), }; var discovery = new PreconfiguredDiscoveryService(); discovery.AddPrinter("127.0.0.2", "TM-U220II"); discovery.AddPrinter("127.0.0.3", "TM-T30III"); + discovery.AddPrinter("127.0.0.4", "POS895"); _kernel.Bind().ToConstant(discovery).InSingletonScope(); _kernel.Bind().ToMethod(ctx => new EmulationPrinterFactory(emulationConfigs, ctx.Kernel.Get())); - Console.WriteLine("Emulation mode enabled: 127.0.0.2 (TM-U220II), 127.0.0.3 (TM-T30III)"); + Console.WriteLine("Emulation mode enabled: 127.0.0.2 (TM-U220II), 127.0.0.3 (TM-T30III), 127.0.0.4 (POS895)"); } else { @@ -74,7 +76,19 @@ public class PrintServerBootstrapper //discovery.AddPrinter("192.168.1.124", "TM-T30III"); //_kernel.Bind().ToConstant(discovery).InSingletonScope();\ - _kernel.Bind().To().InSingletonScope(); + // Epson printers answer ENPC; POS895/POS896 answer SPRT. Both broadcast + // on UDP 3289, but only the composite sees them all. + _kernel.Bind().ToMethod(ctx => + { + var logger = ctx.Kernel.Get(); + return new CompositeDiscoveryService( + new IDiscoveryService[] + { + new DiscoveryService(logger), + new SprtDiscoveryService(logger) + }, + logger); + }).InSingletonScope(); _kernel.Bind().To(); } _kernel.Bind().To().InSingletonScope();