powerfun-unity/Assets/Scripts/Devices/Ble/Scan/BleAdvertisementInfo.cs

52 lines
1.1 KiB
C#
Raw Normal View History

2021-05-19 14:38:48 +08:00
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; set; }
2021-05-19 14:38:48 +08:00
2021-06-04 10:35:58 +08:00
public SensorType SensorType { get; internal set; }
2021-05-19 14:38:48 +08:00
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;
2021-06-04 10:35:58 +08:00
Index = 1;
2021-05-19 14:38:48 +08:00
}
private readonly List<Guid> services;
public IReadOnlyList<Guid> Services
{
get
{
return this.services;
}
}
2021-06-04 10:35:58 +08:00
public void TryAddService(Guid service)
2021-06-08 10:30:26 +08:00
{
2021-06-04 10:35:58 +08:00
if (this.services.Contains(service))
return;
this.services.Add(service);
}
public int Index { get; set; }
2021-05-19 14:38:48 +08:00
}
}