usbwrap_libusb_1_0.h

Go to the documentation of this file.
00001 ///
00002 /// \file       usbwrap_libusb_1_0.h
00003 ///             USB API wrapper for libusb version 1.0
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 #ifndef __SB_USBWRAP_LIBUSB_1_0_H__
00024 #define __SB_USBWRAP_LIBUSB_1_0_H__
00025 
00026 #include "usbwrap.h"
00027 #include <libusb.h>
00028 
00029 #if defined( WIN32 )
00030 // On Windows systems, libusb.h includes <windows.h> which defines min/max,
00031 // which causes trouble for other headers
00032 #undef min
00033 #undef max
00034 #endif
00035 
00036 namespace Usb
00037 {
00038 
00039 class DeviceIDImpl
00040 {
00041 public: 
00042         libusb_device *m_dev;
00043         std::string m_busname;
00044         std::string m_filename;
00045 public:
00046         DeviceIDImpl(libusb_device *dev);
00047         ~DeviceIDImpl();
00048 };
00049 
00050 struct DeviceHandle
00051 {
00052         libusb_device_handle *m_handle;
00053 };
00054 
00055 struct DeviceListImpl
00056 {
00057         libusb_device** m_list;
00058         ssize_t m_listcnt;
00059         std::vector<DeviceID> m_devices;
00060 };
00061 
00062 struct EndpointDescriptorImpl
00063 {
00064         const struct libusb_endpoint_descriptor* m_desc;
00065 };
00066 
00067 struct InterfaceDescriptorImpl
00068 {
00069         const struct libusb_interface_descriptor* m_desc;
00070 };
00071 
00072 struct ConfigDescriptorImpl
00073 {
00074         struct libusb_config_descriptor* m_desc;
00075 };
00076 
00077 struct DeviceDescriptorImpl
00078 {
00079         struct libusb_device_descriptor m_desc;
00080         DeviceID m_devid;
00081 };
00082 
00083 }; // namespace Usb
00084 
00085 #endif // __SB_USBWRAP_LIBUSB_1_0_H__