设备连接界面断开逻辑调整
This commit is contained in:
1 parent
46b6c7fa01
commit
6b3dd70c61
6 files changed
+58
-7
No files matched your search
@@ -544,5 +544,10 @@ namespace Assets.Scripts.Devices.Ant
|
||||
channel.closeChannel(500);
|
||||
channel.unassignChannel(500);
|
||||
}
|
||||
|
||||
public void Remove(AbstractAntDevice device)
|
||||
{
|
||||
discoveredDevices.Remove(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,18 @@ namespace Assets.Scripts.Devices.Ant
|
||||
return AntConnector.Instance().discoveredDevices;
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
var list = AntConnector.Instance().discoveredDevices.ToList();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.State == Ant.DeviceState.Disconnected)
|
||||
{
|
||||
AntConnector.Instance().Remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartScan()
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
|
||||
@@ -183,6 +183,19 @@ namespace Assets.Scripts.Devices.Ble
|
||||
}
|
||||
}
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
var list = discoveredDevices.ToList();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item.Value.State == Ant.DeviceState.Disconnected)
|
||||
{
|
||||
item.Value.Dispose();
|
||||
discoveredDevices.Remove(item.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除未连接的设备
|
||||
/// </summary>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Assets.Scripts.Devices
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public abstract void Refresh();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user