123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using Edge.Core.Processor;using Edge.Core.IndustryStandardInterface.Pump;
- using Microsoft.AspNetCore.Hosting;
- using NoName_CarplateRecognizeCamera_Lab.Controllers;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Threading.Tasks;
- using Wayne.FDCPOSLibrary;
- namespace NoName_CarplateRecognizeCamera_Lab
- {
- public class CameraApp : IAppProcessor, IFdcCommunicableController
- {
- public static string SmsServiceUrl;
- private string httpServerListenUrl;
- private IWebHost webHost;
- public string MetaConfigName { get; set; }
- public string SerialNumber { get { return "7C4412DD-FBE8-4A51-9E11-1E64D371612D"; } set {; } }
- public Func<string, bool> BroadcastMessageViaFdc { get; set; }
- public Func<string, string, string, bool> SendMessageViaFdc { get; set; }
- public Func<string, Tuple<string, OverallResult>> OnMessageReceivedViaFdc { get; set; }
- public CameraApp(string httpServerListenUrl, string smsServiceUrl)
- {
- this.httpServerListenUrl = httpServerListenUrl;
- CameraApp.SmsServiceUrl = smsServiceUrl;
- this.webHost = new WebHostBuilder()
- //.UseConfiguration(config)
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())
- .UseIISIntegration()
- .UseUrls(this.httpServerListenUrl)
- .UseStartup<Startup>()
- .Build();
- this.webHost.RunAsync();
- CameraDataController.OnCarPlateRead = (result) =>
- {
- var carPlateNumber = result.AlarmInfoPlate.result.PlateResult.license;
- this.BroadcastMessageViaFdc("{source : 'CameraApp', data: { carPlateNumber: '" + carPlateNumber + "'}}");
- };
- }
- public void Init(IEnumerable<IProcessor> processors)
- {
- //throw new NotImplementedException();
- }
- public Task<bool> Start()
- {
- return Task.FromResult(true);
- }
- public Task<bool> Stop()
- {
- this.webHost.StopAsync();
- return Task.FromResult(true);
- }
- }
- }
|