示例#1
0
        public UsbSerialDeviceManager(Context context, string actionUsbPermission, bool allowAnonymousCdcAmcDevices, UsbSerialDeviceList availableDeviceList)
#endif
        {
            if (context == null)
            {
                throw new ArgumentNullException();
            }
            if (string.IsNullOrEmpty(actionUsbPermission))
            {
                throw new ArgumentException();
            }
            if (availableDeviceList == null)
            {
                throw new ArgumentNullException();
            }

            Context                     = context;
            ActionUsbPermission         = actionUsbPermission;
            UsbManager                  = (UsbManager)context.GetSystemService(Context.UsbService);
            Receiver                    = new UsbSerialDeviceBroadcastReceiver(this, UsbManager, actionUsbPermission);
            AllowAnonymousCdcAcmDevices = allowAnonymousCdcAmcDevices;

            AvailableDeviceInfo = availableDeviceList.AvailableDeviceInfo;
            AttachedDevices     = new List <UsbSerialDevice>();

#if UseSmartThreadPool
            ThreadPool = threadPool;
#endif
        }
        public UsbSerialDeviceManager(Context context, string actionUsbPermission, bool allowAnonymousCdcAmcDevices, UsbSerialDeviceList availableDeviceList)
        {
            if (context == null)
                throw new ArgumentNullException();
            if (string.IsNullOrEmpty(actionUsbPermission))
                throw new ArgumentException();
            if (availableDeviceList == null)
                throw new ArgumentNullException();

            Context = context;
            ActionUsbPermission = actionUsbPermission;
            UsbManager = (UsbManager)context.GetSystemService(Context.UsbService);
            Receiver = new UsbSerialDeviceBroadcastReceiver(this, UsbManager, actionUsbPermission);
            AllowAnonymousCdcAcmDevices = allowAnonymousCdcAmcDevices;

            AvailableDeviceInfo = availableDeviceList.AvailableDeviceInfo;
            AttachedDevices = new List<UsbSerialDevice>();
        }