UniPRT SDK v2.0.0.0
 
Loading...
Searching...
No Matches
UsbComm.UsbComm Class Reference

Public Member Functions

 __init__ (self, vendor_id, product_id)
 Initializes a new instance of the UsbComm class.
 
 descriptor_use_vendor_id (self, vId, pId)
 
 open (self)
 Opens the connection to the USB device.
 
bool is_connected (self)
 Checks if the USB device is connected.
 
 async_listen_read (self)
 Asynchronously listens for and reads data from the USB device.
 
 stop_listen_read (self)
 Stops listening for and reading data from the USB device.
 
 close (self)
 Closes the connection to the USB device.
 
 write (self, text)
 Writes data to the USB device.
 
 read (self)
 Reads data from the USB device.
 
 write_and_wait_for_response (self, text, response_start_timeout, response_end_timeout, completion_token="")
 Writes data to the device and waits for a response.
 
 write_and_wait_for_response_json (self, text, response_start_timeout, response_end_timeout, completion_token="")
 Writes data to the device and waits for a response.
 

Public Attributes

 data_to_write = None
 
int total_batches = 0
 
int current_batch = 0
 
 run_loop_thread = threading.Thread(target=self.run_loop_thread_entry)
 

Protected Attributes

bool _connected = False
 
 _vId = int(vendor_id)
 
 _pId = int(product_id)
 
 _matched_interfaces = None
 
list _discovered_interfaces = []
 
bool _should_stop_read_loop = True
 
dict _device_list = {}
 

Constructor & Destructor Documentation

◆ __init__()

UsbComm.UsbComm.__init__ ( self,
vendor_id,
product_id )

Initializes a new instance of the UsbComm class.

Parameters
vendor_idThe vendor ID for the instance.
product_idThe product ID for the instance.

Member Function Documentation

◆ async_listen_read()

UsbComm.UsbComm.async_listen_read ( self)

Asynchronously listens for and reads data from the USB device.

◆ close()

UsbComm.UsbComm.close ( self)

Closes the connection to the USB device.

◆ descriptor_use_vendor_id()

UsbComm.UsbComm.descriptor_use_vendor_id ( self,
vId,
pId )

◆ is_connected()

bool UsbComm.UsbComm.is_connected ( self)

Checks if the USB device is connected.

Returns
: True if connected, False otherwise.

◆ open()

UsbComm.UsbComm.open ( self)

Opens the connection to the USB device.

◆ read()

UsbComm.UsbComm.read ( self)

Reads data from the USB device.

Returns
: The data read from the device.

◆ stop_listen_read()

UsbComm.UsbComm.stop_listen_read ( self)

Stops listening for and reading data from the USB device.

◆ write()

UsbComm.UsbComm.write ( self,
text )

Writes data to the USB device.

Parameters
textThe data to write to the device.

◆ write_and_wait_for_response()

UsbComm.UsbComm.write_and_wait_for_response ( self,
text,
response_start_timeout,
response_end_timeout,
completion_token = "" )

Writes data to the device and waits for a response.

Parameters
textThe data to write to the device.
response_start_timeoutThe timeout interval for the start of the response.
response_end_timeoutThe timeout interval for the end of the response.
completion_tokenA token indicating the completion of the response.
Returns
: The data received in response from the device.

◆ write_and_wait_for_response_json()

UsbComm.UsbComm.write_and_wait_for_response_json ( self,
text,
response_start_timeout,
response_end_timeout,
completion_token = "" )

Writes data to the device and waits for a response.

Parameters
textThe data to write to the device.
response_start_timeoutThe timeout interval for the start of the response.
response_end_timeoutThe timeout interval for the end of the response.
completion_tokenA token indicating the completion of the response.
Returns
: The data received in response from the device.

Member Data Documentation

◆ _connected

bool UsbComm.UsbComm._connected = False
protected

◆ _device_list

dict UsbComm.UsbComm._device_list = {}
protected

◆ _discovered_interfaces

list UsbComm.UsbComm._discovered_interfaces = []
protected

◆ _matched_interfaces

UsbComm.UsbComm._matched_interfaces = None
protected

◆ _pId

UsbComm.UsbComm._pId = int(product_id)
protected

◆ _should_stop_read_loop

bool UsbComm.UsbComm._should_stop_read_loop = True
protected

◆ _vId

UsbComm.UsbComm._vId = int(vendor_id)
protected

◆ current_batch

int UsbComm.UsbComm.current_batch = 0

◆ data_to_write

UsbComm.UsbComm.data_to_write = None

◆ run_loop_thread

UsbComm.UsbComm.run_loop_thread = threading.Thread(target=self.run_loop_thread_entry)

◆ total_batches

int UsbComm.UsbComm.total_batches = 0

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