IFeeder.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Threading.Tasks;
  3. using TeamAAS.Feeder.Enums;
  4. using TeamAAS.Feeder.Models;
  5. namespace TeamAAS.Feeder.Interfaces
  6. {
  7. /// <summary>
  8. /// 单个供料器设备接口(抽象硬件能力)
  9. /// </summary>
  10. public interface IFeeder : IDisposable
  11. {
  12. Guid Id { get; }
  13. int FeederNo { get; }
  14. string Name { get; }
  15. FeederBrand Brand { get; }
  16. bool IsConnected { get; }
  17. bool IsBacklightOn { get; }
  18. event Action<IFeeder, bool> ConnectionChanged;
  19. /// <summary>收发报文事件:content=报文文本,isSend=true 为发送(TX)、false 为接收(RX)。</summary>
  20. event Action<IFeeder, string, bool> MessageExchanged;
  21. Task ConnectAsync();
  22. Task DisconnectAsync();
  23. Task OpenBacklightAsync();
  24. Task CloseBacklightAsync();
  25. Task<bool> QueryBacklightAsync();
  26. Task<int> RunDirectionAsync(FeederAction action, int? durationMs = null);
  27. Task StopAsync();
  28. Task<SingleActionParam> GetActionParamAsync(int index);
  29. Task SetActionParamAsync(int index, SingleActionParam param);
  30. Task DownloadAllParamsAsync(FeederInfo info);
  31. Task SaveToDeviceAsync();
  32. // ===== 系统参数(超时/背光):全局地址 44/34/33/65/66 =====
  33. Task<FeederSystemParam> GetSystemParamAsync();
  34. Task SetSystemParamAsync(FeederSystemParam param);
  35. // ===== 料斗输入输出:地址 742+8*n =====
  36. Task<HopperOutputParam> GetHopperParamAsync(int group);
  37. Task SetHopperParamAsync(int group, HopperOutputParam param);
  38. Task<int> RunHopperOutputAsync(int id, int? timespan = null);
  39. Task StopHopperOutputAsync();
  40. // ===== 输入触发序列ID:地址 39+index =====
  41. Task<int> GetInputTriggerAsync(int index);
  42. Task SetInputTriggerAsync(int index, int sequenceId);
  43. // ===== 通用参数读写(RP/WP)=====
  44. Task<int> ReadParamAsync(int id);
  45. Task WriteParamAsync(int id, int value);
  46. }
  47. }