예제 #1
0
 public void Dispose()
 {
     _UsbDeviceConnection?.Dispose();
     _UsbDevice?.Dispose();
     _ReadEndpoint?.Dispose();
     _WriteEndpoint?.Dispose();
 }
        public void Close()
        {
            if (_IsClosing)
            {
                return;
            }
            _IsClosing = true;

            try
            {
                _UsbDeviceConnection?.Dispose();
                _UsbDevice?.Dispose();
                ReadUsbInterface?.Dispose();
                WriteUsbInterface?.Dispose();

                _UsbDeviceConnection = null;
                _UsbDevice           = null;
                ReadUsbInterface     = null;
                WriteUsbInterface    = null;
            }
            catch (Exception)
            {
                //TODO: Logging
            }

            _IsClosing = false;
        }
예제 #3
0
 public void Dispose()
 {
     if (NativeDevice != null)
     {
         NativeDevice.Dispose();
         NativeDevice = null;
     }
     if (Connection != null)
     {
         Connection.Dispose();
         Connection = null;
     }
     if (Endpoint != null)
     {
         Endpoint.Dispose();
         Endpoint = null;
     }
     if (EndpointWrite != null)
     {
         EndpointWrite.Dispose();
         EndpointWrite = null;
     }
     if (Manager != null)
     {
         Manager.Dispose();
         Manager = null;
     }
 }
예제 #4
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }
            disposed = true;

            UsbInterface.Dispose();
            _UsbDeviceConnection.Dispose();
        }
예제 #5
0
        public void Dispose()
        {
            if (disposed)
            {
                Logger.LogWarning(Messages.WarningMessageAlreadyDisposed, UsbInterface?.ToString());
                return;
            }

            disposed = true;

            Logger.LogInformation(Messages.InformationMessageDisposingDevice, UsbInterface?.ToString());

            UsbInterface.Dispose();
            _UsbDeviceConnection.Dispose();
        }
예제 #6
0
        public sealed override void Dispose()
        {
            if (disposed)
            {
                Logger.LogWarning(Messages.WarningMessageAlreadyDisposed, DeviceNumberId);
                return;
            }

            disposed = true;

            Logger.LogInformation(Messages.InformationMessageDisposingDevice, DeviceNumberId);

            Close();

            try
            {
                _UsbDeviceConnection?.Dispose();
                _UsbDevice?.Dispose();
                ReadUsbInterface?.Dispose();
                WriteUsbInterface?.Dispose();

                _UsbDeviceConnection = null;
                _UsbDevice           = null;
                ReadUsbInterface     = null;
                WriteUsbInterface    = null;
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, "Dispose error DeviceId: {deviceNumberId}", DeviceNumberId);
            }

            _InitializingSemaphoreSlim.Dispose();

            base.Dispose();

            GC.SuppressFinalize(this);
        }
예제 #7
0
 public void Dispose()
 {
     _UsbDeviceConnection?.Dispose();
     _UsbDevice?.Dispose();
 }