實作 TCP 特定通訊並擴展 AComm 類別的類別。 更多...
複合項目 | |
enum | DescriptorPortType |
用於請求具有預設埠值的描述符類型 更多... | |
公開方法(Public Methods) | |
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 流中。返回的資料是收到的資料或收到的完成標記。等待回應超時後返回。 更多... | |
靜態公開方法(Static Public Methods) | |
static String | DescriptorValidate (String descriptorHint, DescriptorPortType portTypeHint) |
從可能包含或不包含埠的 descriptorHint 驗證/建構描述符字串。返回有效的描述符或空字串 ""。 更多... | |
靜態公開屬性 | |
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 條碼數據和等級: