using System;
using System.Threading.Tasks;
using TeamAAS.Feeder.Enums;
using TeamAAS.Feeder.Models;
namespace TeamAAS.Feeder.Interfaces
{
///
/// 单个供料器设备接口(抽象硬件能力)
///
public interface IFeeder : IDisposable
{
Guid Id { get; }
int FeederNo { get; }
string Name { get; }
FeederBrand Brand { get; }
bool IsConnected { get; }
bool IsBacklightOn { get; }
event Action ConnectionChanged;
/// 收发报文事件:content=报文文本,isSend=true 为发送(TX)、false 为接收(RX)。
event Action MessageExchanged;
Task ConnectAsync();
Task DisconnectAsync();
Task OpenBacklightAsync();
Task CloseBacklightAsync();
Task QueryBacklightAsync();
Task RunDirectionAsync(FeederAction action, int? durationMs = null);
Task StopAsync();
Task GetActionParamAsync(int index);
Task SetActionParamAsync(int index, SingleActionParam param);
Task DownloadAllParamsAsync(FeederInfo info);
Task SaveToDeviceAsync();
// ===== 系统参数(超时/背光):全局地址 44/34/33/65/66 =====
Task GetSystemParamAsync();
Task SetSystemParamAsync(FeederSystemParam param);
// ===== 料斗输入输出:地址 742+8*n =====
Task GetHopperParamAsync(int group);
Task SetHopperParamAsync(int group, HopperOutputParam param);
Task RunHopperOutputAsync(int id, int? timespan = null);
Task StopHopperOutputAsync();
// ===== 输入触发序列ID:地址 39+index =====
Task GetInputTriggerAsync(int index);
Task SetInputTriggerAsync(int index, int sequenceId);
// ===== 通用参数读写(RP/WP)=====
Task ReadParamAsync(int id);
Task WriteParamAsync(int id, int value);
}
}