12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //using Edge.Core.Processor;
- //using System;
- //using Microsoft.EntityFrameworkCore;
- //using Microsoft.Extensions.DependencyInjection;
- //using Microsoft.Extensions.Logging;
- //using System;
- //using System.Collections.Generic;
- //using System.Linq;
- //using System.Text.Json;
- //using Edge.Core.UniversalApi;
- //using Edge.Core.Processor.Dispatcher.Attributes;
- //using System.Threading.Tasks;
- //using System.Net.Sockets;
- //using Microsoft.Extensions.Logging.Abstractions;
- //using System.Net;
- //using System.Threading;
- //using Edge.Core.Parser.BinaryParser.Util;
- //namespace DispenserPartsInfoRetriever
- //{
- // public class BaseServer : IAppProcessor
- // {
-
-
- // protected CancellationTokenSource cancelServerListeningCts;
- // protected System.Timers.Timer heartbeatTimer = new System.Timers.Timer();
- // private AppConfigV1 appConfig;
- // private IServiceProvider services;
- // private ILogger logger = NullLogger.Instance;
- // public string MetaConfigName { get; set; }
-
- // public BaseServer(AppConfigV1 appConfig, IServiceProvider services)
- // {
- // this.appConfig = appConfig;
- // this.services = services;
- // var loggerFactory = services.GetRequiredService<ILoggerFactory>();
- // this.logger = loggerFactory.CreateLogger("DynamicPrivate_DispenserPartsInfoRetriever");
- // }
- // public void Init(IEnumerable<IProcessor> processors)
- // {
- // }
- // public virtual async Task<bool> Start()
- // {
- // return true;
- // }
- // /// <summary>
- // ///
- // /// </summary>
- // /// <param name="value">like input "01234", will return byte[2]: 0x00, byte[1]: 0x12, byte[0]: 0x34</param>
- // /// <returns></returns>
- // public byte[] StringToBcdHex(string value)
- // {
- // if (value.Length % 2 != 0) value = "0" + value;
- // List<byte> output = new List<byte>();
- // for (int i = value.Length - 1; i >= 0; i = i - 2)
- // {
- // output.Add((byte)(byte.Parse(value[i - 1].ToString()) * 16 + byte.Parse(value[i].ToString())));
- // }
- // output.Reverse();
- // return output.ToArray();
- // }
- // public async Task<bool> Stop()
- // {
- // var universalApiHub = this.services.GetRequiredService<UniversalApiHub>();
- // await universalApiHub.FireEvent(this, OnAppStateChangeEventName, new OnAppStateChangeEventArg() { State = "Stopped", Reason = "app is stopping" });
- // try { this.cancelServerListeningCts?.Cancel(); } catch { }
- // try { this.heartbeatTimer?.Stop(); } catch { }
- // return true;
- // }
- // }
- //}
|