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 BroadcastMessageViaFdc { get; set; } public Func SendMessageViaFdc { get; set; } public Func> 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() .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 processors) { //throw new NotImplementedException(); } public Task Start() { return Task.FromResult(true); } public Task Stop() { this.webHost.StopAsync(); return Task.FromResult(true); } } }