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

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `static int[]` | `CP_1250` |
  `static int[]` | `CP_1251` |
  `static int[]` | `CP_866` |

- ## Method Summary

  Modifier and Type | Method | 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
  `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)` |

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### CP_866

    public static final int[] CP_866

  - ### CP_1250

    public static final int[] CP_1250

  - ### CP_1251

    public static final int[] CP_1251

- ## 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, FiscalException
    Execute command with raw data on device
    Parameters:
      `command` - Command number
      `data` - Command data
    Returns:
      Returns command result as string
    Throws:
      `java.io.IOException` - Throws on communication or device error
      `FiscalException`

  - ### isStatusBitTriggered

    public abstract boolean isStatusBitTriggered​(int byteIndex, int bitIndex)
    Check if status bit is triggered in last command execution
    Parameters:
      `byteIndex` - Index of status byte
      `bitIndex` - 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