+
Parking Interface Image Server
+
Status: Active
+
The image server is running and ready to serve files.
+
+
Authentication Required for /images path.
+
+
+
+", "text/html"));
+
+ await _app.StartAsync(cancellationToken);
+ }
+
+ public async Task StopAsync(CancellationToken cancellationToken = default)
+ {
+ if (_app != null)
+ {
+ await _app.StopAsync(cancellationToken);
+ await _app.DisposeAsync();
+ _app = null;
+ }
+ }
+ }
+}
diff --git a/LPR_Manager/Service/LogService.cs b/LPR_Manager/Service/LogService.cs
new file mode 100644
index 0000000..2018991
--- /dev/null
+++ b/LPR_Manager/Service/LogService.cs
@@ -0,0 +1,30 @@
+using Serilog;
+using System.IO;
+using LPR_Manager.Model;
+
+namespace LPR_Manager.Service
+{
+ public static class LogService
+ {
+ public static void ConfigureLogging(LogMode mode)
+ {
+ var loggerConfig = new LoggerConfiguration()
+ .MinimumLevel.Debug();
+
+ var logPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Logs", "log.txt");
+
+ if (mode == LogMode.Seq || mode == LogMode.Both)
+ {
+ loggerConfig.WriteTo.Seq("http://localhost:5341");
+ }
+
+ if (mode == LogMode.File || mode == LogMode.Both)
+ {
+ loggerConfig.WriteTo.File(logPath, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 30);
+ }
+
+ Log.Logger = loggerConfig.CreateLogger();
+ Log.Information($"Logging configured. Mode: {mode}");
+ }
+ }
+}
diff --git a/LPR_Manager/Service/WushiCamera.cs b/LPR_Manager/Service/WushiCamera.cs
new file mode 100644
index 0000000..28f4f5e
--- /dev/null
+++ b/LPR_Manager/Service/WushiCamera.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Runtime.InteropServices;
+using System.IO;
+
+namespace LPR_Manager.Service
+{
+ public class WushiCamera : IDisposable
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void NtcConnectCallback([MarshalAs(UnmanagedType.LPUTF8Str)] string id, bool connected);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void NtcTriggerCallback([MarshalAs(UnmanagedType.LPUTF8Str)] string id, [MarshalAs(UnmanagedType.LPUTF8Str)] string plate, IntPtr pImage, int imageSize);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void NtcAuthCallback(int code, [MarshalAs(UnmanagedType.LPUTF8Str)] string msg);
+
+ [DllImport("NtcClientAPI4Net.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void NtcApi_Init([MarshalAs(UnmanagedType.LPStr)] string logPath);
+
+ [DllImport("NtcClientAPI4Net.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr NtcApi_CreateClient(
+ [MarshalAs(UnmanagedType.LPStr)] string host,
+ [MarshalAs(UnmanagedType.LPUTF8Str)] string id,
+ [MarshalAs(UnmanagedType.LPStr)] string adminId,
+ [MarshalAs(UnmanagedType.LPStr)] string adminPw,
+ NtcConnectCallback ccb, NtcTriggerCallback tcb, NtcAuthCallback acb);
+
+ [DllImport("NtcClientAPI4Net.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void NtcApi_DeleteClient(IntPtr pClient);
+
+ [DllImport("NtcClientAPI4Net.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int NtcApi_ClientStart(IntPtr pClient);
+
+ [DllImport("NtcClientAPI4Net.dll", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int NtcApi_ClientStop(IntPtr pClient);
+
+ private IntPtr _pClient = IntPtr.Zero;
+ private NtcConnectCallback _connectCallback;
+ private NtcTriggerCallback _triggerCallback;
+ private NtcAuthCallback _authCallback;
+
+ public bool IsConnected { get; private set; }
+ public event EventHandler