公開方法(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) |
使用 TSPL 或 PGL 將打印字符串發送到指定的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 | |
None TcpComm.TcpComm.__init__ | ( | self, | |
str | ipAddress, | ||
int | port ) |
初始化一個新的實例,使用指定的 IP 地址和端口號。
ipAddress | TCP 伺服器的 IP 地址。 |
port | TCP 伺服器的端口號。 |
None TcpComm.TcpComm.close | ( | self | ) |
關閉與TCP伺服器的連接。
TcpComm.TcpComm.connection_settings | ( | self, | |
ip_address, | |||
port ) |
使用指定的IP地址和端口配置連接設置。
ip_address | 遠程伺服器的IP地址。 |
port | 連接到遠程伺服器的端口號。 |
|
static |
使用指定的IP和端口返回一個描述符字符串。
ip | 用於描述符的IP地址。 |
port | 用於描述符的端口。 |
|
static |
使用指定的提示和端口類型驗證描述符。
descriptor_hint | 描述符的提示。 |
port_type_hint | 要驗證的端口類型。 |
"TcpComm" TcpComm.TcpComm.from_descriptor | ( | cls, | |
str | descriptor, | ||
DescriptorPortType | port_type ) |
str TcpComm.TcpComm.get_ip_address | ( | self | ) |
獲取遠程伺服器的IP地址。
bool TcpComm.TcpComm.is_connected | ( | self | ) |
指示連接是否已建立的標誌。
None TcpComm.TcpComm.open | ( | self | ) |
打開與TCP伺服器的連接。
|
static |
Optional[bytes] TcpComm.TcpComm.read | ( | self | ) |
從TCP伺服器讀取數據。
None TcpComm.TcpComm.send_print_string | ( | self, | |
str | ipAddress, | ||
bytes | data ) |
使用 TSPL 或 PGL 將打印字符串發送到指定的IP地址。
ipAddress | 打印機的IP地址。 |
data | 要打印的數據。 |
None TcpComm.TcpComm.send_printer_file | ( | self, | |
str | ipAddress, | ||
str | fileName ) |
發送打印文件到指定的IP地址。
ipAddress | 打印機的IP地址。 |
fileName | 要打印的文件名。 |
None TcpComm.TcpComm.wait_for_data | ( | self, | |
int | msTimeout ) |
等待TCP連接上有數據可用。
msTimeout | 超時間隔(毫秒)。 |
None TcpComm.TcpComm.write | ( | self, | |
bytes | text ) |
將數據寫入TCP伺服器。
text | 要寫入伺服器的數據。 |
Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response | ( | self, | |
bytes | text, | ||
int | responseStartTimeout, | ||
int | responseEndTimeout, | ||
str | completionToken = "" ) |
將數據寫入TCP服務器並等待響應。
text | 要寫入服務器的數據。 |
responseStartTimeout | 響應開始的超時間隔。 |
responseEndTimeout | 響應結束的超時間隔。 |
completionToken | 表示響應完成的標記。 |
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 | 表示響應完成的標記。 |
TcpComm.TcpComm.write_printer_file | ( | self, | |
str | fileName ) |
將文件寫入打印機。
fileName | 要寫入打印機的文件名。 |
|
protected |
|
protected |
|
protected |
|
protected |