Example #1
0
 internal LibUsbTransport(ILibUsbDevice usbDevice)
 {
     if (usbDevice == null)
     {
         throw new ArgumentNullException("usbDevice");
     }
     this.usbDevice = usbDevice;
 }
        public static IEnumerable <UsbBluetoothEndpointInfo> EnumerateBluetoothEndpointInfo(this ILibUsbDevice usbDevice)
        {
            var config0 = usbDevice.Configs.FirstOrDefault();

            if (config0 == null)
            {
                throw new WinBeaconException("USB device has no configurations");
            }

            var interface0Info = config0.InterfaceInfoList.FirstOrDefault();

            if (interface0Info == null)
            {
                throw new WinBeaconException("USB configuration does not contain an interface");
            }

            foreach (var endpointInfo in interface0Info.EndpointInfoList)
            {
                switch (endpointInfo.Descriptor.Attributes & 0x03)
                {
                case 0x02:
                    yield return(new UsbBluetoothEndpointInfo(
                                     type: (endpointInfo.Descriptor.EndpointID & 0x80) == 0x80 ? UsbBluetoothEndpointType.AclDataIn : UsbBluetoothEndpointType.AclDataOut,
                                     id: endpointInfo.Descriptor.EndpointID
                                     ));

                    break;

                case 0x03:
                    yield return(new UsbBluetoothEndpointInfo(
                                     type: UsbBluetoothEndpointType.Events,
                                     id: endpointInfo.Descriptor.EndpointID
                                     ));

                    break;
                }
            }
        }
Example #3
0
 internal LibUsbTransport(ILibUsbDevice usbDevice)
 {
     if (usbDevice == null)
         throw new ArgumentNullException("usbDevice");
     this.usbDevice = usbDevice;
 }
Example #4
0
 internal LibUsbTransport(ILibUsbDevice usbDevice)
 {
     _usbDevice = usbDevice ?? throw new ArgumentNullException(nameof(usbDevice));
 }