From 8ec95bf3630a6c3a58a09fda7fbbbe782e9ad804 Mon Sep 17 00:00:00 2001 From: Vitaly Kravtsov Date: Tue, 28 Jun 2022 10:05:34 +0300 Subject: [PATCH] [-] Fixed error with disabling and enabling bluetooth adapter on BLE connection --- History.txt | 7 + .../fiscalprinter/PrinterProtocol_1.java | 32 ++-- .../fiscalprinter/PrinterProtocol_2.java | 10 +- .../shtrih/fiscalprinter/SMFiscalPrinter.java | 4 + .../fiscalprinter/SMFiscalPrinterImpl.java | 56 ++++--- .../fiscalprinter/SMFiscalPrinterNull.java | 8 + .../jpos/fiscalprinter/FiscalPrinterImpl.java | 7 +- .../src/com/shtrih/util/ServiceVersion.java | 2 +- .../fiscalprinter/port/BluetoothLEPort.java | 156 ++++++++++++------ .../src/com/shtrih/util/CompositeLogger.java | 2 - .../tinyjavapostester/MainActivity.java | 12 +- 11 files changed, 197 insertions(+), 99 deletions(-) diff --git a/History.txt b/History.txt index 00546221..a50f4e15 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,13 @@ Company : SHTRIH-M www.shtrih-m.ru (495) 787-6090 Url : https://github.com/shtrih-m/javapos_shtrih +******************************************************************************** + + 21.06.2022 + deviceServiceVersion = 1013667 + + [-] Fixed error with disabling and enabling bluetooth adapter on BLE connection + ******************************************************************************** 21.06.2022 diff --git a/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_1.java b/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_1.java index ebd6e2a6..47cb26b6 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_1.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_1.java @@ -36,18 +36,20 @@ public class PrinterProtocol_1 implements PrinterProtocol { private final static byte ACK = 0x06; private final static byte NAK = 0x15; // maximum counters - private int maxEnqNumber = 3; - private int maxNakCommandNumber = 3; - private int maxNakAnswerNumber = 3; - private int maxAckNumber = 3; - private int maxRepeatCount = 3; + private int maxEnqNumber = 1; + private int maxNakCommandNumber = 1; + private int maxNakAnswerNumber = 1; + private int maxAckNumber = 1; + private int maxRepeatCount = 1; private byte[] txData = new byte[0]; private byte[] rxData = new byte[0]; private final Frame frame = new Frame(); + private final boolean isReliable; private static CompositeLogger logger = CompositeLogger.getLogger(PrinterProtocol_1.class); public PrinterProtocol_1(PrinterPort port) { this.port = port; + isReliable = port.readParameter(PrinterPort.PARAMID_IS_RELIABLE).equalsIgnoreCase("1"); } private void portWrite(int b) throws Exception { @@ -278,7 +280,9 @@ public void connect() throws Exception { } public void setMaxEnqNumber(int value) { - maxEnqNumber = value; + if (!isReliable) { + maxEnqNumber = value; + } } public int getMaxEnqNumber() { @@ -302,19 +306,27 @@ public int getMaxRepeatCount() { } public void setMaxNakCommandNumber(int value) { - maxNakCommandNumber = value; + if (!isReliable) { + maxNakCommandNumber = value; + } } public void setMaxNakAnswerNumber(int value) { - maxNakAnswerNumber = value; + if (!isReliable) { + maxNakAnswerNumber = value; + } } public void setMaxAckNumber(int value) { - maxAckNumber = value; + if (!isReliable) { + maxAckNumber = value; + } } public void setMaxRepeatCount(int value) { - maxRepeatCount = value; + if (!isReliable) { + maxRepeatCount = value; + } } public byte[] getTxData() { diff --git a/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_2.java b/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_2.java index d0dc2c39..329733c7 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_2.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/PrinterProtocol_2.java @@ -21,7 +21,7 @@ public class PrinterProtocol_2 implements PrinterProtocol { private final Frame frame = new Frame(); byte[] rx = {}; private int byteTimeout = 100; - private int maxRepeatCount = 3; + private int maxRepeatCount = 1; private final boolean isReliable; private static CompositeLogger logger = CompositeLogger.getLogger(PrinterProtocol_2.class); @@ -45,12 +45,16 @@ public void connect() throws Exception public void send(PrinterCommand command) throws Exception { + int repeatCount = maxRepeatCount; + if (isReliable){ + repeatCount = 1; + } synchronized (port.getSyncObject()) { - for (int i = 0; i < maxRepeatCount; i++) + for (int i = 0; i < repeatCount; i++) { if (i > 0){ - logger.debug(String.format("Retry %d/%d", i ,maxRepeatCount)); + logger.debug(String.format("Retry %d/%d", i ,repeatCount)); } if (sendCommand(command, i + 1)) { return; diff --git a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinter.java b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinter.java index a56efe2d..8d04a483 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinter.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinter.java @@ -113,6 +113,8 @@ public interface SMFiscalPrinter { public LongPrinterStatus connect() throws Exception; + public void disconnect(); + public void check(int errorCode) throws Exception; public void execute(PrinterCommand command) throws Exception; @@ -534,6 +536,8 @@ public ReadOperationRegister readOperationRegister2(int number) public FSReadSerial fsReadSerial() throws Exception; + public String getFullSerial(); + public String readFullSerial() throws Exception; public FSReadExpDate fsReadExpDate() throws Exception; diff --git a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterImpl.java b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterImpl.java index bc63ada0..87165cb2 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterImpl.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterImpl.java @@ -162,6 +162,7 @@ enum Boolean { public boolean isTableTextCleared = false; private final Map taxRates = new HashMap(); private int printMode = PrinterConst.PRINT_MODE_ENABLED; + private boolean connected = false; public SMFiscalPrinterImpl(PrinterPort port, PrinterProtocol device, FptrParameters params) { @@ -236,8 +237,11 @@ public void deviceExecute(PrinterCommand command) throws Exception { } try { + if (connected){ + port.open(getParams().portOpenTimeout); + } device.send(command); - } catch (IOException e) { + } catch (Exception e) { port.close(); throw new DeviceException(PrinterConst.SMFPTR_E_NOCONNECTION, e.getMessage()); } @@ -369,10 +373,16 @@ public LongPrinterStatus connect() throws Exception { } check(readDeviceMetrics()); model = selectPrinterModel(getDeviceMetrics()); + readFullSerial(); + connected = true; return checkEcrMode(); } } + public void disconnect() { + connected = false; + } + private void beforeCommand(PrinterCommand command) throws Exception { for (IPrinterEvents printerEvents : events) { try { @@ -3446,6 +3456,11 @@ public FSReadSerial fsReadSerial() throws Exception { return command; } + @Override + public String getFullSerial() { + return serial; + } + @Override public String readFullSerial() throws Exception { if (serial.isEmpty()) { @@ -5273,28 +5288,31 @@ public void setPrintMode(int value) { this.printMode = value; } - public synchronized void sendFDODocuments() throws Exception { - byte[] data = fsReadBlockData(); - if (data.length == 0) { - return; - } - // P-protocol version 0x0102 -> 0x0120 - if ((data.length >= 30) && (data[6] == 0x01) - && (data[28] == 0) && (data[29] == 0)) { - if (data[7] == 0x01) { - data[7] = 0x10; + public synchronized void sendFDODocuments() throws Exception + { + while (true) { + byte[] data = fsReadBlockData(); + if (data.length == 0) { + return; } - if (data[7] == 0x02) { - data[7] = 0x20; + + // P-protocol version 0x0102 -> 0x0120 + if ((data.length >= 30) && (data[6] == 0x01) + && (data[28] == 0) && (data[29] == 0)) { + if (data[7] == 0x01) { + data[7] = 0x10; + } + if (data[7] == 0x02) { + data[7] = 0x20; + } } - } - byte[] answer = sendFDOData(data); - if (answer.length == 0) { - return; + byte[] answer = sendFDOData(data); + if (answer.length == 0) { + return; + } + fsWriteBlockData(answer); } - fsWriteBlockData(answer); - } private byte[] sendFDOData(byte[] data) throws Exception { diff --git a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterNull.java b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterNull.java index b161895e..1c55ed0d 100644 --- a/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterNull.java +++ b/Source/Core/src/com/shtrih/fiscalprinter/SMFiscalPrinterNull.java @@ -110,6 +110,9 @@ public LongPrinterStatus connect() throws Exception { return null; } + public void disconnect() { + } + public void check(int errorCode) throws Exception { } @@ -907,6 +910,11 @@ public FSReadSerial fsReadSerial() throws Exception { return null; } + @Override + public String getFullSerial(){ + return null; + } + @Override public String readFullSerial() throws Exception { return null; diff --git a/Source/Core/src/com/shtrih/jpos/fiscalprinter/FiscalPrinterImpl.java b/Source/Core/src/com/shtrih/jpos/fiscalprinter/FiscalPrinterImpl.java index a8adbe28..e2d0392b 100644 --- a/Source/Core/src/com/shtrih/jpos/fiscalprinter/FiscalPrinterImpl.java +++ b/Source/Core/src/com/shtrih/jpos/fiscalprinter/FiscalPrinterImpl.java @@ -962,6 +962,7 @@ public void setDeviceEnabled(boolean deviceEnabled) throws Exception { stopFDOService(); stopJsonUpdateService(); stopFirmwareUpdaterService(); + getPrinter().disconnect(); connected = false; setPowerState(JPOS_PS_UNKNOWN); } @@ -4513,12 +4514,8 @@ protected JposEntry createJposEntry(String logicalName, } public void saveProperties() { - if (params.fastConnect) { - return; - } - try { - String serial = "FiscalPrinter_" + getPrinter().readFullSerial(); + String serial = "FiscalPrinter_" + getPrinter().getFullSerial(); XmlPropWriter writer = new XmlPropWriter("FiscalPrinter", serial); writer.write(getPrinterImages()); diff --git a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java index f0655b45..a8a5a191 100644 --- a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java +++ b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java @@ -1,5 +1,5 @@ package com.shtrih.util; public class ServiceVersion { - public static final String VERSION = "665"; + public static final String VERSION = "666"; } \ No newline at end of file diff --git a/Source/android/FptrServiceAndroid/src/com/shtrih/fiscalprinter/port/BluetoothLEPort.java b/Source/android/FptrServiceAndroid/src/com/shtrih/fiscalprinter/port/BluetoothLEPort.java index f404630b..12487644 100644 --- a/Source/android/FptrServiceAndroid/src/com/shtrih/fiscalprinter/port/BluetoothLEPort.java +++ b/Source/android/FptrServiceAndroid/src/com/shtrih/fiscalprinter/port/BluetoothLEPort.java @@ -8,6 +8,9 @@ import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; +import android.content.BroadcastReceiver; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Build; import android.content.Context; import android.bluetooth.le.ScanCallback; @@ -33,7 +36,6 @@ public class BluetoothLEPort implements PrinterPort2 { - private static final int PERMISSION_REQUEST_COARSE_LOCATION = 1002; // Permission to scanner private static final UUID UART_SERVICE_UUID = UUID.fromString("0000ABF0-0000-1000-8000-00805f9b34fb"); private static final UUID RX_CHAR_UUID = UUID.fromString("0000ABF1-0000-1000-8000-00805f9b34fb"); private static final UUID TX_CHAR_UUID = UUID.fromString("0000ABF2-0000-1000-8000-00805f9b34fb"); @@ -49,32 +51,31 @@ public class BluetoothLEPort implements PrinterPort2 { private BluetoothDevice device = null; private BluetoothGatt bluetoothGatt = null; private BluetoothGattCharacteristic TxChar = null; - private CircularBuffer rxBuffer = new CircularBuffer(1024); - private static CompositeLogger logger = CompositeLogger.getLogger(BluetoothLEPort.class); - private enum ConnectState {Disconnected, ConnectGatt, FailedToConnectGatt, RequestMtu, + private final CircularBuffer rxBuffer = new CircularBuffer(1024); + private static final CompositeLogger logger = CompositeLogger.getLogger(BluetoothLEPort.class); + private enum ConnectState {Disconnected, ConnectGatt, FailedToConnectGatt, + RequestMtu, DiscoverServices, DiscoverServicesFailed, UartServiceNotSupported, - TxCharCharacteristicNotSupported, TxCharCccdDescriptorNotSupported, Connected}; + TxCharCharacteristicNotSupported, TxCharCccdDescriptorNotSupported, Connected} private ConnectState state = ConnectState.Disconnected; - private enum ScanState {ScanStopped, ScanStarted, ScanFailed, ScanCompleted}; + private enum ScanState {ScanStopped, ScanStarted, ScanFailed, ScanCompleted} private ScanState scanState = ScanState.ScanStopped; private int scanError = 0; private String scanDeviceName = ""; private boolean scanSingle = false; - List scanDevices = new Vector(); - HashMap operations = new HashMap(); + List scanDevices = new Vector<>(); + HashMap operations = new HashMap<>(); private IPortEvents events = null; private boolean portOpened = false; private BluetoothLeScanner scanner; - - private static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION"; - private static final String ACCESS_BACKGROUND_LOCATION = "android.permission.ACCESS_BACKGROUND_LOCATION"; + private boolean receiverRegistered = false; public BluetoothLEPort() { } private void loggerDebug(String text) { - // logger.debug(text); + //logger.debug(text); } private void loggerError(String text) { @@ -94,16 +95,6 @@ private class BluetoothGattCallbackImpl extends BluetoothGattCallback public BluetoothGattCallbackImpl(){ } - public void onPhyUpdate (BluetoothGatt gatt,int txPhy, int rxPhy, int status) - { - loggerDebug("BluetoothGattCallback.onPhyUpdate"); - } - - public void onPhyRead (BluetoothGatt gatt,int txPhy, int rxPhy, int status) - { - loggerDebug("BluetoothGattCallback.onPhyRead"); - } - public void onConnectionStateChange (BluetoothGatt gatt,int status, int newState) { // onConnectionStateChange(status: 8 newState: 0 @@ -228,7 +219,7 @@ private void gattDisconnected() } } - private ScanCallback scanOpenedDeviceCallback = new ScanCallback() + private final ScanCallback scanOpenedDeviceCallback = new ScanCallback() { @Override public void onScanResult(int callbackType, ScanResult result) @@ -296,7 +287,7 @@ private void dataAvailable(BluetoothGattCharacteristic characteristic) if (characteristic == null) return; if (characteristic.getUuid().equals(TX_CHAR_UUID)) { - loggerDebug("Received: " + Hex.toHex(characteristic.getValue())); + //loggerDebug("Received: " + Hex.toHex(characteristic.getValue())); rxBuffer.write(characteristic.getValue()); } } @@ -315,7 +306,7 @@ public void setOpenTimeout(int openTimeout) this.openTimeout = openTimeout; } - public synchronized boolean isOpened(){ + public boolean isOpened(){ return state == ConnectState.Connected; } @@ -338,11 +329,19 @@ private BluetoothAdapter getBluetoothAdapter() throws Exception adapter.cancelDiscovery(); } switch (adapter.getState()) { + case BluetoothAdapter.STATE_ON: { + break; + } + case BluetoothAdapter.STATE_TURNING_ON: { waitBluetoothAdapterStateOn(adapter, openTimeout); break; + } + case BluetoothAdapter.STATE_OFF: { + throw new Exception("Bluetooth is turned off"); } + case BluetoothAdapter.STATE_TURNING_OFF: { throw new Exception("Bluetooth is turning off"); } @@ -371,18 +370,80 @@ public void open(int timeout) throws Exception loggerDebug("open(" + timeout + ")"); doOpen(timeout); + registerReceiver(); portOpened = true; loggerDebug("open: OK"); } - public void openPort() throws Exception{ - doOpen(0); + private String getStateText(int state) { + switch (state) { + case BluetoothAdapter.STATE_ON: + return "STATE_ON"; + case BluetoothAdapter.STATE_OFF: + return "STATE_OFF"; + case BluetoothAdapter.STATE_TURNING_ON: + return "STATE_TURNING_ON"; + case BluetoothAdapter.STATE_TURNING_OFF: + return "STATE_TURNING_OFF"; + default: + return ""; + } + } + + private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() + { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) + { + int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); + String stateText = state + ", " + getStateText(state); + logger.debug("BluetoothAdapter state changed: " + stateText); + + if ((state == BluetoothAdapter.STATE_TURNING_OFF)||(state == BluetoothAdapter.STATE_OFF)||state == BluetoothAdapter.STATE_TURNING_ON) + { + doClose(); + } + } + } + }; + + private void registerReceiver() { + try { + // events + IntentFilter filter = new IntentFilter(); + filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED); + Context context = StaticContext.getContext(); + if (context != null) { + context.registerReceiver(mBroadcastReceiver, filter); + receiverRegistered = true; + } + } catch (Exception e) { + logger.error("Failed to register receiver, " + e.getMessage()); + } + } + + private void unregisterReceiver() { + if (receiverRegistered) { + receiverRegistered = false; + Context context = StaticContext.getContext(); + if (context != null) { + context.unregisterReceiver(mBroadcastReceiver); + } + } + } + + public void checkPortOpened() throws Exception { + if (!isOpened()) { + throw new IOException("Device disconnected"); + } } public synchronized void doOpen(int timeout) throws Exception { if (isOpened()) return; + registerReceiver(); if (state == ConnectState.Disconnected) { if (scanner != null){ @@ -402,11 +463,11 @@ public synchronized void doOpen(int timeout) throws Exception if (device.getBondState() == BluetoothDevice.BOND_BONDED) { throw new Exception(String.format("Device %s must be unpaired.", - device.getAddress().toString())); + device.getAddress())); } connectDevice(device); } - waitOpened(openTimeout); + waitOpened(timeout); } private void connectDevice(BluetoothDevice device) throws Exception @@ -457,6 +518,7 @@ public void close() { loggerDebug("close"); doClose(); + unregisterReceiver(); portOpened = false; loggerDebug("close: OK"); @@ -496,7 +558,7 @@ public int readByte() throws Exception } public byte[] readBytes(int len) throws Exception{ - openPort(); + checkPortOpened(); //loggerDebug("readBytes: " + len); if (len <= 0) @@ -517,9 +579,7 @@ public byte[] readBytes(int len) throws Exception{ throw new IOException("Read timed out"); } } - byte[] data = rxBuffer.read(len); - loggerDebug("read(" + Hex.toHex(data) + ")"); - return data; + return rxBuffer.read(len); } public void checkPortState() throws IOException { @@ -537,7 +597,7 @@ public void write(int b) throws Exception public void write(byte[] b) throws Exception { - loggerDebug("write(" + Hex.toHex(b) + ")"); + //loggerDebug("write(" + Hex.toHex(b) + ")"); int blockSize = 20; if (bluetoothmtu > 0) blockSize = bluetoothmtu; @@ -551,39 +611,33 @@ public void write(byte[] b) throws Exception } byte[] blockData = new byte[dataSize]; System.arraycopy(b, offset, blockData, 0, dataSize); - - if (!writeData(blockData)) break; + writeData(blockData); } loggerDebug("write: OK"); } - private boolean writeData(byte[] blockData) throws Exception + private void writeData(byte[] blockData) throws Exception { loggerDebug("writeData: " + Hex.toHex(blockData)); - - openPort(); - + checkPortOpened(); BluetoothGattService uartService = bluetoothGatt.getService(UART_SERVICE_UUID); if (uartService == null) { - loggerError("UartService not found!"); - return false; + throw new IOException("UartService not found!"); } BluetoothGattCharacteristic RxChar = uartService.getCharacteristic(RX_CHAR_UUID); if (RxChar == null) { - loggerError("Rx charateristic not found!"); - return false; + throw new IOException("Rx charateristic not found!"); } RxChar.setValue(blockData); StatusOperation operation = new StatusOperation(RxChar, "Write"); operations.put(RxChar, operation); boolean status = bluetoothGatt.writeCharacteristic(RxChar); if (!status) { - loggerError("Failed bluetoothGatt.writeCharacteristic"); + throw new IOException("Failed bluetoothGatt.writeCharacteristic"); } operation.wait(writeTimeout); operation.checkStatus(); operations.remove(operation); - return status; } private class StatusOperation @@ -638,7 +692,7 @@ public void completeOperation(Object object, int status) public void setBaudRate(int baudRate) throws Exception{ } - public synchronized void setTimeout(int timeout) + public void setTimeout(int timeout) { this.timeout = timeout; } @@ -767,6 +821,10 @@ public void checkOpened() throws Exception{ } } + public void openPort() throws Exception{ + doOpen(openTimeout); + } + public void setPortEvents(IPortEvents events){ this.events = events; } @@ -774,12 +832,12 @@ public void setPortEvents(IPortEvents events){ // PrinterPort2 public int available() throws Exception{ - checkOpened(); + openPort(); return rxBuffer.available(); } public byte[] read(int len) throws Exception{ - checkOpened(); + openPort(); return rxBuffer.read(len); } diff --git a/Source/android/FptrServiceAndroid/src/com/shtrih/util/CompositeLogger.java b/Source/android/FptrServiceAndroid/src/com/shtrih/util/CompositeLogger.java index 45a19030..10503df9 100644 --- a/Source/android/FptrServiceAndroid/src/com/shtrih/util/CompositeLogger.java +++ b/Source/android/FptrServiceAndroid/src/com/shtrih/util/CompositeLogger.java @@ -47,8 +47,6 @@ public synchronized void error(String text, Throwable e) { } public synchronized void error(Throwable e) { - // TODO: убрать этот метод, нужно всегда передавать сообщение - if (isEnabled) Log.e(className, "", e); diff --git a/Source/android/tinyJavaPosTester/src/com/shtrih/tinyjavapostester/MainActivity.java b/Source/android/tinyJavaPosTester/src/com/shtrih/tinyjavapostester/MainActivity.java index 253edd79..49b64c3a 100644 --- a/Source/android/tinyJavaPosTester/src/com/shtrih/tinyjavapostester/MainActivity.java +++ b/Source/android/tinyJavaPosTester/src/com/shtrih/tinyjavapostester/MainActivity.java @@ -564,16 +564,8 @@ protected String doInBackground(Void... params) { model.ScocUpdaterStatus.set(""); printer.setParameter3(SmFptrConst.SMFPTR_DIO_PARAM_FIRMWARE_UPDATE_OBSERVER, this.params.observer); - - /* - // correct PPP mode - int pppMode = Integer.parseInt(printer.readTable(21, 1, 1)); - log.debug("PPP mode: " + pppMode); - if ((pppMode == 1)||(pppMode == 2)) { - printer.writeTable(21, 1, 1, "0"); - } - */ - //log.debug("Cashier name: " + printer.readCashierName()); + // test for port reopen + log.debug("Cashier name: " + printer.readCashierName()); //printer.reboot(); //log.debug("Cashier name: " + printer.readCashierName());