Class UsbDevice

Nested Relationships

Nested Types

Class Documentation

class UsbDevice

Public Types

typedef std::function<void(const void *data, int size)> Callback

Public Functions

UsbDevice(uint16_t vid, uint16_t pid, uint8_t mi)
UsbDevice(uint16_t vid, uint16_t pid)
UsbDevice()
~UsbDevice()
void listDevices(std::vector<Location> &list) const
void setDevceIds(uint16_t vid, uint16_t pid, uint8_t mi)
bool open(const Location &location = Location())
void close()
inline bool isOpen() const
inline Location getLocation() const
bool bulkWrite(const void *data, int size, unsigned char endpoint, int timeout)
int bulkRead(void *data, int size, unsigned char endpoint, int timeout)
bool interruptWrite(const void *data, int size, unsigned char endpoint, int timeout)
int interruptRead(void *data, int size, unsigned char endpoint, int timeout)
void startBulkReadThread(Callback callback, unsigned char endpoint)
void stopBulkReadThread(unsigned char endpoint)
void startInterruptReadThread(Callback callback, unsigned char endpoint)
void stopInterruptReadThread(unsigned char endpoint)
int getLastError(std::string &str) const
void setDebugLevel(uint8_t level)

Public Members

bool throw_errors_

Public Static 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)
class Location

Public Functions

inline Location()
inline Location(uint8_t bus, uint8_t port = 0, uint8_t addr = 0, uint16_t vid = 0, uint16_t pid = 0)
inline bool match(const Location &other) const
inline bool operator==(const Location &other) const
inline bool operator!=(const Location &other) const
inline bool operator<(const Location &other) const

Public Members

uint8_t bus = 0
uint8_t addr = 0
uint8_t port = 0
uint16_t vid = 0
uint16_t pid = 0

Public Static Functions

static inline bool match(const Location &a, const Location &b)
struct UsbIds

Public Functions

inline UsbIds()
inline UsbIds(uint16_t vid, uint16_t pid)

Public Members

uint16_t vid = 0
uint16_t pid = 0