job status reporter

This commit is contained in:
EugeneTes
2026-02-05 08:42:34 +01:00
parent 1c0c95842a
commit 08da2c1e3e
3 changed files with 33 additions and 25 deletions

View File

@@ -36,14 +36,14 @@ var config = new EpsonPrintServiceConfiguration
Console.WriteLine($"Restaurant: {config.RestaurantId}");
Console.WriteLine($"API URL: {config.ApiUrl}");
//kernel.Bind<IDiscoveryService>().To<DiscoveryService>().InSingletonScope();
kernel.Bind<IDiscoveryService>().To<DiscoveryService>().InSingletonScope();
var discovery = new PreconfiguredDiscoveryService();
discovery.AddPrinter("192.168.50.176", "TM-T30III", port: 9100);
discovery.AddPrinter("192.168.50.60", "TM-T30III", port: 9100);
discovery.AddPrinter("192.168.50.61", "TM-T30III", port: 9100);
discovery.AddPrinter("192.168.50.80", "TM-U220II", port: 9100);
kernel.Bind<IDiscoveryService>().ToConstant(discovery);
//var discovery = new PreconfiguredDiscoveryService();
//discovery.AddPrinter("192.168.50.176", "TM-T30III", port: 9100);
//discovery.AddPrinter("192.168.50.60", "TM-T30III", port: 9100);
//discovery.AddPrinter("192.168.50.61", "TM-T30III", port: 9100);
//discovery.AddPrinter("192.168.50.80", "TM-U220II", port: 9100);
//kernel.Bind<IDiscoveryService>().ToConstant(discovery);
kernel.Bind<HttpClient>().ToConstant(new HttpClient { Timeout = TimeSpan.FromSeconds(30) }).InSingletonScope();
@@ -85,7 +85,7 @@ var heartbeatTask = kernel.Get<HeartbeatBackgroundTask>();
//printServer.RegisterPrinter("10.0.20.12");
await printLoop.StartAsync();
var cts = new CancellationTokenSource();
@@ -100,6 +100,12 @@ Console.CancelKeyPress += (sender, e) =>
_ = discoveryTask.StartAsync(cts.Token);
_ = heartbeatTask.StartAsync(cts.Token);
// delay for a moment to allow discovery to find printers
Console.WriteLine("Waiting for printer discovery...");
await Task.Delay(3000);
await printLoop.StartAsync();
try
{
await Task.Delay(Timeout.Infinite, cts.Token);