蓝牙抽象成接口
This commit is contained in:
1 parent
f14a071179
commit
81a18de9f4
20 files changed
+658
-44
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts.Ble;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble.Characteristic;
|
||||
using Assets.Scripts.Devices.Ble.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,7 +15,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
{
|
||||
private List<BleServiceInfo> Services;
|
||||
private CyclingPowerMeasurement cyclingPowerMeasurement;
|
||||
public CyclingPower(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Power)
|
||||
public CyclingPower(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Power)
|
||||
{
|
||||
Priority = 2;
|
||||
cyclingPowerMeasurement = new CyclingPowerMeasurement(1920);
|
||||
@@ -49,7 +50,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
}
|
||||
|
||||
|
||||
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
{
|
||||
//Debug.Log("power main call" + string.Join(",", response.Data));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts.Ble;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble.Characteristic;
|
||||
using Assets.Scripts.Devices.Ble.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -21,7 +22,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
private List<BleServiceInfo> Services;
|
||||
private BleCharacteristicInfo controlPointCharacteristic;
|
||||
|
||||
public Ftms(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) :base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
|
||||
public Ftms(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) :base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
|
||||
{
|
||||
this._ftmsIndoorBikeData = new FtmsIndoorBikeData();
|
||||
base.Characteristics.Add(this._ftmsIndoorBikeData);
|
||||
@@ -60,7 +61,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
}
|
||||
}
|
||||
|
||||
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
{
|
||||
foreach (var item in base.Characteristics)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts.Ble;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble.Characteristic;
|
||||
using Assets.Scripts.Devices.Ble.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -16,7 +17,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
|
||||
private List<BleServiceInfo> Services;
|
||||
private HeartRateMeasurement heartRateMeasurement;
|
||||
public HeartRate(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.HeartRate)
|
||||
public HeartRate(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.HeartRate)
|
||||
{
|
||||
Priority = 2;
|
||||
heartRateMeasurement = new HeartRateMeasurement();
|
||||
@@ -73,7 +74,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
});
|
||||
}
|
||||
|
||||
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
{
|
||||
//Debug.Log("heart rate main call" + string.Join(",", response.Data));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts.Ble;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble.Characteristic;
|
||||
using Assets.Scripts.Devices.Ble.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,7 +19,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
|
||||
private double _wheelCircumference;
|
||||
private List<BleServiceInfo> Services;
|
||||
public SpeedCadence(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.SpeedCadence)
|
||||
public SpeedCadence(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.SpeedCadence)
|
||||
{
|
||||
Debug.Log("创建速度踏频设备");
|
||||
Priority = 1;
|
||||
@@ -81,7 +82,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
}
|
||||
|
||||
|
||||
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
{
|
||||
//Debug.Log("power main call" + string.Join(",", response.Data));
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble.Characteristic;
|
||||
using Assets.Scripts.Devices.Ble.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -30,7 +31,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
/// </summary>
|
||||
private double _grade = 0;
|
||||
|
||||
public Tacx(BlePeripheralInfo peripheralInfo, BleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
|
||||
public Tacx(BlePeripheralInfo peripheralInfo, IBleWinHwInterface bleWinHwInterface) : base(peripheralInfo, bleWinHwInterface, Ant.SensorType.Trainer)
|
||||
{
|
||||
tacxFecNotify = new TacxFecNotify();
|
||||
base.Characteristics.Add(tacxFecNotify);
|
||||
@@ -75,7 +76,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
}
|
||||
}
|
||||
|
||||
private void CharacteristicReadMainCallback(BleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
private void CharacteristicReadMainCallback(IBleWinHwInterface hwInterface, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
|
||||
{
|
||||
foreach (var item in base.Characteristics)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user