DripNozzlePort.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Threading;
  3. using SHJX.Service.Common.Extend;
  4. using SHJX.Service.Common.ReadXML;
  5. using SHJX.Service.Model.Control;
  6. using SHJX.Service.ServerClient.Interface;
  7. using SHJX.Service.ServerClient.TempController;
  8. using SHJX.Service.Common.Logging;
  9. using Microsoft.Extensions.Logging;
  10. namespace SHJX.Service.ServerClient.RS485Control
  11. {
  12. /// <summary>
  13. /// 滴嘴操作
  14. /// </summary>
  15. public class DripNozzlePort : SerialPortImp, PortControlImp
  16. {
  17. private static readonly ILogger logger = LogFactory.BuildLogger(typeof(DripNozzlePort));
  18. /// <summary>
  19. /// 滴嘴
  20. /// </summary>
  21. /// <param name="log">日志</param>
  22. /// <param name="config">配置</param>
  23. public DripNozzlePort( ReadConfigUtil config) : base( config) { }
  24. public object Read(PortArgs args)
  25. {
  26. throw new NotImplementedException();
  27. }
  28. public bool Write(PortArgs args)
  29. {
  30. var way = args.WriteWay switch
  31. {
  32. WriteWay.Normotopia => "L",
  33. WriteWay.Antiposition => "H",
  34. _ => throw new ArgumentNullException(args.WriteWay.GetEnumDesc<WriteWay>())
  35. };
  36. var res = MotorStorage(args.NodeId, 3, way);
  37. Thread.Sleep(500);
  38. return res;
  39. }
  40. }
  41. }