using System;
using System.Threading;
using System.Threading.Tasks;
using XP.Hardware.Detector.Abstractions.Enums;
namespace XP.Hardware.Detector.Abstractions
{
///
/// 面阵探测器通用接口 | Area detector common interface
/// 定义所有探测器必须实现的核心能力
///
public interface IAreaDetector : IDisposable
{
///
/// 探测器状态 | Detector status
///
DetectorStatus Status { get; }
///
/// 探测器类型 | Detector type
///
DetectorType Type { get; }
///
/// 初始化探测器 | Initialize detector
///
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task InitializeAsync(CancellationToken cancellationToken = default);
///
/// 启动连续采集 | Start continuous acquisition
///
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task StartAcquisitionAsync(CancellationToken cancellationToken = default);
///
/// 停止采集 | Stop acquisition
///
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task StopAcquisitionAsync(CancellationToken cancellationToken = default);
///
/// 单帧采集 | Single frame acquisition
///
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task AcquireSingleFrameAsync(CancellationToken cancellationToken = default);
///
/// 暗场校正 | Dark field correction
///
/// 采集帧数 | Frame count
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task DarkCorrectionAsync(int frameCount, CancellationToken cancellationToken = default);
///
/// 增益校正(亮场校正)| Gain correction (bright field correction)
///
/// 采集帧数 | Frame count
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task GainCorrectionAsync(int frameCount, CancellationToken cancellationToken = default);
///
/// 自动校正(暗场+增益+坏像素)| Auto correction (dark + gain + bad pixel)
///
/// 采集帧数 | Frame count
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task AutoCorrectionAsync(int frameCount, CancellationToken cancellationToken = default);
///
/// 坏像素校正 | Bad pixel correction
///
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task BadPixelCorrectionAsync(CancellationToken cancellationToken = default);
///
/// 获取探测器信息 | Get detector information
///
/// 探测器信息 | Detector information
DetectorInfo GetInfo();
///
/// 应用探测器参数(Binning/PGA/帧率)| Apply detector parameters (Binning/PGA/FrameRate)
///
/// Binning 索引 | Binning index
/// PGA 灵敏度值 | PGA sensitivity value
/// 帧率 | Frame rate
/// 取消令牌 | Cancellation token
/// 操作结果 | Operation result
Task ApplyParametersAsync(int binningIndex, int pga, decimal frameRate, CancellationToken cancellationToken = default);
///
/// 获取校正能力描述 | Get correction capabilities
///
/// 校正能力描述 | Correction capabilities
CorrectionCapabilities GetCorrectionCapabilities();
///
/// 显式失效校正数据(参数变更后调用)| Explicitly invalidate correction data (called after parameter change)
///
void InvalidateCorrectionData();
}
}