public abstract class AbstractTransportProtocol
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int[] |
CP_1250 |
static int[] |
CP_1251 |
static int[] |
CP_866 |
protected static int |
DEFAULT_TIMEOUT |
protected static java.util.logging.Logger |
LOGGER |
protected static int |
MAX_RETRIES |
protected int |
mEncoding |
protected int |
mPackageSequance |
protected FiscalSocket |
mSocket |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTransportProtocol(FiscalSocket socket) |
protected |
AbstractTransportProtocol(FiscalSocket socket,
int encoding) |
protected |
AbstractTransportProtocol(java.io.InputStream in,
java.io.OutputStream out,
int encoding) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close connection and release all associated resources with it.
|
abstract java.lang.String |
customCommand(int command,
java.lang.String data)
Execute command with raw data on device
|
abstract byte[] |
getStatusBytes()
Get command and device statuses
|
abstract boolean |
isStatusBitTriggered(int byteIndex,
int bitIndex)
Check if status bit is triggered in last command execution
|
protected int |
read() |
protected void |
read(byte[] buf,
int offset,
int len) |
protected abstract java.lang.String |
readPacket() |
static void |
setDebugLevel(java.util.logging.Level level) |
void |
setEncoding(int encoding) |
static void |
toAnsi(java.lang.String str,
byte[] data,
int offset,
int encoding) |
protected static java.lang.String |
toUnicode(byte[] data,
int offset,
int length,
int encoding) |
protected abstract void |
writePacket(int command,
java.lang.String data) |
protected static final java.util.logging.Logger LOGGER
protected int mEncoding
protected final FiscalSocket mSocket
protected int mPackageSequance
protected static final int DEFAULT_TIMEOUT
protected static final int MAX_RETRIES
public static final int[] CP_866
public static final int[] CP_1250
public static final int[] CP_1251
protected AbstractTransportProtocol(java.io.InputStream in, java.io.OutputStream out, int encoding)
protected AbstractTransportProtocol(FiscalSocket socket, int encoding)
protected AbstractTransportProtocol(FiscalSocket socket)
public static void setDebugLevel(java.util.logging.Level level)
level
- public static void toAnsi(java.lang.String str, byte[] data, int offset, int encoding)
protected static java.lang.String toUnicode(byte[] data, int offset, int length, int encoding)
protected int read() throws java.io.IOException
java.io.IOException
protected void read(byte[] buf, int offset, int len) throws java.io.IOException
java.io.IOException
public void setEncoding(int encoding)
encoding
- public void close()
public abstract java.lang.String customCommand(int command, java.lang.String data) throws java.io.IOException
command
- Command numberdata
- Command datajava.io.IOException
- Throws on communication or device errorpublic abstract boolean isStatusBitTriggered(int byteIndex, int bitIndex)
byteIndex
- Index of status bytebitIndex
- Index of status bit for given byte indexpublic abstract byte[] getStatusBytes()
protected abstract void writePacket(int command, java.lang.String data) throws java.io.IOException
java.io.IOException
protected abstract java.lang.String readPacket() throws java.io.IOException
java.io.IOException