usb_device_si.hpp 2.0 KB

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