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

54 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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; }
/// <summary>
/// 信号强度
/// 信号从0dbm~97dbm个人建议是0~30是强30~70是中70~97是弱。
/// </summary>
public int SignalStrength { get; internal set; }
protected AbstractDevice(string id, NetworkType networkType)
{
this.Id = id;
this.Network = networkType;
}
public abstract void Connect();
public abstract void Disconnect(bool save = true);
}
}