powerfun-unity/Assets/Scripts/Devices/AbstractDevice.cs

58 lines
1.4 KiB
C#
Raw Normal View History

2021-05-19 14:38:48 +08:00
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;
}
2021-05-19 14:38:48 +08:00
public virtual string Name
{
get;
protected set;
}
public virtual ushort DeviceNumber { get; set; }
public virtual int Priority
{
get; protected set;
}
2021-06-04 10:35:58 +08:00
public NetworkType Network { get; internal set; }
/// <summary>
/// 信号强度
/// 信号从0dbm~97dbm个人建议是0~30是强30~70是中70~97是弱。
/// </summary>
public int SignalStrength { get; internal set; }
2022-06-09 14:51:03 +08:00
public DateTime LastActiveTime { get; internal set; }
public string ErrorMsg { get; internal set; }
protected AbstractDevice(string id, NetworkType networkType)
2021-06-04 10:35:58 +08:00
{
this.Id = id;
2021-06-04 10:35:58 +08:00
this.Network = networkType;
}
2022-06-09 14:51:03 +08:00
public abstract void Connect(Action<string> callback = null);
2021-05-19 14:38:48 +08:00
public abstract void Disconnect(bool save = true);
}
}