Esempio n. 1
0
        private PendingUsbPermission CreateUsbPermission(Context context, UsbDeviceStatus usbDeviceStatus)
        {
            PendingIntent        mPendingIntent       = PendingIntent.GetBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);
            PendingUsbPermission pendingUsbPermission = new PendingUsbPermission
            {
                pendingIntent   = mPendingIntent,
                usbDeviceStatus = usbDeviceStatus
            };

            return(pendingUsbPermission);
        }
Esempio n. 2
0
        internal void CreateAllPorts(UsbDeviceStatus usbDeviceStatus)
        {
            int interfaceCount = usbDeviceStatus.usbDevice.InterfaceCount;

            for (int i = 0; i <= interfaceCount - 1; i++)
            {
                if (usbDeviceStatus.usbDeviceConnection == null)
                {
                    usbDeviceStatus.usbDeviceConnection = usbManager.OpenDevice(usbDeviceStatus.usbDevice);
                }

                UsbSerialDevice usbSerialDevice = UsbSerialDevice.CreateUsbSerialDevice(
                    usbDeviceStatus.usbDevice,
                    usbDeviceStatus.usbDeviceConnection,
                    i);

                serialDevices.Add(usbSerialDevice);
            }
        }
Esempio n. 3
0
        public override bool Equals(object obj)
        {
            UsbDeviceStatus usbDeviceStatus = (UsbDeviceStatus)obj;

            return(usbDeviceStatus.usbDevice.DeviceId == usbDevice.DeviceId);
        }