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);
102 typedef std::vector<class WidgetFactory*> WidgetFactories;
103 typedef std::map<struct libusb_device*, WidgetFactory*> USBDeviceToFactoryMap;
104 typedef std::map<class Widget*, Device*> WidgetToDeviceMap;
105 typedef std::pair<uint8_t, uint8_t> USBDeviceID;
106 typedef std::map<USBDeviceID, struct libusb_device*> USBDeviceIDs;
110 const unsigned int m_debug_level;
114 libusb_context *m_context;
117 bool m_suppress_hotplug_events;
118 std::auto_ptr<class LibUsbThread> m_usb_thread;
119 std::auto_ptr<class AsyncronousLibUsbAdaptor> m_usb_adaptor;
121 WidgetFactories m_widget_factories;
122 USBDeviceToFactoryMap m_device_factory_map;
123 WidgetToDeviceMap m_widget_device_map;
127 USBDeviceIDs m_seen_usb_devices;
129 bool HotplugSupported();
130 bool USBDeviceAdded(libusb_device *device);
131 void USBDeviceRemoved(libusb_device *device);
133 bool StartAndRegisterDevice(
class Widget *widget,
Device *device);
134 void RemoveWidget(
class Widget *widget);
136 bool ScanUSBDevices();
143 #endif // PLUGINS_USBDMX_ASYNCPLUGINIMPL_H_