refactor Queue namespace
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Inspectron.Epson;
|
||||
using Inspectron.Epson.PrintServer.ConfigurationSources;
|
||||
using Inspectron.Epson.Queue;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace EpsonPrintService;
|
||||
|
||||
@@ -11,6 +11,7 @@ using Inspectron.Epson.PrintServer.Printers;
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
using Inspectron.Epson.PrintServer.PrintServices;
|
||||
using EpsonPrintService;
|
||||
using Inspectron.Epson.Queue;
|
||||
|
||||
StandardKernel kernel = new StandardKernel();
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Inspectron.Epson.PrintServer;
|
||||
using Inspectron.Epson.Queue;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer;
|
||||
|
||||
public interface IPrintJobSource
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Channels;
|
||||
using Inspectron.Epson.PrintServer.ConfigurationSources;
|
||||
using Inspectron.Epson.Queue;
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Channels;
|
||||
using Inspectron.Epson.Queue;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer.JobSources;
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Inspectron.Epson.PrintServer.PrintServices;
|
||||
using Inspectron.Epson.Queue;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer;
|
||||
|
||||
public class PrintLoop
|
||||
{
|
||||
private readonly global::PrintServer _printServer;
|
||||
private readonly global::Inspectron.Epson.Queue.PrintServer _printServer;
|
||||
private readonly IPrintService _printService;
|
||||
private readonly IPrintJobSource _jobSource;
|
||||
|
||||
@@ -13,7 +14,7 @@ public class PrintLoop
|
||||
private CancellationTokenSource? _cancellationSource;
|
||||
private CancellationToken _cancellationToken;
|
||||
|
||||
public PrintLoop(global::PrintServer printServer,IPrintService printService, IPrintJobSource jobSource, ILogger logger)
|
||||
public PrintLoop(global::Inspectron.Epson.Queue.PrintServer printServer,IPrintService printService, IPrintJobSource jobSource, ILogger logger)
|
||||
{
|
||||
_printServer = printServer;
|
||||
_printService = printService;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Inspectron.Epson.PrintServer.Printers;
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
using Inspectron.Epson.Queue;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer.PrintServices;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public interface IJobStatusReporter
|
||||
{
|
||||
Task ReportStatusAsync(PrintJob job, PrintJobStatus status);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public interface IPrintService
|
||||
{
|
||||
Task<PrintResult> PrintAsync(string printerIp, PrintJob job);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public class NullJobStatusReporter : IJobStatusReporter
|
||||
{
|
||||
public Task ReportStatusAsync(PrintJob job, PrintJobStatus status) => Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public enum PrintErrorType
|
||||
{
|
||||
None,
|
||||
ConversionError,
|
||||
Other
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using static Inspectron.Epson.PrintServer.JobSources.SignalRPrintJobSource;
|
||||
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public class PrintJob
|
||||
{
|
||||
// todo: change to ip address
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public enum PrintJobStatus
|
||||
{
|
||||
Received,
|
||||
Completed,
|
||||
Failed
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public class PrintResult
|
||||
{
|
||||
public bool Success { get; }
|
||||
@@ -11,4 +13,4 @@ public class PrintResult
|
||||
|
||||
public static PrintResult Ok() => new(true, PrintErrorType.None);
|
||||
public static PrintResult Fail(PrintErrorType errorType) => new(false, errorType);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public class PrintServer
|
||||
{
|
||||
private readonly IPrintService _printService;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Inspectron.Epson.Queue;
|
||||
|
||||
public class PrinterQueue
|
||||
{
|
||||
public string PrinterIp { get; }
|
||||
@@ -139,5 +137,4 @@ public class PrinterQueue
|
||||
{
|
||||
return new List<PrintJob>(_queue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user