using Edge.Core.Parser; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Edge.Core.Processor { public interface IDeviceHandler where TMessage : MessageBase { /// /// The communicator has NOT started yet at this stage. /// /// void Init(IContext context); /// /// will be called every time that a message incoming from communicator. /// /// Task Process(IContext context); /// /// The method will be called from user for a generic test purpose, should implemented this method /// to cover most real life time logic to give user a meaningful and confidence result for how this processor would work /// when run for real. /// The method was guranteed to be called after DeviceHandler.Init, and Communicator.Start /// /// /// throw exception to indicates the test failed, otherwise, return a Completed task. Task Test(params object[] parameters) { throw new NotImplementedException("暂不支持测试"); } } public abstract class TestableActivePollingDeviceHandler : IDeviceHandler where TMessage : MessageBase { private IContext context; public virtual void Init(IContext context) { this.context = context; } public virtual Task Process(IContext context) { throw new NotImplementedException(); } } }