21 #ifndef LIBS_USB_HOTPLUGAGENT_H_
22 #define LIBS_USB_HOTPLUGAGENT_H_
26 #include <ola/thread/PeriodicThread.h>
31 #include "libs/usb/LibUsbAdaptor.h"
32 #include "libs/usb/LibUsbThread.h"
33 #include "libs/usb/Types.h"
117 #ifdef HAVE_LIBUSB_HOTPLUG_API
128 void HotPlugEvent(
struct libusb_device *dev,
129 libusb_hotplug_event event);
130 #endif // HAVE_LIBUSB_HOTPLUG_API
133 typedef std::map<USBDeviceID, struct libusb_device*> DeviceMap;
135 std::auto_ptr<NotificationCallback>
const m_notification_cb;
136 const int m_debug_level;
138 libusb_context *m_context;
139 std::auto_ptr<ola::usb::LibUsbThread> m_usb_thread;
140 std::auto_ptr<ola::usb::AsyncronousLibUsbAdaptor> m_usb_adaptor;
141 std::auto_ptr<ola::thread::PeriodicThread> m_scanner_thread;
144 bool m_suppress_hotplug_events;
153 bool HotplugSupported();
154 bool ScanUSBDevices();
160 #endif // LIBS_USB_HOTPLUGAGENT_H_
~HotplugAgent()
Destructor.
Definition: HotplugAgent.cpp:69
HotplugAgent(NotificationCallback *notification_cb, int debug_level)
Create a new HotplugAgent.
Definition: HotplugAgent.cpp:60
ola::Callback2< void, EventType, struct libusb_device * > NotificationCallback
Called when a USB device has been added or removed.
Definition: HotplugAgent.h:61
Detects when USB devices are added or removed.
Definition: HotplugAgent.h:45
EventType
Definition: HotplugAgent.h:47
The device ws removed.
Definition: HotplugAgent.h:49
bool Start()
Start the hotplug agent.
Definition: HotplugAgent.cpp:104
bool Stop()
Stop the HotplugAgent.
Definition: HotplugAgent.cpp:138
A LibUsbAdaptor for use with Asyncronous widgets.
Definition: LibUsbAdaptor.h:563
A 2 argument callback which can be called multiple times.
Definition: Callback.h:1895
AsyncronousLibUsbAdaptor * GetUSBAdaptor() const
Get the AsyncronousLibUsbAdaptor to use.
Definition: HotplugAgent.cpp:75
void HaltNotifications()
Prevent any further notifications from occuring.
Definition: HotplugAgent.cpp:123
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
bool Init()
Initialize the hotplug agent.
Definition: HotplugAgent.cpp:79
The device was added.
Definition: HotplugAgent.h:48