00001 /*************************************************************************** 00002 LOW_portUsb_Factory.h - description 00003 ------------------- 00004 begin : Sun Oct 12 2003 00005 copyright : (C) 2003 by Harald Roelle 00006 email : roelle@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef LOW_PORTUSB_FACTORY_H 00019 #define LOW_PORTUSB_FACTORY_H 00020 00021 00022 #include <string> 00023 00024 00025 #include "LOW_portUsbDevice.h" 00026 00027 00028 /** Factory class for platform specific objects related to USB devices. 00029 00030 This class also contains platform specific type definitions. 00031 00032 This class is thread-safe. 00033 00034 @see LOW_portUsbDevice 00035 00036 @author Harald Roelle 00037 */ 00038 class LOW_portUsb_Factory { 00039 00040 //======================================================================================= 00041 public: 00042 00043 //===================================================================================== 00044 // 00045 // type definitions 00046 // 00047 00048 #ifdef __linux__ 00049 00050 /** Linux specific type to identify a specific USB device. */ 00051 typedef std::string usbDeviceSpecifier_t; 00052 00053 #endif 00054 00055 /** Vector type of USB device specifiers. */ 00056 typedef std::vector<usbDeviceSpecifier_t> usbDevSpecVec_t; 00057 00058 00059 00060 //===================================================================================== 00061 // 00062 // static factory 00063 // 00064 00065 /** Get a list of port specifiers of devices with a certain vendor and product ID. 00066 00067 @param inVendorID Vendor for new USB device instance. 00068 @param inProductID Product for new USB device instance. 00069 00070 @return List of port specifiers. 00071 */ 00072 static usbDevSpecVec_t getPortSpecifiers( const LOW_portUsbDevice::usbVendorID_t inVendorID, 00073 const LOW_portUsbDevice::usbProductID_t inProductID); 00074 00075 00076 /** Platform aware replacement for creating dynamic instances of LOW_portUsbDevice. 00077 00078 @param inPortSpec Unique identifier for new USB device instance. 00079 00080 @return Pointer to new instance of LOW_portUsbDevice. 00081 */ 00082 static LOW_portUsbDevice* new_portUsbDevice( const usbDeviceSpecifier_t inUsbDevSpec); 00083 00084 00085 00086 //======================================================================================= 00087 private: 00088 00089 //===================================================================================== 00090 // 00091 // constructors 00092 // 00093 00094 /** Constructor. 00095 Private to prevent instaciation as this is a static factory. 00096 */ 00097 LOW_portUsb_Factory(); 00098 00099 /** Destructor. 00100 Private to prevent instaciation as this is a static factory. 00101 */ 00102 virtual ~LOW_portUsb_Factory(); 00103 00104 }; 00105 00106 #endif 00107