蓝牙调用调整

This commit is contained in:
lishuo committed 2021-06-04 19:23:32 +08:00
1 parent 5671b35dce
commit 17eaccb72e
7 files changed
+111 -43

No files matched your search

+2 -1
View File
@@ -11,11 +11,12 @@ using UnityEngine;
namespace Assets.Scripts.Devices.Ble.Devices
{
public class Tacx : BleDevice, IPowerDevice, ICadenceDevice, ISpeedDevice, ITrainerDevice
public class Tacx : BleDevice, IPowerDevice, ICadenceDevice, ISpeedDevice, ITrainerDevice, IRequiresRiderWeight
{
public int Power { get => tacxFecNotify.Power; set => throw new NotImplementedException(); }
public int Cadence { get => tacxFecNotify.Cadence; set => throw new NotImplementedException(); }
public double Speed { get => tacxFecNotify.Speed; set => throw new NotImplementedException(); }
public double RiderWeight { get; set; }
private List<BleServiceInfo> Services;
+20 -1
View File
@@ -1,4 +1,5 @@
using System;
using Assets.Scripts.Devices.Ant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -171,6 +172,24 @@ namespace Assets.Scripts.Ble
return ServiceUuids.Services.Single(s => s.IdByteArray == type);
}
public static Guid GetBySensor(SensorType sensor)
{
switch (sensor)
{
case SensorType.Cadence:
case SensorType.SpeedCadence:
return Get(ServiceUuids.CyclingSpeedCadence).IdGuid;
case SensorType.HeartRate:
return Get(ServiceUuids.HeartRate).IdGuid;
case SensorType.Power:
return Get(ServiceUuids.PowerBeam).IdGuid;
case SensorType.Trainer:
return Get(ServiceUuids.TacxBle).IdGuid;
default:
return Guid.Empty;
}
}
public static class Characteristics
{