UniPRT SDK v2.0.0.0
 
載入中...
搜尋中...
無符合項目
UsbComm.UsbComm 類別 參考文件

公開方法(Public Methods)

 __init__ (self, vendor_id, product_id)
 初始化 UsbComm 類的新實例。
 
 descriptor_use_vendor_id (self, vId, pId)
 
 open (self)
 打開到 USB 設備的連接。
 
bool is_connected (self)
 檢查 USB 設備是否已連接。
 
 async_listen_read (self)
 異步監聽並讀取來自 USB 設備的數據。
 
 stop_listen_read (self)
 停止監聽並讀取來自 USB 設備的數據。
 
 close (self)
 關閉 USB 設備的連接。
 
 write (self, text)
 將數據寫入 USB 設備。
 
 read (self)
 從 USB 設備讀取數據。
 
 write_and_wait_for_response (self, text, response_start_timeout, response_end_timeout, completion_token="")
 向設備寫入數據並等待回應。
 
 write_and_wait_for_response_json (self, text, response_start_timeout, response_end_timeout, completion_token="")
 向設備寫入數據並等待回應。
 

公開屬性

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

保護屬性

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 = {}
 

建構子與解構子說明文件

◆ __init__()

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

初始化 UsbComm 類的新實例。

參數
vendor_id實例的供應商 ID。
product_id實例的產品 ID。

函式成員說明文件

◆ async_listen_read()

UsbComm.UsbComm.async_listen_read ( self)

異步監聽並讀取來自 USB 設備的數據。

◆ close()

UsbComm.UsbComm.close ( self)

關閉 USB 設備的連接。

◆ descriptor_use_vendor_id()

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

◆ is_connected()

bool UsbComm.UsbComm.is_connected ( self)

檢查 USB 設備是否已連接。

傳回值
: 如果已連接返回 True,否則返回 False。

◆ open()

UsbComm.UsbComm.open ( self)

打開到 USB 設備的連接。

◆ read()

UsbComm.UsbComm.read ( self)

從 USB 設備讀取數據。

傳回值
: 從設備讀取的數據。

◆ stop_listen_read()

UsbComm.UsbComm.stop_listen_read ( self)

停止監聽並讀取來自 USB 設備的數據。

◆ write()

UsbComm.UsbComm.write ( self,
text )

將數據寫入 USB 設備。

參數
text要寫入設備的數據。

◆ write_and_wait_for_response()

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

向設備寫入數據並等待回應。

參數
text要寫入設備的數據。
response_start_timeout回應開始的超時間隔。
response_end_timeout回應結束的超時間隔。
completion_token指示回應完成的令牌。
傳回值
: 從設備收到的回應數據。

◆ write_and_wait_for_response_json()

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

向設備寫入數據並等待回應。

參數
text要寫入設備的數據。
response_start_timeout回應開始的超時間隔。
response_end_timeout回應結束的超時間隔。
completion_token指示回應完成的令牌。
傳回值
: 從設備收到的回應數據。

資料成員說明文件

◆ _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

此類別(class) 文件是由下列檔案中產生: