print server with new concept

This commit is contained in:
EugeneTes
2026-01-16 12:00:24 +01:00
parent 147265358f
commit 5229cac987
30 changed files with 694 additions and 217 deletions

View File

@@ -1,4 +1,5 @@
using Inspectron.Epson;
using Inspectron.Epson.PrintServer.ConfigurationSources;
using Microsoft.Extensions.Logging;
namespace EpsonPrintService;
@@ -20,15 +21,13 @@ public class PrinterDiscoveryBackgroundTask
public PrinterDiscoveryBackgroundTask(
IDiscoveryService discoveryService,
IDiscoveredPrintersReceiver receiver,
ILogger logger,
TimeSpan? interval = null,
TimeSpan? discoveryTimeout = null)
ILogger logger)
{
_discoveryService = discoveryService;
_receiver = receiver;
_logger = logger;
_interval = interval ?? TimeSpan.FromSeconds(30);
_discoveryTimeout = discoveryTimeout ?? TimeSpan.FromSeconds(3);
_interval = TimeSpan.FromSeconds(30);
_discoveryTimeout = TimeSpan.FromSeconds(3);
}
/// <summary>
@@ -68,6 +67,11 @@ public class PrinterDiscoveryBackgroundTask
try
{
var printers = await _discoveryService.DiscoverPrintersAsync(_discoveryTimeout);
printers.Add(new DiscoveredPrinter()
{
IPAddress = "127.0.0.1",
ModelName = "TM-T30III",
});
var currentIps = printers.Select(p => p.IPAddress).ToHashSet();
if (HasConfigurationChanged(currentIps))