Package com.datecs.fiscalprinter.SDK
Class AbstractTransportProtocol
java.lang.Object
com.datecs.fiscalprinter.SDK.AbstractTransportProtocol
- Direct Known Subclasses:
TransportProtocolV1,TransportProtocolV2
public abstract class AbstractTransportProtocol
extends java.lang.Object
-
Field Summary
-
Method Summary
Modifier and Type Method Description voidclose()Close connection and release all associated resources with it.abstract java.lang.StringcustomCommand(int command, java.lang.String data)Execute command with raw data on deviceabstract byte[]getStatusBytes()Get command and device statusesabstract booleanisStatusBitTriggered(int byteIndex, int bitIndex)Check if status bit is triggered in last command executionstatic voidsetDebugLevel(java.util.logging.Level level)voidsetEncoding(int encoding)static voidtoAnsi(java.lang.String str, byte[] data, int offset, int encoding)
-
Field Details
-
Method Details
-
setDebugLevel
public static void setDebugLevel(java.util.logging.Level level)- Parameters:
level-
-
toAnsi
public static void toAnsi(java.lang.String str, byte[] data, int offset, int encoding) -
setEncoding
public void setEncoding(int encoding)- Parameters:
encoding-
-
close
public void close()Close connection and release all associated resources with it. -
customCommand
public abstract java.lang.String customCommand(int command, java.lang.String data) throws java.io.IOException, FiscalExceptionExecute command with raw data on device- Parameters:
command- Command numberdata- Command data- Returns:
- Returns command result as string
- Throws:
java.io.IOException- Throws on communication or device errorFiscalException
-
isStatusBitTriggered
public abstract boolean isStatusBitTriggered(int byteIndex, int bitIndex)Check if status bit is triggered in last command execution- Parameters:
byteIndex- Index of status bytebitIndex- Index of status bit for given byte index- Returns:
- Returns if given bit was triggered in last command.
-
getStatusBytes
public abstract byte[] getStatusBytes()Get command and device statuses- Returns:
- Statuses from last command
-