/// <summary> /// Closing and disposing all underlying resources. It cleans all included objects as well. /// It should be called as soon as the object is not needed anymore. After this call /// object is unusable - any further communication with the same device requires to create /// completely new BleDevice object from scratch. /// </summary> public async Task Close() { foreach (var ch in AllServices) { await ch.Close(); } AllServices.Clear(); if (LEDevice != null) { LEDevice.ConnectionStatusChanged -= ConnectionStatusChanged; } LEDevice?.Dispose(); LEDevice = null; DeviceInfo = null; }