蓝牙问题
This commit is contained in:
1 parent
561ad993b8
commit
9511e30e50
3 files changed
+27
-6
No files matched your search
@@ -1,6 +1,8 @@
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.Ble.Service;
|
||||
using Assets.Scripts.Devices;
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.Devices.Ble;
|
||||
@@ -40,6 +42,11 @@ public class RowerHomeScript : PFUIPanel
|
||||
return null;
|
||||
}
|
||||
}
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
Debug.Log("銷毀");
|
||||
|
||||
}
|
||||
private IRowerDevice Rower
|
||||
{
|
||||
get
|
||||
@@ -81,6 +88,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
bool isPause = false;
|
||||
protected override void Awake()
|
||||
{
|
||||
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
{
|
||||
{"Start",Resources.Load<Sprite>("Images/Rower/System_play")},
|
||||
@@ -122,9 +130,21 @@ public class RowerHomeScript : PFUIPanel
|
||||
var mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowRowerTab();
|
||||
transform.MyDOFade();
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
Init();
|
||||
//transform.Find("Left/Rower").GetComponent<RowerAnimation>().StartAnimation();
|
||||
}
|
||||
void Disconnect()
|
||||
{
|
||||
foreach(var d in App.MainDeviceAdapter.GetDevices())
|
||||
{
|
||||
if ((d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && (d.Sensor == SensorType.Rower || d.Sensor == SensorType.HeartRate))
|
||||
{
|
||||
d.Disconnect();
|
||||
}
|
||||
}
|
||||
App.MainDeviceAdapter.StopScan();
|
||||
}
|
||||
private void HandleStartOrPause()
|
||||
{
|
||||
//UIManager.ShowRowerResult();
|
||||
@@ -244,6 +264,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
Debug.Log(ex.Message);
|
||||
}
|
||||
UIManager.ShowRowerWelldone(model);
|
||||
Disconnect();
|
||||
Task.Run(()=>
|
||||
{
|
||||
var res = ConfigHelper.rowerApi.Add(model, files);
|
||||
@@ -294,6 +315,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
Utils.showToast(null, "Please end this training.");
|
||||
return;
|
||||
}
|
||||
Disconnect();
|
||||
UIManager.ShowHomePanel();
|
||||
}
|
||||
|
||||
@@ -416,5 +438,4 @@ public class RowerHomeScript : PFUIPanel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user