public partial ValueTask DisposeAsync() { session.Dispose(); device.Dispose(); // TODO: wait for disconnect return(ValueTask.CompletedTask); }
/// <summary> /// Stops the device from listening and resets. /// </summary> public void StopListening() { if (device != null) { OnDisconnect(); gattSession?.Dispose(); gattSession = null; if (device != null) { device.ConnectionStatusChanged -= Device_ConnectionStatusChanged; } device?.Dispose(); device = null; } }
public void Dispose() { if (mBluetoothGatt != null) { mBluetoothGatt.MaintainConnection = false; mBluetoothGatt.Dispose(); mBluetoothGatt = null; } if (bluetoothLeDevice != null) { bluetoothLeDevice.Dispose(); bluetoothLeDevice = null; } }