using System.ComponentModel; using System.Threading.Tasks; using XP.Hardware.PLC.Configs; using XP.Hardware.PLC.Helpers; using XP.Hardware.PLC.Models; namespace XP.Hardware.Plc.Abstractions { /// /// PLC 服务接口,供跨模块使用 | PLC service interface for cross-module usage /// 提供 PLC 连接状态查询、信号管理和属性变更通知 | Provides PLC connection status query, signal management and property change notification /// public interface IPlcService : INotifyPropertyChanged { /// /// PLC 连接状态 | PLC connection status /// bool IsConnected { get; } /// /// 状态文本,用于 UI 显示 | Status text for UI display /// string StatusText { get; } /// /// 初始化 PLC 连接 | Initialize PLC connection /// /// PLC 配置 | PLC configuration /// 连接是否成功 | Whether connection succeeded Task InitializeAsync(PlcConfig config); /// /// 加载信号定义文件 | Load signal definitions from XML file /// /// XML 信号定义文件路径 | XML signal definition file path void LoadSignalDefinitions(string xmlFilePath); /// /// 按名称查找信号定义 | Find signal definition by name /// /// 信号逻辑名称 | Signal logical name /// 信号条目 | Signal entry SignalEntry FindSignal(string signalName); /// /// 获取当前批量读取缓存快照 | Get current bulk read cache snapshot /// /// 缓存快照,缓存为空时返回 null | Cache snapshot, returns null when cache is empty PlcDataBlock GetCacheSnapshot(); /// /// 释放资源 | Dispose resources /// void Dispose(); } }