예제 #1
0
        private NanoDeviceBase FindNanoFrameworkDevice(string deviceId)
        {
            if (deviceId != null)
            {
                // usbMatch.Device.DeviceInformation
                return(NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoUsbDevice>).Device.DeviceInformation as UsbDeviceInformation).DeviceInformation.Id == deviceId));
            }

            return(null);
        }
예제 #2
0
        private NanoDeviceBase FindNanoFrameworkDevice(string deviceId)
        {
            if (deviceId != null)
            {
                // SerialMatch.Device.DeviceInformation
                return(NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).DeviceId) == deviceId));
            }

            return(null);
        }
예제 #3
0
        public override void DisposeDevice(string instanceId)
        {
            var deviceToDispose = NanoFrameworkDevices.FirstOrDefault(nanoDevice => ((NanoDevice <NanoSerialDevice>)nanoDevice).DeviceId == instanceId);

            if (deviceToDispose != null)
            {
                Task.Run(() =>
                {
                    ((NanoDevice <NanoSerialDevice>)deviceToDispose).Dispose();
                });
            }
        }
예제 #4
0
        private NanoDeviceBase FindNanoFrameworkDevice(string deviceId)
        {
            if (deviceId != null)
            {
                // SerialMatch.Device.DeviceInformation
                var device = NanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).Device.DeviceInformation as SerialDeviceInformation).DeviceInformation.Id == deviceId);

                if (device == null)
                {
                    // try now in tentative list
                    return(_tentativeNanoFrameworkDevices.FirstOrDefault(d => ((d as NanoDevice <NanoSerialDevice>).Device.DeviceInformation as SerialDeviceInformation).DeviceInformation.Id == deviceId));
                }
                else
                {
                    return(device);
                }
            }

            return(null);
        }