FAIL, NOT_PERMISSION, NOT_SUPPORT, STATE_CONNECTED, STATE_CONNECTING, STATE_LISTEN, STATE_NONE, SUCCESS| Constructor and Description |
|---|
UsbPort(android.content.Context context) |
| 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
|
public boolean isConnected()
isConnected in interface Connecterpublic int connect()
connect in interface ConnecterConnecter.STATE_NONE,Connecter.STATE_LISTEN,Connecter.STATE_CONNECTING,Connecter.STATE_CONNECTED,Connecter.NOT_PERMISSION,Connecter.NOT_SUPPORTjava.io.IOException - IO exceptionpublic void connect(Observer observer)
public int connect(int pid,
int vid)
throws java.io.IOException
connect in interface Connecterpid - usb product idvid - usb vendor idConnecter.STATE_CONNECTED Connected stateļ¼STATE_NONE Failure status.java.io.IOException - IO exceptionpublic int close()
public int read(byte[] buffer,
int time)
throws java.io.IOException
read in interface Connecterbuffer - Cache area for reading data from the printer.time - Waiting time in milliseconds (MS).java.io.IOException - Receive data exception.public int read(byte[] buffer,
int offset,
int len,
int time)
throws java.io.IOException
read in interface Connecterbuffer - Cache area for reading data from the printer.offset - Cache data offset.time - Waiting time in milliseconds (MS).java.io.IOException - Receive data exception.public boolean write(byte[] bytes,
int timeout)
throws java.io.IOException
public boolean write(byte[] bytes,
int offset,
int len,
int timeout)
throws java.io.IOException
write in interface Connecterbytes - 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.