@nitra/zebra 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -31,6 +31,9 @@ public class Zebra {
|
|
|
31
31
|
/** Стандартний UUID для профілю послідовного порту (SPP) */
|
|
32
32
|
private static final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
|
|
33
33
|
|
|
34
|
+
/** Розмір чанка для запису в сокет (обхід обмеження буфера ~8KB на деяких пристроях) */
|
|
35
|
+
private static final int WRITE_CHUNK_SIZE = 512;
|
|
36
|
+
|
|
34
37
|
private static final String PREFS_NAME = "ZebraPrinter";
|
|
35
38
|
private static final String KEY_ADDRESS = "printer_address";
|
|
36
39
|
|
|
@@ -122,7 +125,11 @@ public class Zebra {
|
|
|
122
125
|
|
|
123
126
|
out = socket.getOutputStream();
|
|
124
127
|
byte[] data = zpl.getBytes(StandardCharsets.UTF_8);
|
|
125
|
-
|
|
128
|
+
// Запис чанками по 512 байт — обхід обмеження буфера (~8KB) на Bluetooth SPP
|
|
129
|
+
for (int offset = 0; offset < data.length; offset += WRITE_CHUNK_SIZE) {
|
|
130
|
+
int len = Math.min(WRITE_CHUNK_SIZE, data.length - offset);
|
|
131
|
+
out.write(data, offset, len);
|
|
132
|
+
}
|
|
126
133
|
out.flush();
|
|
127
134
|
|
|
128
135
|
Logger.info("Zebra", "ZPL успішно відправлено: " + data.length + " байт");
|