using Assets.Scripts.Devices.Ant; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assets.Scripts.Devices { public abstract class AbstractDevice { public virtual DeviceState State { get; set; } = DeviceState.Disconnected; public SensorType Sensor { get; protected set; } public string Id { get; protected set; } public virtual string Name { get; protected set; } public virtual ushort DeviceNumber { get; set; } public virtual int Priority { get; protected set; } public NetworkType Network { get; internal set; } /// /// 信号强度 /// 信号从0dbm~97dbm,个人建议是0~30是强,30~70是中,70~97是弱。 /// public int SignalStrength { get; internal set; } public DateTime LastActiveTime { get; internal set; } public string ErrorMsg { get; internal set; } protected AbstractDevice(string id, NetworkType networkType) { this.Id = id; this.Network = networkType; } public abstract void Connect(Action callback = null); public abstract void Disconnect(bool save = true); } }