usb_device.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_HPP
  11. #define USB_DEVICE_HPP
  12. #include "types.h"
  13. //////////////////////////////////////////////////////////////////////////////////
  14. // Public Definitions
  15. //////////////////////////////////////////////////////////////////////////////////
  16. #define USB_MAX_STRLEN 256
  17. #define USB_ANT_STICK_VID ((USHORT)0x0FCF)
  18. #define USB_ANT_STICK_PID ((USHORT)0x1004)
  19. #define USB_ANT_DEV_BOARD_PID ((USHORT)0x1006)
  20. #define USB_ANT_STICK2_PID ((USHORT)0x1008)
  21. struct DeviceType
  22. {
  23. enum Enum
  24. {
  25. SI_LABS = 1<<0,
  26. LIBUSB = 1<<1,
  27. IO_KIT = 1<<2,
  28. SI_LABS_IOKIT = 1<<3
  29. };
  30. };
  31. class USBDevice
  32. {
  33. public:
  34. //virtual BOOL Open(USBDeviceHandle*& pclDevicehandle) const = 0; //!!Make private with friend?
  35. virtual USHORT GetVid() const = 0;
  36. virtual USHORT GetPid() const = 0;
  37. virtual ULONG GetSerialNumber() const = 0;
  38. virtual BOOL GetProductDescription(UCHAR* /*pucProductDescription*/, USHORT /*usBufferSize*/) const = 0; //guaranteed to be null-terminated; pointer is valid until device is released
  39. virtual BOOL GetSerialString(UCHAR* /*pucSerialString*/, USHORT /*usBufferSize*/) const = 0;
  40. virtual DeviceType::Enum GetDeviceType() const = 0; //!!Or we could use a private enum!
  41. virtual BOOL USBReset() const = 0; //!!Should we change this to USBReEnumerate()?
  42. virtual ~USBDevice(){}
  43. protected:
  44. USBDevice(){}
  45. };
  46. #endif //USB_DEVICE_HPP