powerfun-unity/Assets/Scripts/Devices/Ble/Scan/BleAdvertisementInfo.cs
2021-06-08 10:30:26 +08:00

52 lines
1.1 KiB
C#

using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ble;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Ble.Scan
{
/// <summary>
/// 广播数据
/// </summary>
public class BleAdvertisementInfo
{
public BlePeripheralInfo Peripheral { get; }
public int Rssi { get; }
public SensorType SensorType { get; internal set; }
public BleAdvertisementInfo(BlePeripheralInfo peripheral, int rssi, bool connectible, List<Guid> services, byte[] manufactureData, SensorType sensor)
{
this.Peripheral = peripheral;
this.Rssi = rssi;
//this.Connectible = connectible;
this.services = services;
//this.ManufactureData = manufactureData;
this.SensorType = sensor;
Index = 1;
}
private readonly List<Guid> services;
public IReadOnlyList<Guid> Services
{
get
{
return this.services;
}
}
public void TryAddService(Guid service)
{
if (this.services.Contains(service))
return;
this.services.Add(service);
}
public int Index { get; set; }
}
}