usbwrap_libusb.h

Go to the documentation of this file.
00001 ///
00002 /// \file       usbwrap_libusb.h
00003 ///             USB API wrapper for libusb version 0.1
00004 ///
00005 
00006 /*
00007     Copyright (C) 2005-2012, Chris Frey
00008     Portions Copyright (C) 2011, RealVNC Ltd.
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 
00019     See the GNU General Public License in the COPYING file at the
00020     root directory of this project for more details.
00021 */
00022 
00023 
00024 #ifndef __SB_USBWRAP_LIBUSB_H__
00025 #define __SB_USBWRAP_LIBUSB_H__
00026 
00027 #include "usbwrap.h"
00028 #include <string>
00029 
00030 #include <usb.h>
00031 
00032 #if defined( WIN32 )
00033 // On Windows systems, usb.h includes <windows.h> which defines min/max,
00034 // which causes trouble for other headers
00035 #undef min
00036 #undef max
00037 #endif
00038 
00039 namespace Usb
00040 {
00041 
00042 class DeviceIDImpl
00043 {
00044 public:
00045         struct usb_device* m_dev;
00046 };
00047 
00048 struct DeviceHandle
00049 {
00050         struct usb_dev_handle* m_handle;
00051 };
00052 
00053 struct DeviceListImpl
00054 {
00055         std::vector<DeviceID> m_devices;
00056 };
00057 
00058 struct EndpointDescriptorImpl
00059 {
00060         struct usb_endpoint_descriptor m_desc;
00061 };
00062 
00063 struct InterfaceDescriptorImpl
00064 {
00065         struct usb_interface_descriptor m_desc;
00066 };
00067 
00068 struct ConfigDescriptorImpl
00069 {
00070         struct usb_config_descriptor m_desc;
00071 };
00072 
00073 struct DeviceDescriptorImpl
00074 {
00075         struct usb_device* m_dev;
00076         struct usb_device_descriptor m_desc;
00077 };
00078 
00079 }; // namespace Usb
00080 
00081 #endif // __SB_USBWRAP_LIBUSB_H__