21 #ifndef PLUGINS_USBDMX_ASYNCPLUGINIMPL_H_
22 #define PLUGINS_USBDMX_ASYNCPLUGINIMPL_H_
38 #include "ola/thread/Mutex.h"
39 #include "ola/thread/Thread.h"
40 #include "plugins/usbdmx/PluginImplInterface.h"
41 #include "plugins/usbdmx/SyncronizedWidgetObserver.h"
42 #include "plugins/usbdmx/WidgetFactory.h"
66 unsigned int debug_level);
72 #ifdef HAVE_LIBUSB_HOTPLUG_API
83 void HotPlugEvent(
struct libusb_device *dev,
84 libusb_hotplug_event event);
100 typedef std::vector<class WidgetFactory*> WidgetFactories;
101 typedef std::map<struct libusb_device*, WidgetFactory*> USBDeviceToFactoryMap;
102 typedef std::map<class Widget*, Device*> WidgetToDeviceMap;
103 typedef std::pair<uint8_t, uint8_t> USBDeviceID;
104 typedef std::map<USBDeviceID, struct libusb_device*> USBDeviceIDs;
108 const unsigned int m_debug_level;
112 libusb_context *m_context;
115 bool m_suppress_hotplug_events;
116 std::auto_ptr<class LibUsbThread> m_usb_thread;
117 std::auto_ptr<class LibUsbAdaptor> m_usb_adaptor;
119 WidgetFactories m_widget_factories;
120 USBDeviceToFactoryMap m_device_factory_map;
121 WidgetToDeviceMap m_widget_device_map;
125 USBDeviceIDs m_seen_usb_devices;
127 bool HotplugSupported();
128 bool USBDeviceAdded(libusb_device *device);
129 void USBDeviceRemoved(libusb_device *device);
131 bool StartAndRegisterDevice(
class Widget *widget,
Device *device);
132 void RemoveWidget(
class Widget *widget);
134 bool ScanUSBDevices();
141 #endif // PLUGINS_USBDMX_ASYNCPLUGINIMPL_H_