using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SamplePre.Communication { public abstract class CommunicationBase { /// /// 是否连接 /// private bool _isConnected = false; /// /// 连接状态变化事件 /// public event Action ConnectionStatusChanged; /// /// 是否连接 /// public bool IsConnected { get => _isConnected; set { if (_isConnected != value) { _isConnected = value; ConnectionStatusChanged?.Invoke(value); } } } /// /// 下发下位机指令 /// /// /// /// /// public abstract bool WriteArraysBtye(int Dbno, int start, T[] bytes); /// /// 读取监控数据,读取数组 /// /// public abstract ushort[] ReadArraysShort(int Dbno, int start, int lenth); /// /// 写入数据 /// /// 地址(如"M0.0", "DB1.DBW2") /// 要写入的值 /// 是否写入成功 public abstract bool WriteSingleData(string address, object value); } }