Public Member Functions | |
None | __init__ (self, str ipAddress, int port) |
Initializes a new instance with the given IP address and port. | |
"TcpComm" | from_descriptor (cls, str descriptor, DescriptorPortType port_type) |
Creates a TcpComm object from a descriptor string and port type. | |
None | open (self) |
Opens the connection to the TCP server. | |
str | get_ip_address (self) |
Gets the IP address of the remote server. | |
connection_settings (self, ip_address, port) | |
Configures connection settings with the specified IP address and port. | |
bool | is_connected (self) |
A flag indicating whether the connection is established. | |
None | close (self) |
Closes the connection to the TCP server. | |
None | write (self, bytes text) |
Writes data to the TCP server. | |
Optional[bytes] | read (self) |
Reads data from the TCP server. | |
None | wait_for_data (self, int msTimeout) |
Waits for data to be available on the TCP connection. | |
Optional[bytes] | write_and_wait_for_response (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="") |
Writes data to the TCP server and waits for a response. | |
Optional[bytes] | write_and_wait_for_response_json (self, bytes text, int responseStartTimeout, int responseEndTimeout, str completionToken="") |
Writes JSON data to the TCP server and waits for a response. | |
write_printer_file (self, str fileName) | |
Writes a file to the printer. | |
None | send_printer_file (self, str ipAddress, str fileName) |
Sends a print file to the specified IP address. | |
None | send_print_string (self, str ipAddress, bytes data) |
Sends a print string using TSPL or PGL to the specified IP address. | |
Static Public Member Functions | |
Tuple[str, int] | parse_descriptor (str descriptor, DescriptorPortType port_type) |
str | descriptor_validate (str descriptor_hint, DescriptorPortType port_type_hint) |
Validates the descriptor with the specified hint and port type. | |
str | descriptor_use_ip (str ip, int port) |
Returns a descriptor string using the specified IP and port. | |
Protected Attributes | |
_socket | |
_ip | |
_port | |
_connected | |
None TcpComm.TcpComm.__init__ | ( | self, | |
str | ipAddress, | ||
int | port ) |
Initializes a new instance with the given IP address and port.
ipAddress | The IP address of the TCP server. |
port | The port number of the TCP server. |
None TcpComm.TcpComm.close | ( | self | ) |
Closes the connection to the TCP server.
TcpComm.TcpComm.connection_settings | ( | self, | |
ip_address, | |||
port ) |
Configures connection settings with the specified IP address and port.
ip_address | The IP address of the remote server. |
port | The port number to connect to on the remote server. |
|
static |
Returns a descriptor string using the specified IP and port.
ip | The IP address to use in the descriptor. |
port | The port to use in the descriptor. |
|
static |
Validates the descriptor with the specified hint and port type.
descriptor_hint | A hint for the descriptor. |
port_type_hint | The type of port to validate. |
"TcpComm" TcpComm.TcpComm.from_descriptor | ( | cls, | |
str | descriptor, | ||
DescriptorPortType | port_type ) |
str TcpComm.TcpComm.get_ip_address | ( | self | ) |
Gets the IP address of the remote server.
bool TcpComm.TcpComm.is_connected | ( | self | ) |
A flag indicating whether the connection is established.
None TcpComm.TcpComm.open | ( | self | ) |
Opens the connection to the TCP server.
|
static |
Optional[bytes] TcpComm.TcpComm.read | ( | self | ) |
Reads data from the TCP server.
None TcpComm.TcpComm.send_print_string | ( | self, | |
str | ipAddress, | ||
bytes | data ) |
Sends a print string using TSPL or PGL to the specified IP address.
ipAddress | The IP address of the printer. |
data | The data to print. |
None TcpComm.TcpComm.send_printer_file | ( | self, | |
str | ipAddress, | ||
str | fileName ) |
Sends a print file to the specified IP address.
ipAddress | The IP address of the printer. |
fileName | The name of the file to print. |
None TcpComm.TcpComm.wait_for_data | ( | self, | |
int | msTimeout ) |
Waits for data to be available on the TCP connection.
msTimeout | The timeout interval in milliseconds. |
None TcpComm.TcpComm.write | ( | self, | |
bytes | text ) |
Writes data to the TCP server.
text | The data to write to the server. |
Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response | ( | self, | |
bytes | text, | ||
int | responseStartTimeout, | ||
int | responseEndTimeout, | ||
str | completionToken = "" ) |
Writes data to the TCP server and waits for a response.
text | The data to write to the server. |
responseStartTimeout | The timeout interval for the start of the response. |
responseEndTimeout | The timeout interval for the end of the response. |
completionToken | A token indicating the completion of the response. |
Optional[bytes] TcpComm.TcpComm.write_and_wait_for_response_json | ( | self, | |
bytes | text, | ||
int | responseStartTimeout, | ||
int | responseEndTimeout, | ||
str | completionToken = "" ) |
Writes JSON data to the TCP server and waits for a response.
text | The JSON data to write to the server. |
responseStartTimeout | The timeout interval for the start of the response. |
responseEndTimeout | The timeout interval for the end of the response. |
completionToken | A token indicating the completion of the response. |
TcpComm.TcpComm.write_printer_file | ( | self, | |
str | fileName ) |
Writes a file to the printer.
fileName | The name of the file to write to the printer. |
|
protected |
|
protected |
|
protected |
|
protected |