21#ifndef LIBS_USB_LIBUSBTHREAD_H_
22#define LIBS_USB_LIBUSBTHREAD_H_
31#include "ola/thread/Thread.h"
126 libusb_context*
Context()
const {
return m_context; }
129 libusb_context *m_context;
134#if HAVE_LIBUSB_HOTPLUG_API
139class LibUsbHotplugThread :
public LibUsbThread {
151 LibUsbHotplugThread(libusb_context *context,
152 libusb_hotplug_callback_fn callback_fn,
161 void CloseHandle(libusb_device_handle *handle);
164 libusb_hotplug_callback_handle m_hotplug_handle;
165 libusb_hotplug_callback_fn m_callback_fn;
168 LibUsbHotplugThread(
const LibUsbHotplugThread &) =
delete;
169 const LibUsbHotplugThread &operator=(
const LibUsbHotplugThread &) =
delete;
201 unsigned int m_device_count;
The non-hotplug version of LibUsbThread.
Definition LibUsbThread.h:182
void OpenHandle()
This must be called whenever libusb_open() is called.
Definition LibUsbThread.cpp:112
LibUsbSimpleThread(libusb_context *context)
Create a new LibUsbHotplugThread.
Definition LibUsbThread.h:192
void CloseHandle(libusb_device_handle *handle)
This must be called whenever libusb_close() is called.
Definition LibUsbThread.cpp:119
The base class for the dedicated libusb thread.
Definition LibUsbThread.h:55
void JoinThread()
Join the libusb thread.
Definition LibUsbThread.cpp:54
void SetTerminate()
Indicate that the libusb thread should terminate.
Definition LibUsbThread.h:107
virtual void CloseHandle(libusb_device_handle *handle)=0
This must be called whenever libusb_close() is called.
virtual ~LibUsbThread()
Destructor.
Definition LibUsbThread.h:69
virtual void OpenHandle()=0
This must be called whenever libusb_open() is called.
LibUsbThread(libusb_context *context)
Base constructor.
Definition LibUsbThread.h:61
void LaunchThread()
Start the libusb thread.
Definition LibUsbThread.cpp:49
virtual bool Init()
Initialize the thread.
Definition LibUsbThread.h:74
void * Run()
The entry point to the libusb thread.
Definition LibUsbThread.cpp:34
virtual void Shutdown()
Shutdown the thread.
Definition LibUsbThread.h:81
libusb_context * Context() const
Return the libusb_context this thread uses.
Definition LibUsbThread.h:126
The namespace containing all OLA symbols.
Definition Credentials.cpp:44