using System; using System.Collections.Generic; using System.Drawing; namespace LB_VisionProcesses.BarcodeReaders { /// /// 读码器品牌枚举 /// public enum BarcodeReaderBrand { Huayray, // 华睿 Unsupported } /// /// 条码详细信息 /// public class BarcodeInfo { public string Text { get; set; } /// /// 条码的四个顶点坐标 /// public Point[] Points { get; set; } } /// /// 读码结果参数类 /// public class BarcodeEventArgs : EventArgs { /// /// 设备序列号 /// public string SN { get; set; } /// /// 条码详细信息列表 /// public List BarcodeInfos { get; set; } = new List(); /// /// 仅获取条码文本列表 (保持兼容性) /// public List Barcodes => BarcodeInfos.Select(x => x.Text).ToList(); /// /// 关联图像 (可选) /// public Bitmap Image { get; set; } /// /// 是否读取成功 /// public bool IsSuccess => BarcodeInfos.Count > 0; public BarcodeEventArgs(string sn, List barcodeInfos, Bitmap image = null) { SN = sn; BarcodeInfos = barcodeInfos; Image = image; } } /// /// 读码器抽象接口 /// public interface IBarcodeReader : IDisposable { /// /// 读码结果回调事件 /// event EventHandler BarcodeRead; /// /// 获取设备列表枚举 /// /// SN列表 List GetDeviceList(); /// /// 初始化并打开读码器 /// /// 序列号 /// 是否成功 bool Open(string sn); /// /// 关闭读码器 /// /// 是否成功 bool Close(); /// /// 开始采集/监听 /// /// 是否成功 bool StartGrabbing(); /// /// 停止采集/监听 /// /// 是否成功 bool StopGrabbing(); /// /// 执行软触发一次 /// /// 是否成功 bool SoftTrigger(); /// /// 设置触发模式 /// /// true为软触发, false为硬触发或自动监听 /// 是否成功 bool SetTriggerMode(bool isSoftware); /// /// 设备是否在线 /// bool IsConnected { get; } /// /// 设备是否正在采集 /// bool IsGrabbing { get; } /// /// 设备品牌 /// BarcodeReaderBrand Brand { get; } } }