Пример #1
0
        public bool DisconnectDevice(UsbDevice usbDevice)
        {
            UsbSerialDevice optionalDevice = serialDevices.First(p => usbDevice.DeviceId == p.GetDeviceId());

            if (optionalDevice != null)
            {
                UsbSerialDevice disconnectedDevice = optionalDevice;
                disconnectedDevice.SyncClose();
                serialDevices.Remove(optionalDevice);
                serialPortBuilder.serialPortCallback.OnSerialPortsDetected(serialPortBuilder.serialDevices);

                return(true);
            }
            return(false);
        }
Пример #2
0
 public bool DisconnectDevice(UsbSerialDevice usbSerialDevice)
 {
     usbSerialDevice.SyncClose();
     serialDevices.Remove(usbSerialDevice);
     return(true);
 }