Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
lusb::UsbDevice Class Reference

#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 ()
 
 UsbDevice (uint16_t vid, uint16_t pid)
 
 UsbDevice (uint16_t vid, uint16_t pid, uint8_t mi)
 
 ~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_
 

Detailed Description

Definition at line 58 of file UsbDevice.h.

Member Typedef Documentation

◆ Callback

typedef boost::function<void(const void *data, int size)> lusb::UsbDevice::Callback

Definition at line 137 of file UsbDevice.h.

Constructor & Destructor Documentation

◆ UsbDevice() [1/3]

lusb::UsbDevice::UsbDevice ( uint16_t  vid,
uint16_t  pid,
uint8_t  mi 
)

Definition at line 126 of file UsbDevice.cpp.

◆ UsbDevice() [2/3]

lusb::UsbDevice::UsbDevice ( uint16_t  vid,
uint16_t  pid 
)

Definition at line 131 of file UsbDevice.cpp.

◆ UsbDevice() [3/3]

lusb::UsbDevice::UsbDevice ( )

Definition at line 136 of file UsbDevice.cpp.

◆ ~UsbDevice()

lusb::UsbDevice::~UsbDevice ( )

Definition at line 141 of file UsbDevice.cpp.

Member Function Documentation

◆ bulkRead()

int lusb::UsbDevice::bulkRead ( void *  data,
int  size,
unsigned char  endpoint,
int  timeout 
)

Definition at line 273 of file UsbDevice.cpp.

◆ bulkReadThread()

void lusb::UsbDevice::bulkReadThread ( Callback  callback,
unsigned char  endpoint 
)
private

Definition at line 307 of file UsbDevice.cpp.

◆ bulkWrite()

bool lusb::UsbDevice::bulkWrite ( const void *  data,
int  size,
unsigned char  endpoint,
int  timeout 
)

Definition at line 260 of file UsbDevice.cpp.

◆ close()

void lusb::UsbDevice::close ( )

Definition at line 239 of file UsbDevice.cpp.

◆ closeDevice()

void lusb::UsbDevice::closeDevice ( )
private

Definition at line 248 of file UsbDevice.cpp.

◆ getLastError()

int lusb::UsbDevice::getLastError ( std::string &  str) const

Definition at line 92 of file UsbDevice.cpp.

◆ getLocation()

Location lusb::UsbDevice::getLocation ( ) const
inline

Definition at line 130 of file UsbDevice.h.

◆ handleError()

bool lusb::UsbDevice::handleError ( int  err)
private

Definition at line 51 of file UsbDevice.cpp.

◆ init()

void lusb::UsbDevice::init ( )
private

Definition at line 109 of file UsbDevice.cpp.

◆ interruptRead()

int lusb::UsbDevice::interruptRead ( void *  data,
int  size,
unsigned char  endpoint,
int  timeout 
)

Definition at line 296 of file UsbDevice.cpp.

◆ interruptReadThread()

void lusb::UsbDevice::interruptReadThread ( Callback  callback,
unsigned char  endpoint 
)
private

Definition at line 324 of file UsbDevice.cpp.

◆ interruptWrite()

bool lusb::UsbDevice::interruptWrite ( const void *  data,
int  size,
unsigned char  endpoint,
int  timeout 
)

Definition at line 283 of file UsbDevice.cpp.

◆ isOpen()

bool lusb::UsbDevice::isOpen ( ) const
inline

Definition at line 129 of file UsbDevice.h.

◆ listDevices() [1/3]

void lusb::UsbDevice::listDevices ( const std::vector< UsbIds > &  ids,
std::vector< Location > &  list 
)
static

Definition at line 163 of file UsbDevice.cpp.

◆ listDevices() [2/3]

void lusb::UsbDevice::listDevices ( std::vector< Location > &  list) const

Definition at line 196 of file UsbDevice.cpp.

◆ listDevices() [3/3]

void lusb::UsbDevice::listDevices ( uint16_t  vid,
uint16_t  pid,
std::vector< Location > &  list 
)
static

Definition at line 157 of file UsbDevice.cpp.

◆ open()

bool lusb::UsbDevice::open ( const Location location = Location())

Definition at line 201 of file UsbDevice.cpp.

◆ setDebugLevel()

void lusb::UsbDevice::setDebugLevel ( uint8_t  level)

Definition at line 97 of file UsbDevice.cpp.

◆ setDevceIds()

void lusb::UsbDevice::setDevceIds ( uint16_t  vid,
uint16_t  pid,
uint8_t  mi 
)

Definition at line 150 of file UsbDevice.cpp.

◆ startBulkReadThread()

void lusb::UsbDevice::startBulkReadThread ( Callback  callback,
unsigned char  endpoint 
)

Definition at line 350 of file UsbDevice.cpp.

◆ startInterruptReadThread()

void lusb::UsbDevice::startInterruptReadThread ( Callback  callback,
unsigned char  endpoint 
)

Definition at line 366 of file UsbDevice.cpp.

◆ stopBulkReadThread()

void lusb::UsbDevice::stopBulkReadThread ( unsigned char  endpoint)

Definition at line 342 of file UsbDevice.cpp.

◆ stopInterruptReadThread()

void lusb::UsbDevice::stopInterruptReadThread ( unsigned char  endpoint)

Definition at line 357 of file UsbDevice.cpp.

◆ throwError()

void lusb::UsbDevice::throwError ( int  err)
private

Definition at line 84 of file UsbDevice.cpp.

Member Data Documentation

◆ bulk_threads_

boost::thread lusb::UsbDevice::bulk_threads_[128]
private

Definition at line 166 of file UsbDevice.h.

◆ bulk_threads_enable_

bool lusb::UsbDevice::bulk_threads_enable_[128]
private

Definition at line 167 of file UsbDevice.h.

◆ ctx_

libusb_context* lusb::UsbDevice::ctx_
private

Definition at line 165 of file UsbDevice.h.

◆ error_code_

int lusb::UsbDevice::error_code_
private

Definition at line 156 of file UsbDevice.h.

◆ error_str_

std::string lusb::UsbDevice::error_str_
private

Definition at line 157 of file UsbDevice.h.

◆ interrupt_threads_

boost::thread lusb::UsbDevice::interrupt_threads_[128]
private

Definition at line 168 of file UsbDevice.h.

◆ interrupt_threads_enable_

bool lusb::UsbDevice::interrupt_threads_enable_[128]
private

Definition at line 169 of file UsbDevice.h.

◆ libusb_handle_

libusb_device_handle* lusb::UsbDevice::libusb_handle_
private

Definition at line 164 of file UsbDevice.h.

◆ location_

Location lusb::UsbDevice::location_
private

Definition at line 163 of file UsbDevice.h.

◆ mi_

uint8_t lusb::UsbDevice::mi_
private

Definition at line 161 of file UsbDevice.h.

◆ open_

bool lusb::UsbDevice::open_
private

Definition at line 162 of file UsbDevice.h.

◆ pid_

uint16_t lusb::UsbDevice::pid_
private

Definition at line 160 of file UsbDevice.h.

◆ throw_errors_

bool lusb::UsbDevice::throw_errors_

Definition at line 143 of file UsbDevice.h.

◆ vid_

uint16_t lusb::UsbDevice::vid_
private

Definition at line 159 of file UsbDevice.h.


The documentation for this class was generated from the following files:


lusb
Author(s): Kevin Hallenbeck
autogenerated on Wed Mar 2 2022 00:29:32