实现 TCP 特定通信并扩展 AComm 类的类。 更多...
类 | |
enum | DescriptorPortType |
用于请求具有默认端口值的描述符类型 更多... | |
Public 成员函数 | |
TcpConnection (String descriptor) throws IllegalArgumentException | |
根据 descriptor 字符串初始化新的类实例。 更多... | |
TcpConnection (String ipAddress, int port) | |
Initialize new class instance | |
int | BytesAvailable () |
Number of bytes available to read. This is estimate and number can change as data is received. | |
void | Close () |
Closes a connection. | |
boolean | Connected () |
true if connection is established | |
String | Descriptor () |
返回连接的字符串描述。格式: "TCP:ip:port" 例如: "TCP:127.0.0.1:9100" 更多... | |
String | IpAddress () |
IP address of connection | |
void | Open () |
Opens a connection. | |
int | Port () |
Port Number of connection | |
byte[] | Read () |
Read all bytes available. | |
void | Read (OutputStream binDataIn) throws IOException |
Reads all bytes available into the stream passed in. | |
void | WaitForData (int msTimeOut) |
等待当前线程有可用数据 BytesAvailable。当前线程会休眠直到接收到数据或超时为止。此为阻塞调用。 更多... | |
void | Write (byte[] dataOut) |
Writes all bytes from the array passed in. | |
void | Write (InputStream binReader) throws IOException |
从输入流写入输出流。 更多... | |
byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
将字节数据写入输出流并返回接收到的数据。返回的数据是接收到的任何数据或收到的完成标记。等待响应超时后返回。 更多... | |
void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
将 binDataOut 流数据写入输出流,并将接收到的数据返回到 binDataIn 流中。返回的数据是收到的数据或收到的完成标记。等待响应超时后返回。 更多... | |
静态 Public 成员函数 | |
static String | DescriptorValidate (String descriptorHint, DescriptorPortType portTypeHint) |
从可能包含或不包含端口的 descriptorHint 验证/构建描述符字符串。返回有效的描述符或空字符串 ""。 更多... | |
静态 Public 属性 | |
static final int | DEFAULT_DATA_PORT = 9100 |
Port for sending print data | |
static final int | DEFAULT_MGMT_PORT = 3007 |
Port used to control and manage printers. | |
static final int | DEFAULT_STATUS_PORT = 3002 |
Port for listening to status messages from printer. 更多... | |
实现 TCP 特定通信并扩展 AComm 类的类。
TcpConnection | ( | String | descriptor | ) | throws IllegalArgumentException |
根据 descriptor 字符串初始化新的类实例。
[in] | descriptor | 冒号 (:) 分隔的连接描述字符串。 可接受的格式:
|
String Descriptor | ( | ) |
返回连接的字符串描述。格式: "TCP:ip:port" 例如: "TCP:127.0.0.1:9100"
返回的格式:
注意返回的字符串前缀 "TCP" 表示连接的类型。
实现了 IComm.
|
static |
从可能包含或不包含端口的 descriptorHint 验证/构建描述符字符串。返回有效的描述符或空字符串 ""。
descriptorHint 可接受的值:
|
inherited |
|
inherited |
|
inherited |
将字节数据写入输出流并返回接收到的数据。返回的数据是接收到的任何数据或收到的完成标记。等待响应超时后返回。
byte[] | 从连接接收到的字节数组。 返回的数据是接收到的任何数据或收到的完成标记。 |
[in] | dataOut | 要写入连接的源字节数组。 |
[in] | responseStartTimeOut | 等待接收到第一个数据的超时。从第一个字节开始计时。 |
[in] | responseEndTimeOut | 没有新数据接收的超时。从最后一个字节后开始计时。 |
[in] | completetionToken | 标示预期响应结束的字符串标记。如果只是想在写入数据到连接后等待响应,可以是空字符串。 |
实现了 IComm.
|
inherited |
将 binDataOut 流数据写入输出流,并将接收到的数据返回到 binDataIn 流中。返回的数据是收到的数据或收到的完成标记。等待响应超时后返回。
[out] | binDataIn | 用于存储从连接接收到的响应的目标流。 |
[in] | binDataOut | 写入连接的源流数据。 |
[in] | responseStartTimeOut | 等待接收到第一个数据的超时。从第一个字节开始计时。 |
[in] | responseEndTimeOut | 没有新数据接收的超时。从最后一个字节后开始计时。 |
[in] | completetionToken | 标示预期响应结束的字符串标记。如果只是想在写入数据到连接后等待响应,可以是空字符串。 |
实现了 IComm.
|
static |
Port for listening to status messages from printer.
印表机可根据印表机上的“Ret. Status Port”设置将状态讯息发送到不同的端口。 如果“Ret. Status Port”设置为“E-NET Stat Port”,则印表机可能会将状态讯息发送到“Status Port Number”设置,默认值为 3002。
例如:印表机语言(如 PGL)的模拟诊断讯息。
例如:使用以下印表机菜单设置捕获 ODV 条码数据和等级: