修复设备选择界面多设备选择bug

This commit is contained in:
suntao committed 2021-06-04 18:28:11 +08:00
1 parent 7729332f41
commit 5671b35dce
21 files changed
+111 -56

No files matched your search

@@ -266,9 +266,19 @@ namespace Assets.Scripts.Ble
private void GattConnected(WclBleGattThread gattClient, BleResponse response)
{
Debug.Log($"gatt connected { response.ToString() }");
if (!response.IsSuccess)
{
gattClient.Stop();
return;
}
this.callbacks[gattClient.Peripheral].Invoke(this, gattClient.Peripheral, response);
}
private void CleanUpPeripheral(BlePeripheralInfo peripheralInfo)
{
//this.callbacks.Clear()
}
private void GattDisconnected(WclBleGattThread gattClient, BleResponse response)
{
Debug.Log("gatt disconnected");
@@ -326,7 +336,7 @@ namespace Assets.Scripts.Ble
}
private void GattCharacteristicChanged(WclBleGattThread gattClient, BleCharacteristicInfo characteristic, BleResponse<byte[]> response)
{
Debug.Log("characteristic changed");
//Debug.Log("characteristic changed");
if(this.wclBleMainThread.GetGattThread(characteristic.Peripheral) != null)
{
this.characteristicReadEvent.Invoke(this, characteristic, response);
@@ -418,7 +428,7 @@ namespace Assets.Scripts.Ble
public void Dispose()
{
this.wclBleMainThread.Dispose();
this.wclBleMainThread.Stop();
this.wclBleMainThread = null;
hwInterface = null;
pCache.Clear();
@@ -98,7 +98,7 @@ namespace Assets.Scripts.Devices.Ble.Win
});
}
public void Dispose()
public void Stop()
{
Debug.Log("停止thread");
foreach (var item in this.gattClients.Values)