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

公開方法(Public Methods)

None __init__ (self, str ipAddress, int port)
 初始化一個新的實例,使用指定的 IP 地址和端口號。
 
"TcpComm" from_descriptor (cls, str descriptor, DescriptorPortType port_type)
 從描述符字符串和端口類型創建一個 TcpComm 對象。
 
None open (self)
 打開與TCP伺服器的連接。
 
str get_ip_address (self)
 獲取遠程伺服器的IP地址。
 
 connection_settings (self, ip_address, port)
 使用指定的IP地址和端口配置連接設置。
 
bool is_connected (self)
 指示連接是否已建立的標誌。
 
None close (self)
 關閉與TCP伺服器的連接。
 
None write (self, bytes text)
 將數據寫入TCP伺服器。
 
Optional[bytes] read (self)
 從TCP伺服器讀取數據。
 
None wait_for_data (self, int msTimeout)
 等待TCP連接上有數據可用。
 
Optional[bytes] write_and_wait_for_response (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="")
 將數據寫入TCP服務器並等待響應。
 
Optional[bytes] write_and_wait_for_response_json (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="")
 將JSON數據寫入TCP服務器並等待響應。
 
 write_printer_file (self, str fileName)
 將文件寫入打印機。
 
None send_printer_file (self, str ipAddress, str fileName)
 發送打印文件到指定的IP地址。
 
None send_print_string (self, str ipAddress, bytes data)
 使用 TSPLPGL 將打印字符串發送到指定的IP地址。
 

靜態公開方法(Static Public Methods)

Tuple[str, int] parse_descriptor (str descriptor, DescriptorPortType port_type)
 
str descriptor_validate (str descriptor_hint, DescriptorPortType port_type_hint)
 使用指定的提示和端口類型驗證描述符。
 
str descriptor_use_ip (str ip, int port)
 使用指定的IP和端口返回一個描述符字符串。
 

保護屬性

 _socket
 
 _ip
 
 _port
 
 _connected
 

建構子與解構子說明文件

◆ __init__()

None TcpComm.TcpComm.__init__ ( self,
str ipAddress,
int port )

初始化一個新的實例,使用指定的 IP 地址和端口號。

參數
ipAddressTCP 伺服器的 IP 地址。
portTCP 伺服器的端口號。

函式成員說明文件

◆ close()

None TcpComm.TcpComm.close ( self)

關閉與TCP伺服器的連接。

◆ connection_settings()

TcpComm.TcpComm.connection_settings ( self,
ip_address,
port )

使用指定的IP地址和端口配置連接設置。

參數
ip_address遠程伺服器的IP地址。
port連接到遠程伺服器的端口號。

◆ descriptor_use_ip()

str TcpComm.TcpComm.descriptor_use_ip ( str ip,
int port )
static

使用指定的IP和端口返回一個描述符字符串。

參數
ip用於描述符的IP地址。
port用於描述符的端口。
傳回值
一個描述符字符串。

◆ descriptor_validate()

str TcpComm.TcpComm.descriptor_validate ( str descriptor_hint,
DescriptorPortType port_type_hint )
static

使用指定的提示和端口類型驗證描述符。

參數
descriptor_hint描述符的提示。
port_type_hint要驗證的端口類型。
傳回值
一個驗證後的描述符字符串。

◆ from_descriptor()

"TcpComm" TcpComm.TcpComm.from_descriptor ( cls,
str descriptor,
DescriptorPortType port_type )

從描述符字符串和端口類型創建一個 TcpComm 對象。

參數
descriptor表示連接的描述符字符串。
port_type要用於連接的端口類型。
傳回值
TcpComm 類的一個實例。

◆ get_ip_address()

str TcpComm.TcpComm.get_ip_address ( self)

獲取遠程伺服器的IP地址。

傳回值
遠程伺服器的IP地址。

◆ is_connected()

bool TcpComm.TcpComm.is_connected ( self)

指示連接是否已建立的標誌。

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

◆ open()

None TcpComm.TcpComm.open ( self)

打開與TCP伺服器的連接。

◆ parse_descriptor()

Tuple[str, int] TcpComm.TcpComm.parse_descriptor ( str descriptor,
DescriptorPortType port_type )
static

◆ read()

Optional[bytes] TcpComm.TcpComm.read ( self)

從TCP伺服器讀取數據。

傳回值
從伺服器讀取的數據。

◆ send_print_string()

None TcpComm.TcpComm.send_print_string ( self,
str ipAddress,
bytes data )

使用 TSPLPGL 將打印字符串發送到指定的IP地址。

參數
ipAddress打印機的IP地址。
data要打印的數據。

◆ send_printer_file()

None TcpComm.TcpComm.send_printer_file ( self,
str ipAddress,
str fileName )

發送打印文件到指定的IP地址。

參數
ipAddress打印機的IP地址。
fileName要打印的文件名。

◆ wait_for_data()

None TcpComm.TcpComm.wait_for_data ( self,
int msTimeout )

等待TCP連接上有數據可用。

參數
msTimeout超時間隔(毫秒)。

◆ write()

None TcpComm.TcpComm.write ( self,
bytes text )

將數據寫入TCP伺服器。

參數
text要寫入伺服器的數據。

◆ write_and_wait_for_response()

Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response ( self,
bytes text,
int responseStartTimeout,
int responseEndTimeout,
str completionToken = "" )

將數據寫入TCP服務器並等待響應。

參數
text要寫入服務器的數據。
responseStartTimeout響應開始的超時間隔。
responseEndTimeout響應結束的超時間隔。
completionToken表示響應完成的標記。
傳回值
從服務器接收到的響應數據。

◆ write_and_wait_for_response_json()

Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response_json ( self,
bytes text,
int responseStartTimeout,
int responseEndTimeout,
str completionToken = "" )

將JSON數據寫入TCP服務器並等待響應。

參數
text要寫入服務器的JSON數據。
responseStartTimeout響應開始的超時間隔。
responseEndTimeout響應結束的超時間隔。
completionToken表示響應完成的標記。
傳回值
從服務器接收到的響應數據。

◆ write_printer_file()

TcpComm.TcpComm.write_printer_file ( self,
str fileName )

將文件寫入打印機。

參數
fileName要寫入打印機的文件名。

資料成員說明文件

◆ _connected

TcpComm.TcpComm._connected
protected

◆ _ip

TcpComm.TcpComm._ip
protected

◆ _port

TcpComm.TcpComm._port
protected

◆ _socket

TcpComm.TcpComm._socket
protected

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