USBUART
A library for reading/wring data via USB-UART adapters
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules
Public Member Functions | Static Public Member Functions | List of all members
usbuart::context Class Reference

USBUART API facade class. More...

Public Member Functions

 context () throw (error_t)
 context constructor allocates a libusb context
 
int attach (device_id id, channel ch, const eia_tia_232_info &pi) noexcept
 Attach pair of file descriptors to the USB device using VID/PID. More...
 
int attach (device_addr ba, channel ch, const eia_tia_232_info &pi) noexcept
 Attach pair of file descriptors to the USB device using BUS/ADDR. More...
 
int pipe (device_id id, channel &ch, const eia_tia_232_info &pi) noexcept
 Create two pipes and attach their ends to the USB device using VID/PID. More...
 
int pipe (device_addr ba, channel &ch, const eia_tia_232_info &pi) noexcept
 Create two pipes and attach their ends to the USB device using BUS/ADDR. More...
 
void close (channel) noexcept
 Close channel, detaches files from USB device. More...
 
int reset (channel) noexcept
 Reset USB device. More...
 
int status (channel) noexcept
 Returns combination of status_t bit or negative on error. More...
 
int sendbreak (channel) noexcept
 Send RS232 break signal to the USB device. More...
 
int loop (int timeout) noexcept
 Run libusb and async I/O message loops. More...
 
libusb_context * native () noexcept
 Returns native LIBUSB context. More...
 

Static Public Member Functions

static contextinstance () noexcept
 Returns a singleton context instance. More...
 
static loglevel_t setloglevel (loglevel_t lvl) noexcept
 Set logging level.
 

Detailed Description

Definition at line 226 of file usbuart.h.

Member Function Documentation

int usbuart::context::attach ( device_id  id,
channel  ch,
const eia_tia_232_info pi 
)
noexcept
Parameters
id- device VID/PID
ch- pair of file descriptors
pi- protocol information
Returns
0 on success or error code

Definition at line 935 of file core.cpp.

int usbuart::context::attach ( device_addr  ba,
channel  ch,
const eia_tia_232_info pi 
)
noexcept
Parameters
ba- USB bus ID/device address
ch- pair of file descriptors
pi- protocol information
Returns
0 on success or error code

Definition at line 940 of file core.cpp.

void usbuart::context::close ( channel  ch)
noexcept

close channel, detaches files from USB device

Definition at line 955 of file core.cpp.

context & usbuart::context::instance ( )
staticnoexcept

returns a singleton context instance

Definition at line 1021 of file core.cpp.

int usbuart::context::loop ( int  timeout)
noexcept

run libusb and async I/O message loops

Parameters
timeout- timeout in milliseconds

Definition at line 996 of file core.cpp.

libusb_context * usbuart::context::native ( )
noexcept

Definition at line 1015 of file core.cpp.

int usbuart::context::pipe ( device_id  id,
channel ch,
const eia_tia_232_info pi 
)
noexcept
Parameters
id- USB bus ID/device address
ch- destination that accepts pair of file descriptors
pi- protocol information
Returns
0 on success or error code

Definition at line 944 of file core.cpp.

int usbuart::context::pipe ( device_addr  ba,
channel ch,
const eia_tia_232_info pi 
)
noexcept
Parameters
ba- USB bus ID/device address
ch- destination that accepts pair of file descriptors
pi- protocol information
Returns
0 on success or error code

Definition at line 949 of file core.cpp.

int usbuart::context::reset ( channel  ch)
noexcept

resets USB device

Definition at line 964 of file core.cpp.

int usbuart::context::sendbreak ( channel  ch)
noexcept

sends RS232 break signal to the USB device

Definition at line 985 of file core.cpp.

int usbuart::context::status ( channel  ch)
noexcept

resets USB device

Definition at line 975 of file core.cpp.


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