MockProbeHandler.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Edge.Core.Processor;
  2. using Edge.Core.IndustryStandardInterface.Pump;
  3. using Edge.Core.IndustryStandardInterface.ATG;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Application.ATG_Classic_App_Test
  9. {
  10. internal class MockProbeHandler : IAppProcessor, IProbeHandler
  11. {
  12. private Probe probe;
  13. private Func<IProbeHandler, ProbeReading> readingValueProducer;
  14. public Probe Probe => this.probe;
  15. public string MetaConfigName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
  16. public string SerialNumber { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
  17. public Task<ProbeReading> GetProbeReadingAsync()
  18. {
  19. return Task.FromResult(this.readingValueProducer(this));
  20. }
  21. public MockProbeHandler(int id, double probeLength)
  22. {
  23. this.probe = new Probe()
  24. {
  25. HardwareIdentity = "MAC_abedefg_" + id,
  26. ProbeLength = probeLength,
  27. DeviceId = id
  28. };
  29. }
  30. public void Mock_SetProbeReadingValueProducer(Func<IProbeHandler, ProbeReading> producer)
  31. {
  32. this.readingValueProducer = producer;
  33. }
  34. public void Init(IEnumerable<IProcessor> processors)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. public Task<bool> Start()
  39. {
  40. throw new NotImplementedException();
  41. }
  42. public Task<bool> Stop()
  43. {
  44. throw new NotImplementedException();
  45. }
  46. }
  47. }