usb_device_libusb.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Dynastream Innovations Inc.
  3. * Cochrane, AB, CANADA
  4. *
  5. * Copyright © 1998-2008 Dynastream Innovations Inc.
  6. * All rights reserved. This software may not be reproduced by
  7. * any means without express written approval of Dynastream
  8. * Innovations Inc.
  9. */
  10. #ifndef USB_DEVICE_LIBUSB_HPP
  11. #define USB_DEVICE_LIBUSB_HPP
  12. #include "types.h"
  13. #include "dsi_libusb_library.hpp"
  14. #include "usb_device.hpp"
  15. //////////////////////////////////////////////////////////////////////////////////
  16. // Public Definitions
  17. //////////////////////////////////////////////////////////////////////////////////
  18. //!!What happens if we release the list we got this device from?
  19. class USBDeviceLibusb : public USBDevice
  20. {
  21. public:
  22. USBDeviceLibusb(struct usb_device& stDevice_);
  23. USBDeviceLibusb(const USBDeviceLibusb& clDevice_);
  24. USBDeviceLibusb& operator=(const USBDeviceLibusb& clDevice_);
  25. struct usb_device& GetRawDevice() const { return *pstDevice; }
  26. //USBDevice Base//
  27. BOOL USBReset() const;
  28. USHORT GetVid() const { return usVid; }
  29. USHORT GetPid() const { return usPid; }
  30. ULONG GetSerialNumber() const { return ulSerialNumber; }
  31. BOOL GetProductDescription(UCHAR* pucProductDescription_, USHORT usBufferSize_) const; //guaranteed to be null-terminated
  32. BOOL GetSerialString(UCHAR* pucSerialString_, USHORT usBufferSize_) const;
  33. DeviceType::Enum GetDeviceType() const { return DeviceType::LIBUSB; }
  34. //std::auto_ptr<USBDevice> MakeCopy() const { return auto_ptr<USBDevice>(new USBDeviceSI(*this)); }
  35. ////
  36. private:
  37. BOOL GetDeviceSerialNumber(ULONG& ulSerialNumber_);
  38. struct usb_device* pstDevice; //should we copy instead?
  39. USHORT usVid;
  40. USHORT usPid;
  41. ULONG ulSerialNumber;
  42. UCHAR szProductDescription[USB_MAX_STRLEN];
  43. UCHAR szSerialString[USB_MAX_STRLEN];
  44. };
  45. #endif // !defined(USB_DEVICE_LIBUSB_HPP)