comparison USBLib/Communication/IUsbDeviceRegistry.cs @ 21:dcfec2be27c9

Added USBLib
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 15 Apr 2013 01:04:59 +0200
parents
children 99ed461509fe
comparison
equal deleted inserted replaced
20:c873e3dd73fe 21:dcfec2be27c9
1 using System;
2 using System.Collections.Generic;
3 using UCIS.USBLib.Communication.LibUsb;
4 using UCIS.USBLib.Communication.LibUsb1;
5 using UCIS.USBLib.Communication.WinUsb;
6
7 namespace UCIS.USBLib.Communication {
8 public interface IUsbDeviceRegistry {
9 IDictionary<String, Object> DeviceProperties { get; }
10 Int32 Vid { get; }
11 Int32 Pid { get; }
12 Byte InterfaceID { get; }
13
14 String Name { get; } //Device product name (or null if not available)
15 String Manufacturer { get; } //Device manufacturer name (or null if not available)
16 String FullName { get; } //Device manufacturer name and product name
17 String SymbolicName { get; } //Arbitrary string that uniquely identifies the device
18
19 IUsbDevice Open();
20 }
21 public static class UsbDevice {
22 public static IList<IUsbDeviceRegistry> AllDevices {
23 get {
24 List<IUsbDeviceRegistry> list = new List<IUsbDeviceRegistry>();
25 if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
26 foreach (IUsbDeviceRegistry reg in WinUsbRegistry.DeviceList) list.Add(reg);
27 foreach (IUsbDeviceRegistry reg in LibUsb0Registry.DeviceList) list.Add(reg);
28 } else {
29 foreach (IUsbDeviceRegistry reg in LibUsb1Registry.DeviceList) list.Add(reg);
30 }
31 return list;
32 }
33 }
34 }
35 }