usb_device_si.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_SI_HPP
  9. #define USB_DEVICE_SI_HPP
  10. #include "types.h"
  11. #include "macros.h"
  12. #include "DSI_SiUSBXp_3_1.h"
  13. #include "dsi_silabs_library.hpp"
  14. #include "usb_device.hpp"
  15. #include <memory>
  16. //////////////////////////////////////////////////////////////////////////////////
  17. // Public Definitions
  18. //////////////////////////////////////////////////////////////////////////////////
  19. //////////////////////////////////////////////////////////////////////////////////
  20. // Public Class Prototypes
  21. //////////////////////////////////////////////////////////////////////////////////
  22. //!!Should USBDeviceSI also hold the product description used to find device?
  23. class USBDeviceSI : public USBDevice
  24. {
  25. public:
  26. USBDeviceSI(UCHAR ucDeviceNumber_);
  27. USBDeviceSI(const USBDeviceSI& clDevice_);
  28. USBDeviceSI& operator=(const USBDeviceSI& clDevice_);
  29. UCHAR GetDeviceNumber() const { return ucDeviceNumber; }
  30. //std::auto_ptr<USBDevice> MakeCopy() const { return auto_ptr<USBDevice>(new USBDeviceSI(*this)); } //!!
  31. //Implementation of Device Interface
  32. BOOL USBReset() const;
  33. USHORT GetVid() const { return usVid; }
  34. USHORT GetPid() const { return usPid; }
  35. ULONG GetSerialNumber() const { return ulSerialNumber; }
  36. BOOL GetProductDescription(UCHAR* pucProductDescription_, USHORT usBufferSize_) const; //guaranteed to be null-terminated
  37. BOOL GetSerialString(UCHAR* pucSerialString_, USHORT usBufferSize_) const;
  38. DeviceType::Enum GetDeviceType() const { return DeviceType::SI_LABS; }
  39. private:
  40. BOOL GetDeviceSerialNumber(ULONG& ulSerialNumber_);
  41. UCHAR ucDeviceNumber;
  42. USHORT usVid;
  43. USHORT usPid;
  44. ULONG ulSerialNumber;
  45. UCHAR szProductDescription[SI_MAX_DEVICE_STRLEN];
  46. UCHAR szSerialString[SI_MAX_DEVICE_STRLEN];
  47. };
  48. #endif // !defined(USB_DEVICE_SI_HPP)