public interface Connecter
| Modifier and Type | Field and Description |
|---|---|
static int |
FAIL
Failure status.
|
static int |
NOT_PERMISSION
No access
|
static int |
NOT_SUPPORT
Not support
|
static int |
STATE_CONNECTED
Connected state
|
static int |
STATE_CONNECTING
Connecting state
|
static int |
STATE_LISTEN
Listening state
|
static int |
STATE_NONE |
static int |
SUCCESS
Success status.
|
| Modifier and Type | Method and Description |
|---|---|
int |
close()
Disconnect
|
int |
connect()
Open a connection
|
int |
connect(int pid,
int vid)
Open a connection
|
void |
connect(Observer observer)
Open a connection
|
boolean |
isConnected()
Connection state
|
int |
read(byte[] buffer,
int time)
Receive data
|
int |
read(byte[] buffer,
int offset,
int len,
int time)
Receive data
|
boolean |
write(byte[] bytes,
int timeout)
Writing data
|
boolean |
write(byte[] bytes,
int offset,
int len,
int timeout)
Writing data
|
static final int STATE_NONE
static final int STATE_LISTEN
static final int STATE_CONNECTING
static final int STATE_CONNECTED
static final int NOT_SUPPORT
static final int NOT_PERMISSION
static final int SUCCESS
static final int FAIL
boolean isConnected()
int connect()
throws java.io.IOException
STATE_NONE,STATE_LISTEN,STATE_CONNECTING,STATE_CONNECTED,NOT_PERMISSION,NOT_SUPPORTjava.io.IOException - IO exceptionvoid connect(Observer observer)
observer - Connect state block.int connect(int pid,
int vid)
throws java.io.IOException
pid - usb product idvid - usb vendor idSTATE_CONNECTED Connected stateļ¼STATE_NONE Failure status.java.io.IOException - IO exceptionint close()
int read(@Nullable
byte[] buffer,
int time)
throws java.io.IOException
buffer - Cache area for reading data from the printer.time - Waiting time in milliseconds (MS).java.io.IOException - Receive data exception.int read(@Nullable
byte[] buffer,
int offset,
int len,
int time)
throws java.io.IOException
buffer - Cache area for reading data from the printer.offset - Cache data offset.time - Waiting time in milliseconds (MS).java.io.IOException - Receive data exception.boolean write(@Nullable
byte[] bytes,
int timeout)
throws java.io.IOException
bytes - Data sent to printer.timeout - Send timeout in milliseconds (MS).java.io.IOException - Sending data exception.boolean write(@Nullable
byte[] bytes,
int offset,
int len,
int timeout)
throws java.io.IOException
bytes - Data sent to printer.offset - The start offset in the data.len - The number of bytes to write.timeout - Send timeout in milliseconds (MS).java.io.IOException - Sending data exception.