#include <UsbDevice.h>
Classes | |
class | Location |
struct | UsbIds |
Public Types | |
typedef boost::function< void(const void *data, int size) | Callback ) |
Public Member Functions | |
int | bulkRead (void *data, int size, unsigned char endpoint, int timeout) |
bool | bulkWrite (const void *data, int size, unsigned char endpoint, int timeout) |
void | close () |
int | getLastError (std::string &str) const |
Location | getLocation () const |
int | interruptRead (void *data, int size, unsigned char endpoint, int timeout) |
bool | interruptWrite (const void *data, int size, unsigned char endpoint, int timeout) |
bool | isOpen () const |
void | listDevices (std::vector< Location > &list) const |
bool | open (const Location &location=Location()) |
void | setDebugLevel (uint8_t level) |
void | setDevceIds (uint16_t vid, uint16_t pid, uint8_t mi) |
void | startBulkReadThread (Callback callback, unsigned char endpoint) |
void | startinterruptReadThread (Callback callback, unsigned char endpoint) |
void | stopBulkReadThread (unsigned char endpoint) |
void | stopInterruptReadThread (unsigned char endpoint) |
UsbDevice (uint16_t vid, uint16_t pid, uint8_t mi) | |
UsbDevice (uint16_t vid, uint16_t pid) | |
UsbDevice () | |
~UsbDevice () | |
Static Public Member Functions | |
static void | listDevices (const std::vector< UsbIds > &ids, std::vector< Location > &list) |
static void | listDevices (uint16_t vid, uint16_t pid, std::vector< Location > &list) |
Public Attributes | |
bool | throw_errors_ |
Private Member Functions | |
void | bulkReadThread (Callback callback, unsigned char endpoint) |
void | closeDevice () |
bool | handleError (int err) |
void | init () |
void | interruptReadThread (Callback callback, unsigned char endpoint) |
void | throwError (int err) |
Private Attributes | |
boost::thread | bulk_threads_ [128] |
bool | bulk_threads_enable_ [128] |
libusb_context * | ctx_ |
int | error_code_ |
std::string | error_str_ |
boost::thread | interrupt_threads_ [128] |
bool | interrupt_threads_enable_ [128] |
libusb_device_handle * | libusb_handle_ |
Location | location_ |
uint8_t | mi_ |
bool | open_ |
uint16_t | pid_ |
uint16_t | vid_ |
Definition at line 58 of file UsbDevice.h.
typedef boost::function<void(const void *data, int size) lusb::UsbDevice::Callback) |
Definition at line 137 of file UsbDevice.h.
lusb::UsbDevice::UsbDevice | ( | uint16_t | vid, |
uint16_t | pid, | ||
uint8_t | mi | ||
) |
Definition at line 118 of file UsbDevice.cpp.
lusb::UsbDevice::UsbDevice | ( | uint16_t | vid, |
uint16_t | pid | ||
) |
Definition at line 123 of file UsbDevice.cpp.
Definition at line 128 of file UsbDevice.cpp.
Definition at line 133 of file UsbDevice.cpp.
int lusb::UsbDevice::bulkRead | ( | void * | data, |
int | size, | ||
unsigned char | endpoint, | ||
int | timeout | ||
) |
Definition at line 261 of file UsbDevice.cpp.
void lusb::UsbDevice::bulkReadThread | ( | Callback | callback, |
unsigned char | endpoint | ||
) | [private] |
Definition at line 295 of file UsbDevice.cpp.
bool lusb::UsbDevice::bulkWrite | ( | const void * | data, |
int | size, | ||
unsigned char | endpoint, | ||
int | timeout | ||
) |
Definition at line 248 of file UsbDevice.cpp.
void lusb::UsbDevice::close | ( | ) |
Definition at line 227 of file UsbDevice.cpp.
void lusb::UsbDevice::closeDevice | ( | ) | [private] |
Definition at line 236 of file UsbDevice.cpp.
int lusb::UsbDevice::getLastError | ( | std::string & | str | ) | const |
Definition at line 92 of file UsbDevice.cpp.
Location lusb::UsbDevice::getLocation | ( | ) | const [inline] |
Definition at line 130 of file UsbDevice.h.
bool lusb::UsbDevice::handleError | ( | int | err | ) | [private] |
Definition at line 51 of file UsbDevice.cpp.
void lusb::UsbDevice::init | ( | ) | [private] |
Definition at line 105 of file UsbDevice.cpp.
int lusb::UsbDevice::interruptRead | ( | void * | data, |
int | size, | ||
unsigned char | endpoint, | ||
int | timeout | ||
) |
Definition at line 284 of file UsbDevice.cpp.
void lusb::UsbDevice::interruptReadThread | ( | Callback | callback, |
unsigned char | endpoint | ||
) | [private] |
Definition at line 312 of file UsbDevice.cpp.
bool lusb::UsbDevice::interruptWrite | ( | const void * | data, |
int | size, | ||
unsigned char | endpoint, | ||
int | timeout | ||
) |
Definition at line 271 of file UsbDevice.cpp.
bool lusb::UsbDevice::isOpen | ( | ) | const [inline] |
Definition at line 129 of file UsbDevice.h.
void lusb::UsbDevice::listDevices | ( | const std::vector< UsbIds > & | ids, |
std::vector< Location > & | list | ||
) | [static] |
Definition at line 155 of file UsbDevice.cpp.
void lusb::UsbDevice::listDevices | ( | uint16_t | vid, |
uint16_t | pid, | ||
std::vector< Location > & | list | ||
) | [static] |
Definition at line 149 of file UsbDevice.cpp.
void lusb::UsbDevice::listDevices | ( | std::vector< Location > & | list | ) | const |
Definition at line 184 of file UsbDevice.cpp.
bool lusb::UsbDevice::open | ( | const Location & | location = Location() | ) |
Definition at line 189 of file UsbDevice.cpp.
void lusb::UsbDevice::setDebugLevel | ( | uint8_t | level | ) |
Definition at line 97 of file UsbDevice.cpp.
void lusb::UsbDevice::setDevceIds | ( | uint16_t | vid, |
uint16_t | pid, | ||
uint8_t | mi | ||
) |
Definition at line 142 of file UsbDevice.cpp.
void lusb::UsbDevice::startBulkReadThread | ( | Callback | callback, |
unsigned char | endpoint | ||
) |
Definition at line 338 of file UsbDevice.cpp.
void lusb::UsbDevice::startinterruptReadThread | ( | Callback | callback, |
unsigned char | endpoint | ||
) |
Definition at line 354 of file UsbDevice.cpp.
void lusb::UsbDevice::stopBulkReadThread | ( | unsigned char | endpoint | ) |
Definition at line 330 of file UsbDevice.cpp.
void lusb::UsbDevice::stopInterruptReadThread | ( | unsigned char | endpoint | ) |
Definition at line 345 of file UsbDevice.cpp.
void lusb::UsbDevice::throwError | ( | int | err | ) | [private] |
Definition at line 84 of file UsbDevice.cpp.
boost::thread lusb::UsbDevice::bulk_threads_[128] [private] |
Definition at line 166 of file UsbDevice.h.
bool lusb::UsbDevice::bulk_threads_enable_[128] [private] |
Definition at line 167 of file UsbDevice.h.
libusb_context* lusb::UsbDevice::ctx_ [private] |
Definition at line 165 of file UsbDevice.h.
int lusb::UsbDevice::error_code_ [private] |
Definition at line 156 of file UsbDevice.h.
std::string lusb::UsbDevice::error_str_ [private] |
Definition at line 157 of file UsbDevice.h.
boost::thread lusb::UsbDevice::interrupt_threads_[128] [private] |
Definition at line 168 of file UsbDevice.h.
bool lusb::UsbDevice::interrupt_threads_enable_[128] [private] |
Definition at line 169 of file UsbDevice.h.
libusb_device_handle* lusb::UsbDevice::libusb_handle_ [private] |
Definition at line 164 of file UsbDevice.h.
Location lusb::UsbDevice::location_ [private] |
Definition at line 163 of file UsbDevice.h.
uint8_t lusb::UsbDevice::mi_ [private] |
Definition at line 161 of file UsbDevice.h.
bool lusb::UsbDevice::open_ [private] |
Definition at line 162 of file UsbDevice.h.
uint16_t lusb::UsbDevice::pid_ [private] |
Definition at line 160 of file UsbDevice.h.
Definition at line 143 of file UsbDevice.h.
uint16_t lusb::UsbDevice::vid_ [private] |
Definition at line 159 of file UsbDevice.h.