usb_device.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. #ifndef USB_DEVICE_HPP
  9. #define USB_DEVICE_HPP
  10. #include "types.h"
  11. //////////////////////////////////////////////////////////////////////////////////
  12. // Public Definitions
  13. //////////////////////////////////////////////////////////////////////////////////
  14. #define USB_MAX_STRLEN 256
  15. #define USB_ANT_STICK_VID ((USHORT)0x0FCF)
  16. #define USB_ANT_STICK_PID ((USHORT)0x1004)
  17. #define USB_ANT_DEV_BOARD_PID ((USHORT)0x1006)
  18. #define USB_ANT_STICK2_PID ((USHORT)0x1008)
  19. struct DeviceType
  20. {
  21. enum Enum
  22. {
  23. SI_LABS = 1<<0,
  24. LIBUSB = 1<<1,
  25. IO_KIT = 1<<2,
  26. SI_LABS_IOKIT = 1<<3
  27. };
  28. };
  29. class USBDevice
  30. {
  31. public:
  32. //virtual BOOL Open(USBDeviceHandle*& pclDevicehandle) const = 0; //!!Make private with friend?
  33. virtual USHORT GetVid() const = 0;
  34. virtual USHORT GetPid() const = 0;
  35. virtual ULONG GetSerialNumber() const = 0;
  36. virtual BOOL GetProductDescription(UCHAR* /*pucProductDescription*/, USHORT /*usBufferSize*/) const = 0; //guaranteed to be null-terminated; pointer is valid until device is released
  37. virtual BOOL GetSerialString(UCHAR* /*pucSerialString*/, USHORT /*usBufferSize*/) const = 0;
  38. virtual DeviceType::Enum GetDeviceType() const = 0; //!!Or we could use a private enum!
  39. virtual BOOL USBReset() const = 0; //!!Should we change this to USBReEnumerate()?
  40. virtual ~USBDevice(){}
  41. protected:
  42. USBDevice(){}
  43. };
  44. #endif //USB_DEVICE_HPP