using System;
|
using System.Collections.Generic;
|
|
namespace LB_VisionProcesses.BarcodeReaders
|
{
|
/// <summary>
|
/// 读码器抽象基类
|
/// </summary>
|
public abstract class BarcodeReaderBase : IBarcodeReader
|
{
|
public virtual event EventHandler<BarcodeEventArgs> BarcodeRead;
|
|
public virtual string SN { get; protected set; } = string.Empty;
|
|
public virtual bool IsConnected { get; protected set; } = false;
|
|
public virtual bool IsGrabbing { get; protected set; } = false;
|
|
public abstract BarcodeReaderBrand Brand { get; }
|
|
protected BarcodeReaderBase() { }
|
|
/// <summary>
|
/// 触发读码成功事件
|
/// </summary>
|
protected virtual void OnBarcodeRead(BarcodeEventArgs e)
|
{
|
BarcodeRead?.Invoke(this, e);
|
}
|
|
public abstract List<string> GetDeviceList();
|
|
public abstract bool Open(string sn);
|
|
public abstract bool Close();
|
|
public abstract bool StartGrabbing();
|
|
public abstract bool StopGrabbing();
|
|
public abstract bool SoftTrigger();
|
|
public abstract bool SetTriggerMode(bool isSoftware);
|
|
public virtual void Dispose()
|
{
|
try
|
{
|
if (IsConnected)
|
{
|
Close();
|
}
|
}
|
catch { }
|
}
|
}
|
}
|