comparison USBLib/Windows/USB/UsbDevice.cs @ 65:abe0d55a2201

Removed some redundant USB communication code
author Ivo Smits <Ivo@UCIS.nl>
date Tue, 15 Oct 2013 16:19:45 +0200
parents 309c705d7460
children 2d16447eff12
comparison
equal deleted inserted replaced
64:99ed461509fe 65:abe0d55a2201
49 public int VendorID { get { return DeviceDescriptor.VendorID; } } 49 public int VendorID { get { return DeviceDescriptor.VendorID; } }
50 public int ProductID { get { return DeviceDescriptor.ProductID; } } 50 public int ProductID { get { return DeviceDescriptor.ProductID; } }
51 51
52 private String GetStringSafe(Byte id) { 52 private String GetStringSafe(Byte id) {
53 if (id == 0) return null; 53 if (id == 0) return null;
54 String s = GetString(id, 0); 54 String s = UsbStringDescriptor.GetStringFromDevice(this, id, 0);
55 if (s == null) return s; 55 if (s == null) return s;
56 return s.Trim(' ', '\0'); 56 return s.Trim(' ', '\0');
57 } 57 }
58 58
59 public string Manufacturer { get { return GetStringSafe(DeviceDescriptor.ManufacturerStringID); } } 59 public string Manufacturer { get { return GetStringSafe(DeviceDescriptor.ManufacturerStringID); } }
150 if (nBytes < 0) return 0; 150 if (nBytes < 0) return 0;
151 if (nBytes > 0) Buffer.BlockCopy(bigbuffer, szRequest, buffer, offset, nBytes); 151 if (nBytes > 0) Buffer.BlockCopy(bigbuffer, szRequest, buffer, offset, nBytes);
152 return nBytes; 152 return nBytes;
153 } 153 }
154 } 154 }
155 public String GetString(short langId, byte stringIndex) { 155 byte IUsbInterface.Configuration { get { return CurrentConfigurationValue; } }
156 return UsbStringDescriptor.GetStringFromDevice(this, stringIndex, langId); 156 byte IUsbDevice.Configuration { get { return CurrentConfigurationValue; } set { throw new NotSupportedException(); } }
157 } 157 void IUsbDevice.ResetDevice() { throw new NotImplementedException(); }
158 byte IUsbInterface.Configuration { get { throw new NotImplementedException(); } } 158 IUsbDeviceRegistry IUsbDevice.Registry { get { throw new NotImplementedException(); } }
159 void IUsbInterface.Close() { } 159 void IUsbInterface.Close() { }
160 int IUsbInterface.BulkWrite(byte endpoint, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 160 int IUsbInterface.BulkWrite(byte endpoint, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
161 int IUsbInterface.BulkRead(byte endpoint, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 161 int IUsbInterface.BulkRead(byte endpoint, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
162 void IUsbInterface.BulkReset(byte endpoint) { throw new NotImplementedException(); } 162 void IUsbInterface.BulkReset(byte endpoint) { throw new NotImplementedException(); }
163 int IUsbInterface.InterruptWrite(byte endpoint, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 163 int IUsbInterface.InterruptWrite(byte endpoint, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
164 int IUsbInterface.InterruptRead(byte endpoint, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 164 int IUsbInterface.InterruptRead(byte endpoint, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
165 void IUsbInterface.InterruptReset(byte endpoint) { throw new NotImplementedException(); } 165 void IUsbInterface.InterruptReset(byte endpoint) { throw new NotSupportedException(); }
166 int IUsbInterface.ControlWrite(UsbControlRequestType requestType, byte request, short value, short index, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 166 int IUsbInterface.ControlWrite(UsbControlRequestType requestType, byte request, short value, short index, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
167 int IUsbInterface.ControlRead(UsbControlRequestType requestType, byte request, short value, short index, byte[] buffer, int offset, int length) { throw new NotImplementedException(); } 167 int IUsbInterface.ControlRead(UsbControlRequestType requestType, byte request, short value, short index, byte[] buffer, int offset, int length) { throw new NotSupportedException(); }
168 UsbPipeStream IUsbInterface.GetBulkStream(byte endpoint) { throw new NotImplementedException(); } 168 UsbPipeStream IUsbInterface.GetBulkStream(byte endpoint) { throw new NotSupportedException(); }
169 UsbPipeStream IUsbInterface.GetInterruptStream(byte endpoint) { throw new NotImplementedException(); } 169 UsbPipeStream IUsbInterface.GetInterruptStream(byte endpoint) { throw new NotSupportedException(); }
170 void IDisposable.Dispose() { } 170 void IDisposable.Dispose() { }
171 byte IUsbDevice.Configuration { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
172 void IUsbDevice.ClaimInterface(int interfaceID) { } 171 void IUsbDevice.ClaimInterface(int interfaceID) { }
173 void IUsbDevice.ReleaseInterface(int interfaceID) { } 172 void IUsbDevice.ReleaseInterface(int interfaceID) { }
174 void IUsbDevice.ResetDevice() { throw new NotSupportedException(); }
175 IUsbDeviceRegistry IUsbDevice.Registry { get { throw new NotImplementedException(); } }
176 #endregion 173 #endregion
177 } 174 }
178 } 175 }