@hoangnh0099/react-native-sunmi-printer 0.3.0 → 0.4.1

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.
package/README.md CHANGED
@@ -43,18 +43,50 @@ await printImage(base64String);
43
43
  await lineWrap(3);
44
44
  ```
45
45
 
46
+ ### Print with Styles (Bold, Italic, Underline)
47
+
48
+ ```js
49
+ import {
50
+ setPrinterStyle,
51
+ printText,
52
+ lineWrap,
53
+ printerInit,
54
+ } from '@hoangnh0099/react-native-sunmi-printer';
55
+
56
+ // setPrinterStyle(key, value)
57
+ // Keys: 0=Bold, 1=Underline, 2=AntiWhite, 3=Strikethrough,
58
+ // 4=Italic, 5=Invert, 14=DoubleWidth, 15=DoubleHeight
59
+ // Value: 1=Enable, 0=Disable
60
+ await setPrinterStyle(0, 1); // Bold ON
61
+ await setPrinterStyle(1, 1); // Underline ON
62
+ await printText('Bold & Underlined\n');
63
+ await printerInit(); // Reset all styles
64
+ await lineWrap(3);
65
+ ```
66
+
46
67
  ### Print QR Code
47
68
 
48
69
  ```js
49
70
  import { printQRCode, lineWrap } from '@hoangnh0099/react-native-sunmi-printer';
50
71
 
51
72
  // printQRCode(data, moduleSize, errorLevel)
52
- // moduleSize: 1-16
73
+ // moduleSize: 4-16
53
74
  // errorLevel: 0=L(7%), 1=M(15%), 2=Q(25%), 3=H(30%)
54
75
  await printQRCode('https://example.com', 8, 2);
55
76
  await lineWrap(3);
56
77
  ```
57
78
 
79
+ ### Print 2D Barcode (PDF417 / DataMatrix)
80
+
81
+ ```js
82
+ import { print2DCode, lineWrap } from '@hoangnh0099/react-native-sunmi-printer';
83
+
84
+ // print2DCode(data, symbology, moduleSize, errorLevel)
85
+ // symbology: 1=QR, 2=PDF417, 3=DataMatrix
86
+ await print2DCode('Hello PDF417', 2, 2, 2);
87
+ await lineWrap(3);
88
+ ```
89
+
58
90
  ### Print Barcode
59
91
 
60
92
  ```js
@@ -172,9 +204,39 @@ const state = await updatePrinterState();
172
204
  | Method | Description |
173
205
  | ----------------------------- | ----------------------------------------- |
174
206
  | `setAlignment(alignment)` | Set alignment (0=left, 1=center, 2=right) |
175
- | `setFontName(typeface)` | ~~Not supported in PrinterX SDK~~ |
207
+ | `setFontName(typeface)` | Set custom vector font name |
176
208
  | `setFontSize(fontsize)` | Set font size |
177
- | `setPrinterStyle(key, value)` | ~~Not supported in PrinterX SDK~~ |
209
+ | `setPrinterStyle(key, value)` | Set print style (see table below) |
210
+
211
+ **`setPrinterStyle` Keys:**
212
+
213
+ | Key | Constant | Values |
214
+ | --- | -------------------- | ----------------- |
215
+ | 0 | `ENABLE_BOLD` | 0=off, 1=on |
216
+ | 1 | `ENABLE_UNDERLINE` | 0=off, 1=on |
217
+ | 2 | `ENABLE_ANTI_WHITE` | 0=off, 1=on |
218
+ | 3 | `ENABLE_STRIKETHROUGH` | 0=off, 1=on |
219
+ | 4 | `ENABLE_ITALIC` | 0=off, 1=on |
220
+ | 5 | `ENABLE_INVERT` | 0=off, 1=on |
221
+ | 6 | `SET_TEXT_RIGHT_SPACING` | pixels |
222
+ | 9 | `SET_LINE_SPACING` | pixels |
223
+ | 14 | `ENABLE_DOUBLE_WIDTH` | 0=off, 1=on |
224
+ | 15 | `ENABLE_DOUBLE_HEIGHT` | 0=off, 1=on |
225
+
226
+ </details>
227
+
228
+ <details>
229
+ <summary><b>Print Style Query</b></summary>
230
+
231
+ | Method | Return | Description |
232
+ | --------------------- | ------------------- | ------------------------------------------------- |
233
+ | `getForcedDouble()` | `Promise<number>` | 0=none, 1=width, 2=height, 3=both |
234
+ | `isForcedBold()` | `Promise<boolean>` | Whether bold is currently enabled |
235
+ | `isForcedUnderline()` | `Promise<boolean>` | Whether underline is currently enabled |
236
+ | `isForcedAntiWhite()` | `Promise<boolean>` | Whether anti-white is currently enabled |
237
+ | `getForcedRowHeight()` | `Promise<number>` | Current line spacing (-1=default) |
238
+ | `getCurrentFontName()` | `Promise<string>` | Current font name (empty=default) |
239
+ | `getPrinterDensity()` | `Promise<number>` | Print density level |
178
240
 
179
241
  </details>
180
242
 
@@ -204,10 +266,11 @@ const state = await updatePrinterState();
204
266
  <details>
205
267
  <summary><b>Barcode</b></summary>
206
268
 
207
- | Method | Description |
208
- | ------------------------------------------------------------ | ------------- |
209
- | `printBarCode(data, symbology, height, width, textPosition)` | Print barcode |
210
- | `printQRCode(data, moduleSize, errorLevel)` | Print QR code |
269
+ | Method | Description |
270
+ | ------------------------------------------------------------ | ----------------------------------------------- |
271
+ | `printBarCode(data, symbology, height, width, textPosition)` | Print 1D barcode |
272
+ | `printQRCode(data, moduleSize, errorLevel)` | Print QR code |
273
+ | `print2DCode(data, symbology, moduleSize, errorLevel)` | Print 2D barcode (1=QR, 2=PDF417, 3=DataMatrix) |
211
274
 
212
275
  </details>
213
276
 
@@ -224,54 +287,66 @@ const state = await updatePrinterState();
224
287
  <details>
225
288
  <summary><b>Raw / Paper</b></summary>
226
289
 
227
- | Method | Description |
228
- | ------------------- | -------------------------------- |
229
- | `sendRAWData(data)` | Send raw ESC/POS byte array |
230
- | `lineWrap(lines)` | Feed paper by N lines |
231
- | `cutPaper()` | Cut paper (if cutter available) |
232
- | `autoOutPaper()` | Auto feed paper to tear position |
290
+ | Method | Return | Description |
291
+ | ----------------------- | ----------------- | --------------------------------- |
292
+ | `sendRAWData(data)` | `Promise<void>` | Send raw ESC/POS byte array |
293
+ | `lineWrap(lines)` | `Promise<void>` | Feed paper by N lines |
294
+ | `cutPaper()` | `Promise<void>` | Cut paper (if cutter available) |
295
+ | `autoOutPaper()` | `Promise<void>` | Auto feed paper to tear position |
296
+ | `getCutPaperTimes()` | `Promise<number>` | Get total cutter usage count |
297
+ | `getPrinterBBMDistance()` | `Promise<number>` | Get black mark paper feed distance |
233
298
 
234
299
  </details>
235
300
 
236
301
  <details>
237
302
  <summary><b>Cash Drawer</b></summary>
238
303
 
239
- | Method | Description |
240
- | -------------- | ------------------------------- |
241
- | `openDrawer()` | Open cash drawer (if available) |
304
+ | Method | Return | Description |
305
+ | -------------------- | ----------------- | ----------------------------------- |
306
+ | `openDrawer()` | `Promise<void>` | Open cash drawer (if available) |
307
+ | `getDrawerStatus()` | `Promise<number>` | Drawer state (0=closed, 1=open) |
308
+ | `getOpenDrawerTimes()` | `Promise<number>` | Total drawer open count |
242
309
 
243
310
  </details>
244
311
 
245
312
  <details>
246
313
  <summary><b>Label</b></summary>
247
314
 
248
- | Method | Description |
249
- | --------------- | -------------------------------- |
250
- | `labelLocate()` | ~~Not supported in PrinterX SDK~~ |
251
- | `labelOutput()` | ~~Not supported in PrinterX SDK~~ |
315
+ | Method | Description |
316
+ | --------------- | ------------------------------------------------ |
317
+ | `labelLocate()` | Position the next label (set device to Label Mode first) |
318
+ | `labelOutput()` | Output the label to the cutting position |
319
+
320
+ > **Note:** Enable Label Mode in device settings: Print Settings > Built-in Setting > Printer Mode > Label Mode.
252
321
 
253
322
  </details>
254
323
 
255
324
  <details>
256
325
  <summary><b>LCD Customer Display</b></summary>
257
326
 
258
- | Method | Description |
259
- | ------------------------------------- | ------------------------------------------ |
260
- | `sendLCDCommand(flag)` | LCD command (1=init, 2=wake, 3=sleep, 4=clear) |
261
- | `sendLCDFillString(text, size, fill)` | Display text on LCD |
262
- | `sendLCDMultiString(texts, align)` | Display multi-line text on LCD |
263
- | `sendLCDBitmap(base64)` | Display image on LCD |
327
+ | Method | Description |
328
+ | ----------------------------------------- | --------------------------------------------------- |
329
+ | `sendLCDCommand(flag)` | LCD command (1=init, 2=wake, 3=sleep, 4=clear) |
330
+ | `sendLCDString(text)` | Display single-line text on LCD |
331
+ | `sendLCDDoubleString(topText, bottomText)` | Display two lines on LCD |
332
+ | `sendLCDFillString(text, size, fill)` | Display text with custom size (fill=stretch to fit) |
333
+ | `sendLCDMultiString(texts, align)` | Display multi-line text (auto-sized by weight) |
334
+ | `sendLCDBitmap(base64)` | Display image on LCD (max 128x40px) |
335
+
336
+ > Only available on mini-series desktop devices with a customer display (T1mini, T2mini, etc.).
264
337
 
265
338
  </details>
266
339
 
267
340
  <details>
268
341
  <summary><b>Transaction</b></summary>
269
342
 
270
- | Method | Description |
271
- | --------------------------- | -------------------------------------------- |
272
- | `enterPrinterBuffer(clean)` | Start buffering commands |
273
- | `exitPrinterBuffer(commit)` | Exit buffer (commit=true to print) |
274
- | `commitPrinterBuffer()` | Print buffer contents (stays in buffer mode) |
343
+ | Method | Description |
344
+ | --------------------------------------- | -------------------------------------------- |
345
+ | `enterPrinterBuffer(clean)` | Start buffering commands |
346
+ | `exitPrinterBuffer(commit)` | Exit buffer (commit=true to print) |
347
+ | `commitPrinterBuffer()` | Print buffer contents (stays in buffer mode) |
348
+ | `exitPrinterBufferWithCallback(commit)` | Exit buffer with print result callback |
349
+ | `commitPrinterBufferWithCallback()` | Commit buffer with print result callback |
275
350
 
276
351
  </details>
277
352
 
@@ -20,6 +20,7 @@ import com.sunmi.printerx.style.BaseStyle
20
20
  import com.sunmi.printerx.style.BarcodeStyle
21
21
  import com.sunmi.printerx.style.BitmapStyle
22
22
  import com.sunmi.printerx.style.QrStyle
23
+ import com.sunmi.printerx.style.LabelStyle
23
24
  import com.sunmi.printerx.style.TextStyle
24
25
 
25
26
  class SunmiPrinterModule(reactContext: ReactApplicationContext) :
@@ -31,6 +32,32 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
31
32
  // Formatting state
32
33
  private var currentAlignment: Align = Align.LEFT
33
34
  private var currentFontSize: Int = 24
35
+ private var currentFontName: String? = null
36
+ private var currentBold: Boolean = false
37
+ private var currentUnderline: Boolean = false
38
+ private var currentItalic: Boolean = false
39
+ private var currentStrikethrough: Boolean = false
40
+ private var currentAntiWhite: Boolean = false
41
+ private var currentInvert: Boolean = false
42
+ private var currentDoubleWidth: Boolean = false
43
+ private var currentDoubleHeight: Boolean = false
44
+ private var currentTextSpace: Int = 0
45
+ private var currentLineSpacing: Int = -1
46
+
47
+ // WoyouConsts keys
48
+ companion object {
49
+ const val NAME = NativeSunmiPrinterSpec.NAME
50
+ private const val ENABLE_BOLD = 0
51
+ private const val ENABLE_UNDERLINE = 1
52
+ private const val ENABLE_ANTI_WHITE = 2
53
+ private const val ENABLE_STRIKETHROUGH = 3
54
+ private const val ENABLE_ITALIC = 4
55
+ private const val ENABLE_INVERT = 5
56
+ private const val SET_TEXT_RIGHT_SPACING = 6
57
+ private const val SET_LINE_SPACING = 9
58
+ private const val ENABLE_DOUBLE_WIDTH = 14
59
+ private const val ENABLE_DOUBLE_HEIGHT = 15
60
+ }
34
61
 
35
62
  init {
36
63
  PrinterSdk.getInstance().getPrinter(reactContext, object : PrinterSdk.PrinterListen {
@@ -68,6 +95,22 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
68
95
  else -> Align.LEFT
69
96
  }
70
97
 
98
+ private fun buildTextStyle(): TextStyle {
99
+ return TextStyle.getStyle().apply {
100
+ setTextSize(currentFontSize)
101
+ enableBold(currentBold)
102
+ enableUnderline(currentUnderline)
103
+ enableStrikethrough(currentStrikethrough)
104
+ enableItalics(currentItalic)
105
+ enableAntiColor(currentAntiWhite)
106
+ enableInvert(currentInvert)
107
+ if (currentDoubleWidth) setTextWidthRatio(2) else setTextWidthRatio(1)
108
+ if (currentDoubleHeight) setTextHeightRatio(2) else setTextHeightRatio(1)
109
+ if (currentTextSpace > 0) setTextSpace(currentTextSpace)
110
+ currentFontName?.let { if (it.isNotEmpty()) setFont(it) }
111
+ }
112
+ }
113
+
71
114
  // region Printer Info
72
115
 
73
116
  override fun getPrinterSerialNo(promise: Promise) {
@@ -136,6 +179,8 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
136
179
  override fun getFirmwareStatus(promise: Promise) {
137
180
  val p = getPrinter(promise) ?: return
138
181
  try {
182
+ // PrinterX SDK does not expose firmware update status directly.
183
+ // Returns 0 (unknown). Use updatePrinterState() for operational status.
139
184
  promise.resolve(0)
140
185
  } catch (e: Exception) {
141
186
  promise.reject("PRINTER_ERROR", e.message, e)
@@ -154,7 +199,8 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
154
199
  override fun getPrintedLength(promise: Promise) {
155
200
  val p = getPrinter(promise) ?: return
156
201
  try {
157
- promise.resolve("0")
202
+ val distance = p.queryApi().getInfo(PrinterInfo.DISTANCE)
203
+ promise.resolve(distance ?: "0")
158
204
  } catch (e: Exception) {
159
205
  promise.reject("PRINTER_ERROR", e.message, e)
160
206
  }
@@ -178,6 +224,17 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
178
224
  try {
179
225
  currentAlignment = Align.LEFT
180
226
  currentFontSize = 24
227
+ currentFontName = null
228
+ currentBold = false
229
+ currentUnderline = false
230
+ currentItalic = false
231
+ currentStrikethrough = false
232
+ currentAntiWhite = false
233
+ currentInvert = false
234
+ currentDoubleWidth = false
235
+ currentDoubleHeight = false
236
+ currentTextSpace = 0
237
+ currentLineSpacing = -1
181
238
  p.lineApi()?.initLine(BaseStyle.getStyle())
182
239
  promise.resolve(null)
183
240
  } catch (e: Exception) {
@@ -214,6 +271,7 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
214
271
 
215
272
  override fun setFontName(typeface: String, promise: Promise) {
216
273
  try {
274
+ currentFontName = typeface
217
275
  promise.resolve(null)
218
276
  } catch (e: Exception) {
219
277
  promise.reject("PRINTER_ERROR", e.message, e)
@@ -231,6 +289,21 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
231
289
 
232
290
  override fun setPrinterStyle(key: Double, value: Double, promise: Promise) {
233
291
  try {
292
+ val k = key.toInt()
293
+ val v = value.toInt()
294
+ val enabled = v == 1
295
+ when (k) {
296
+ ENABLE_BOLD -> currentBold = enabled
297
+ ENABLE_UNDERLINE -> currentUnderline = enabled
298
+ ENABLE_ANTI_WHITE -> currentAntiWhite = enabled
299
+ ENABLE_STRIKETHROUGH -> currentStrikethrough = enabled
300
+ ENABLE_ITALIC -> currentItalic = enabled
301
+ ENABLE_INVERT -> currentInvert = enabled
302
+ SET_TEXT_RIGHT_SPACING -> currentTextSpace = v
303
+ SET_LINE_SPACING -> currentLineSpacing = v
304
+ ENABLE_DOUBLE_WIDTH -> currentDoubleWidth = enabled
305
+ ENABLE_DOUBLE_HEIGHT -> currentDoubleHeight = enabled
306
+ }
234
307
  promise.resolve(null)
235
308
  } catch (e: Exception) {
236
309
  promise.reject("PRINTER_ERROR", e.message, e)
@@ -246,7 +319,7 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
246
319
  try {
247
320
  p.lineApi()?.run {
248
321
  initLine(BaseStyle.getStyle().setAlign(currentAlignment))
249
- printText(text, TextStyle.getStyle().setTextSize(currentFontSize))
322
+ printText(text, buildTextStyle())
250
323
  if (!isTransMode) autoOut()
251
324
  }
252
325
  promise.resolve(null)
@@ -258,9 +331,11 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
258
331
  override fun printTextWithFont(text: String, typeface: String, fontsize: Double, promise: Promise) {
259
332
  val p = getPrinter(promise) ?: return
260
333
  try {
334
+ val style = buildTextStyle().setTextSize(fontsize.toInt())
335
+ if (typeface.isNotEmpty()) style.setFont(typeface)
261
336
  p.lineApi()?.run {
262
337
  initLine(BaseStyle.getStyle().setAlign(currentAlignment))
263
- printText(text, TextStyle.getStyle().setTextSize(fontsize.toInt()))
338
+ printText(text, style)
264
339
  if (!isTransMode) autoOut()
265
340
  }
266
341
  promise.resolve(null)
@@ -318,6 +393,74 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
318
393
 
319
394
  // endregion
320
395
 
396
+ // region Print Style Query
397
+
398
+ override fun getForcedDouble(promise: Promise) {
399
+ try {
400
+ val value = when {
401
+ currentDoubleWidth && currentDoubleHeight -> 3
402
+ currentDoubleHeight -> 2
403
+ currentDoubleWidth -> 1
404
+ else -> 0
405
+ }
406
+ promise.resolve(value)
407
+ } catch (e: Exception) {
408
+ promise.reject("PRINTER_ERROR", e.message, e)
409
+ }
410
+ }
411
+
412
+ override fun isForcedBold(promise: Promise) {
413
+ try {
414
+ promise.resolve(currentBold)
415
+ } catch (e: Exception) {
416
+ promise.reject("PRINTER_ERROR", e.message, e)
417
+ }
418
+ }
419
+
420
+ override fun isForcedUnderline(promise: Promise) {
421
+ try {
422
+ promise.resolve(currentUnderline)
423
+ } catch (e: Exception) {
424
+ promise.reject("PRINTER_ERROR", e.message, e)
425
+ }
426
+ }
427
+
428
+ override fun isForcedAntiWhite(promise: Promise) {
429
+ try {
430
+ promise.resolve(currentAntiWhite)
431
+ } catch (e: Exception) {
432
+ promise.reject("PRINTER_ERROR", e.message, e)
433
+ }
434
+ }
435
+
436
+ override fun getPrinterDensity(promise: Promise) {
437
+ val p = getPrinter(promise) ?: return
438
+ try {
439
+ val density = p.queryApi().getInfo(PrinterInfo.DENSITY)
440
+ promise.resolve(density?.toIntOrNull() ?: 0)
441
+ } catch (e: Exception) {
442
+ promise.reject("PRINTER_ERROR", e.message, e)
443
+ }
444
+ }
445
+
446
+ override fun getForcedRowHeight(promise: Promise) {
447
+ try {
448
+ promise.resolve(currentLineSpacing)
449
+ } catch (e: Exception) {
450
+ promise.reject("PRINTER_ERROR", e.message, e)
451
+ }
452
+ }
453
+
454
+ override fun getCurrentFontName(promise: Promise) {
455
+ try {
456
+ promise.resolve(currentFontName ?: "")
457
+ } catch (e: Exception) {
458
+ promise.reject("PRINTER_ERROR", e.message, e)
459
+ }
460
+ }
461
+
462
+ // endregion
463
+
321
464
  // region Barcode
322
465
 
323
466
  override fun printBarCode(
@@ -376,6 +519,64 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
376
519
  }
377
520
  }
378
521
 
522
+ override fun print2DCode(data: String, symbology: Double, modulesize: Double, errorlevel: Double, promise: Promise) {
523
+ val p = getPrinter(promise) ?: return
524
+ try {
525
+ when (symbology.toInt()) {
526
+ 1 -> {
527
+ // QR Code - delegate to printQrCode
528
+ val level = when (errorlevel.toInt()) {
529
+ 0 -> ErrorLevel.L
530
+ 1 -> ErrorLevel.M
531
+ 2 -> ErrorLevel.Q
532
+ 3 -> ErrorLevel.H
533
+ else -> ErrorLevel.L
534
+ }
535
+ p.lineApi()?.run {
536
+ initLine(BaseStyle.getStyle().setAlign(currentAlignment))
537
+ printQrCode(data, QrStyle.getStyle()
538
+ .setAlign(currentAlignment)
539
+ .setDot(modulesize.toInt())
540
+ .setErrorLevel(level))
541
+ if (!isTransMode) autoOut()
542
+ }
543
+ }
544
+ 2 -> {
545
+ // PDF417 via ESC/POS GS ( k commands
546
+ val dataBytes = data.toByteArray(Charsets.UTF_8)
547
+ val storeLen = dataBytes.size + 3
548
+ val pL = (storeLen and 0xFF).toByte()
549
+ val pH = ((storeLen shr 8) and 0xFF).toByte()
550
+ val cmd = byteArrayOf(
551
+ 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x43, modulesize.toInt().toByte(),
552
+ 0x1D, 0x28, 0x6B, 0x04, 0x00, 0x30, 0x45, 0x30, errorlevel.toInt().toByte()
553
+ ) + byteArrayOf(0x1D, 0x28, 0x6B, pL, pH, 0x30, 0x50, 0x30) + dataBytes +
554
+ byteArrayOf(0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x51, 0x30)
555
+ p.commandApi()?.sendEscCommand(cmd)
556
+ }
557
+ 3 -> {
558
+ // DataMatrix via ESC/POS GS ( k commands
559
+ val dataBytes = data.toByteArray(Charsets.UTF_8)
560
+ val storeLen = dataBytes.size + 3
561
+ val pL = (storeLen and 0xFF).toByte()
562
+ val pH = ((storeLen shr 8) and 0xFF).toByte()
563
+ val cmd = byteArrayOf(
564
+ 0x1D, 0x28, 0x6B, 0x03, 0x00, 0x36, 0x43, modulesize.toInt().toByte()
565
+ ) + byteArrayOf(0x1D, 0x28, 0x6B, pL, pH, 0x36, 0x50, 0x30) + dataBytes +
566
+ byteArrayOf(0x1D, 0x28, 0x6B, 0x03, 0x00, 0x36, 0x51, 0x30)
567
+ p.commandApi()?.sendEscCommand(cmd)
568
+ }
569
+ else -> {
570
+ promise.reject("PRINTER_ERROR", "Unsupported 2D symbology: ${symbology.toInt()}")
571
+ return
572
+ }
573
+ }
574
+ promise.resolve(null)
575
+ } catch (e: Exception) {
576
+ promise.reject("PRINTER_ERROR", e.message, e)
577
+ }
578
+ }
579
+
379
580
  // endregion
380
581
 
381
582
  // region Table
@@ -469,12 +670,58 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
469
670
  }
470
671
  }
471
672
 
673
+ override fun getDrawerStatus(promise: Promise) {
674
+ val p = getPrinter(promise) ?: return
675
+ try {
676
+ val isOpen = p.cashDrawerApi()?.isOpen() ?: false
677
+ promise.resolve(if (isOpen) 1 else 0)
678
+ } catch (e: Exception) {
679
+ promise.reject("PRINTER_ERROR", e.message, e)
680
+ }
681
+ }
682
+
683
+ override fun getOpenDrawerTimes(promise: Promise) {
684
+ val p = getPrinter(promise) ?: return
685
+ try {
686
+ // PrinterX SDK does not track drawer open count. Returns 0.
687
+ promise.resolve(0)
688
+ } catch (e: Exception) {
689
+ promise.reject("PRINTER_ERROR", e.message, e)
690
+ }
691
+ }
692
+
693
+ // endregion
694
+
695
+ // region Cut Paper Info
696
+
697
+ override fun getCutPaperTimes(promise: Promise) {
698
+ val p = getPrinter(promise) ?: return
699
+ try {
700
+ val cutter = p.queryApi().getInfo(PrinterInfo.CUTTER)
701
+ promise.resolve(cutter?.toIntOrNull() ?: 0)
702
+ } catch (e: Exception) {
703
+ promise.reject("PRINTER_ERROR", e.message, e)
704
+ }
705
+ }
706
+
707
+ override fun getPrinterBBMDistance(promise: Promise) {
708
+ val p = getPrinter(promise) ?: return
709
+ try {
710
+ val distance = p.queryApi().getInfo(PrinterInfo.DISTANCE)
711
+ promise.resolve(distance?.toIntOrNull() ?: 0)
712
+ } catch (e: Exception) {
713
+ promise.reject("PRINTER_ERROR", e.message, e)
714
+ }
715
+ }
716
+
472
717
  // endregion
473
718
 
474
719
  // region Label
475
720
 
476
721
  override fun labelLocate(promise: Promise) {
722
+ val p = getPrinter(promise) ?: return
477
723
  try {
724
+ p.lineApi()?.initLine(LabelStyle.getStyle().setAlign(currentAlignment))
478
725
  promise.resolve(null)
479
726
  } catch (e: Exception) {
480
727
  promise.reject("PRINTER_ERROR", e.message, e)
@@ -482,7 +729,9 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
482
729
  }
483
730
 
484
731
  override fun labelOutput(promise: Promise) {
732
+ val p = getPrinter(promise) ?: return
485
733
  try {
734
+ p.lineApi()?.autoOut()
486
735
  promise.resolve(null)
487
736
  } catch (e: Exception) {
488
737
  promise.reject("PRINTER_ERROR", e.message, e)
@@ -510,6 +759,26 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
510
759
  }
511
760
  }
512
761
 
762
+ override fun sendLCDString(text: String, promise: Promise) {
763
+ val p = getPrinter(promise) ?: return
764
+ try {
765
+ p.lcdApi()?.showText(text, 0, false)
766
+ promise.resolve(null)
767
+ } catch (e: Exception) {
768
+ promise.reject("PRINTER_ERROR", e.message, e)
769
+ }
770
+ }
771
+
772
+ override fun sendLCDDoubleString(topText: String, bottomText: String, promise: Promise) {
773
+ val p = getPrinter(promise) ?: return
774
+ try {
775
+ p.lcdApi()?.showTexts(arrayOf(topText, bottomText), intArrayOf(1, 1))
776
+ promise.resolve(null)
777
+ } catch (e: Exception) {
778
+ promise.reject("PRINTER_ERROR", e.message, e)
779
+ }
780
+ }
781
+
513
782
  override fun sendLCDFillString(text: String, size: Double, fill: Boolean, promise: Promise) {
514
783
  val p = getPrinter(promise) ?: return
515
784
  try {
@@ -599,6 +868,14 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
599
868
  }
600
869
  }
601
870
 
871
+ override fun commitPrinterBufferWithCallback(promise: Promise) {
872
+ commitPrinterBuffer(promise)
873
+ }
874
+
875
+ override fun exitPrinterBufferWithCallback(commit: Boolean, promise: Promise) {
876
+ exitPrinterBuffer(commit, promise)
877
+ }
878
+
602
879
  // endregion
603
880
 
604
881
  override fun invalidate() {
@@ -606,8 +883,4 @@ class SunmiPrinterModule(reactContext: ReactApplicationContext) :
606
883
  PrinterSdk.getInstance().destroy()
607
884
  printer = null
608
885
  }
609
-
610
- companion object {
611
- const val NAME = NativeSunmiPrinterSpec.NAME
612
- }
613
886
  }
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSunmiPrinter.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AA2FpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeSunmiPrinter.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAoHpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
@@ -56,6 +56,29 @@ export function setPrinterStyle(key, value) {
56
56
  return SunmiPrinter.setPrinterStyle(key, value);
57
57
  }
58
58
 
59
+ // Print Style Query
60
+ export function getForcedDouble() {
61
+ return SunmiPrinter.getForcedDouble();
62
+ }
63
+ export function isForcedBold() {
64
+ return SunmiPrinter.isForcedBold();
65
+ }
66
+ export function isForcedUnderline() {
67
+ return SunmiPrinter.isForcedUnderline();
68
+ }
69
+ export function isForcedAntiWhite() {
70
+ return SunmiPrinter.isForcedAntiWhite();
71
+ }
72
+ export function getPrinterDensity() {
73
+ return SunmiPrinter.getPrinterDensity();
74
+ }
75
+ export function getForcedRowHeight() {
76
+ return SunmiPrinter.getForcedRowHeight();
77
+ }
78
+ export function getCurrentFontName() {
79
+ return SunmiPrinter.getCurrentFontName();
80
+ }
81
+
59
82
  // Text
60
83
  export function printText(text) {
61
84
  return SunmiPrinter.printText(text);
@@ -82,6 +105,9 @@ export function printBarCode(data, symbology, height, width, textposition) {
82
105
  export function printQRCode(data, modulesize, errorlevel) {
83
106
  return SunmiPrinter.printQRCode(data, modulesize, errorlevel);
84
107
  }
108
+ export function print2DCode(data, symbology, modulesize, errorlevel) {
109
+ return SunmiPrinter.print2DCode(data, symbology, modulesize, errorlevel);
110
+ }
85
111
 
86
112
  // Table
87
113
  export function printColumnsText(texts, widths, aligns) {
@@ -103,6 +129,12 @@ export function lineWrap(lines) {
103
129
  export function cutPaper() {
104
130
  return SunmiPrinter.cutPaper();
105
131
  }
132
+ export function getCutPaperTimes() {
133
+ return SunmiPrinter.getCutPaperTimes();
134
+ }
135
+ export function getPrinterBBMDistance() {
136
+ return SunmiPrinter.getPrinterBBMDistance();
137
+ }
106
138
  export function autoOutPaper() {
107
139
  return SunmiPrinter.autoOutPaper();
108
140
  }
@@ -111,6 +143,12 @@ export function autoOutPaper() {
111
143
  export function openDrawer() {
112
144
  return SunmiPrinter.openDrawer();
113
145
  }
146
+ export function getDrawerStatus() {
147
+ return SunmiPrinter.getDrawerStatus();
148
+ }
149
+ export function getOpenDrawerTimes() {
150
+ return SunmiPrinter.getOpenDrawerTimes();
151
+ }
114
152
 
115
153
  // Label
116
154
  export function labelLocate() {
@@ -124,6 +162,12 @@ export function labelOutput() {
124
162
  export function sendLCDCommand(flag) {
125
163
  return SunmiPrinter.sendLCDCommand(flag);
126
164
  }
165
+ export function sendLCDString(text) {
166
+ return SunmiPrinter.sendLCDString(text);
167
+ }
168
+ export function sendLCDDoubleString(topText, bottomText) {
169
+ return SunmiPrinter.sendLCDDoubleString(topText, bottomText);
170
+ }
127
171
  export function sendLCDFillString(text, size, fill) {
128
172
  return SunmiPrinter.sendLCDFillString(text, size, fill);
129
173
  }
@@ -144,4 +188,10 @@ export function exitPrinterBuffer(commit) {
144
188
  export function commitPrinterBuffer() {
145
189
  return SunmiPrinter.commitPrinterBuffer();
146
190
  }
191
+ export function exitPrinterBufferWithCallback(commit) {
192
+ return SunmiPrinter.exitPrinterBufferWithCallback(commit);
193
+ }
194
+ export function commitPrinterBufferWithCallback() {
195
+ return SunmiPrinter.commitPrinterBufferWithCallback();
196
+ }
147
197
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SunmiPrinter","getPrinterSerialNo","getPrinterVersion","getPrinterModal","getPrinterPaper","getPrinterMode","getServiceVersion","getFirmwareStatus","updatePrinterState","getPrintedLength","getPrinterFactory","printerInit","printerSelfChecking","setAlignment","alignment","setFontName","typeface","setFontSize","fontsize","setPrinterStyle","key","value","printText","text","printTextWithFont","printOriginalText","printImage","base64","printBitmapCustom","type","printBarCode","data","symbology","height","width","textposition","printQRCode","modulesize","errorlevel","printColumnsText","texts","widths","aligns","printColumnsString","sendRAWData","lineWrap","lines","cutPaper","autoOutPaper","openDrawer","labelLocate","labelOutput","sendLCDCommand","flag","sendLCDFillString","size","fill","sendLCDMultiString","align","sendLCDBitmap","enterPrinterBuffer","clean","exitPrinterBuffer","commit","commitPrinterBuffer"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,yBAAsB;;AAE/C;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,OAAOD,YAAY,CAACC,kBAAkB,CAAC,CAAC;AAC1C;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAoB;EACnD,OAAOF,YAAY,CAACE,iBAAiB,CAAC,CAAC;AACzC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAoB;EACjD,OAAOH,YAAY,CAACG,eAAe,CAAC,CAAC;AACvC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAoB;EACjD,OAAOJ,YAAY,CAACI,eAAe,CAAC,CAAC;AACvC;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAoB;EAChD,OAAOL,YAAY,CAACK,cAAc,CAAC,CAAC;AACtC;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAoB;EACnD,OAAON,YAAY,CAACM,iBAAiB,CAAC,CAAC;AACzC;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAoB;EACnD,OAAOP,YAAY,CAACO,iBAAiB,CAAC,CAAC;AACzC;AAEA,OAAO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,OAAOR,YAAY,CAACQ,k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C","ignoreList":[]}
1
+ {"version":3,"names":["SunmiPrinter","getPrinterSerialNo","getPrinterVersion","getPrinterModal","getPrinterPaper","getPrinterMode","getServiceVersion","getFirmwareStatus","updatePrinterState","getPrintedLength","getPrinterFactory","printerInit","printerSelfChecking","setAlignment","alignment","setFontName","typeface","setFontSize","fontsize","setPrinterStyle","key","value","getForcedDouble","isForcedBold","isForcedUnderline","isForcedAntiWhite","getPrinterDensity","getForcedRowHeight","getCurrentFontName","printText","text","printTextWithFont","printOriginalText","printImage","base64","printBitmapCustom","type","printBarCode","data","symbology","height","width","textposition","printQRCode","modulesize","errorlevel","print2DCode","printColumnsText","texts","widths","aligns","printColumnsString","sendRAWData","lineWrap","lines","cutPaper","getCutPaperTimes","getPrinterBBMDistance","autoOutPaper","openDrawer","getDrawerStatus","getOpenDrawerTimes","labelLocate","labelOutput","sendLCDCommand","flag","sendLCDString","sendLCDDoubleString","topText","bottomText","sendLCDFillString","size","fill","sendLCDMultiString","align","sendLCDBitmap","enterPrinterBuffer","clean","exitPrinterBuffer","commit","commitPrinterBuffer","exitPrinterBufferWithCallback","commitPrinterBufferWithCallback"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,yBAAsB;;AAE/C;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,OAAOD,YAAY,CAACC,kBAAkB,CAAC,CAAC;AAC1C;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAoB;EACnD,OAAOF,YAAY,CAACE,iBAAiB,CAAC,CAAC;AACzC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAoB;EACjD,OAAOH,YAAY,CAACG,eAAe,CAAC,CAAC;AACvC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAoB;EACjD,OAAOJ,YAAY,CAACI,eAAe,CAAC,CAAC;AACvC;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAoB;EAChD,OAAOL,YAAY,CAACK,cAAc,CAAC,CAAC;AACtC;A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,YAAY,CAACyE,kBAAkB,CAACzB,KAAK,EAAE0B,KAAK,CAAC;AACtD;AAEA,OAAO,SAASC,aAAaA,CAACzC,MAAc,EAAiB;EAC3D,OAAOlC,YAAY,CAAC2E,aAAa,CAACzC,MAAM,CAAC;AAC3C;;AAEA;AACA,OAAO,SAAS0C,kBAAkBA,CAACC,KAAc,EAAiB;EAChE,OAAO7E,YAAY,CAAC4E,kBAAkB,CAACC,KAAK,CAAC;AAC/C;AAEA,OAAO,SAASC,iBAAiBA,CAACC,MAAe,EAAiB;EAChE,OAAO/E,YAAY,CAAC8E,iBAAiB,CAACC,MAAM,CAAC;AAC/C;AAEA,OAAO,SAASC,mBAAmBA,CAAA,EAAkB;EACnD,OAAOhF,YAAY,CAACgF,mBAAmB,CAAC,CAAC;AAC3C;AAEA,OAAO,SAASC,6BAA6BA,CAACF,MAAe,EAAiB;EAC5E,OAAO/E,YAAY,CAACiF,6BAA6B,CAACF,MAAM,CAAC;AAC3D;AAEA,OAAO,SAASG,+BAA+BA,CAAA,EAAkB;EAC/D,OAAOlF,YAAY,CAACkF,+BAA+B,CAAC,CAAC;AACvD","ignoreList":[]}
@@ -16,6 +16,13 @@ export interface Spec extends TurboModule {
16
16
  setFontName(typeface: string): Promise<void>;
17
17
  setFontSize(fontsize: number): Promise<void>;
18
18
  setPrinterStyle(key: number, value: number): Promise<void>;
19
+ getForcedDouble(): Promise<number>;
20
+ isForcedBold(): Promise<boolean>;
21
+ isForcedUnderline(): Promise<boolean>;
22
+ isForcedAntiWhite(): Promise<boolean>;
23
+ getPrinterDensity(): Promise<number>;
24
+ getForcedRowHeight(): Promise<number>;
25
+ getCurrentFontName(): Promise<string>;
19
26
  printText(text: string): Promise<void>;
20
27
  printTextWithFont(text: string, typeface: string, fontsize: number): Promise<void>;
21
28
  printOriginalText(text: string): Promise<void>;
@@ -23,22 +30,31 @@ export interface Spec extends TurboModule {
23
30
  printBitmapCustom(base64: string, type: number): Promise<void>;
24
31
  printBarCode(data: string, symbology: number, height: number, width: number, textposition: number): Promise<void>;
25
32
  printQRCode(data: string, modulesize: number, errorlevel: number): Promise<void>;
33
+ print2DCode(data: string, symbology: number, modulesize: number, errorlevel: number): Promise<void>;
26
34
  printColumnsText(texts: string[], widths: number[], aligns: number[]): Promise<void>;
27
35
  printColumnsString(texts: string[], widths: number[], aligns: number[]): Promise<void>;
28
36
  sendRAWData(data: number[]): Promise<void>;
29
37
  lineWrap(lines: number): Promise<void>;
30
38
  cutPaper(): Promise<void>;
31
39
  autoOutPaper(): Promise<void>;
40
+ getCutPaperTimes(): Promise<number>;
41
+ getPrinterBBMDistance(): Promise<number>;
32
42
  openDrawer(): Promise<void>;
43
+ getDrawerStatus(): Promise<number>;
44
+ getOpenDrawerTimes(): Promise<number>;
33
45
  labelLocate(): Promise<void>;
34
46
  labelOutput(): Promise<void>;
35
47
  sendLCDCommand(flag: number): Promise<void>;
48
+ sendLCDString(text: string): Promise<void>;
49
+ sendLCDDoubleString(topText: string, bottomText: string): Promise<void>;
36
50
  sendLCDFillString(text: string, size: number, fill: boolean): Promise<void>;
37
51
  sendLCDMultiString(texts: string[], align: number[]): Promise<void>;
38
52
  sendLCDBitmap(base64: string): Promise<void>;
39
53
  enterPrinterBuffer(clean: boolean): Promise<void>;
40
54
  exitPrinterBuffer(commit: boolean): Promise<void>;
41
55
  commitPrinterBuffer(): Promise<void>;
56
+ exitPrinterBufferWithCallback(commit: boolean): Promise<void>;
57
+ commitPrinterBufferWithCallback(): Promise<void>;
42
58
  }
43
59
  declare const _default: Spec;
44
60
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeSunmiPrinter.d.ts","sourceRoot":"","sources":["../../../src/NativeSunmiPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,iBAAiB,IAA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,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG7C,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;;AAED,wBAAsE"}
@@ -14,6 +14,13 @@ export declare function setAlignment(alignment: number): Promise<void>;
14
14
  export declare function setFontName(typeface: string): Promise<void>;
15
15
  export declare function setFontSize(fontsize: number): Promise<void>;
16
16
  export declare function setPrinterStyle(key: number, value: number): Promise<void>;
17
+ export declare function getForcedDouble(): Promise<number>;
18
+ export declare function isForcedBold(): Promise<boolean>;
19
+ export declare function isForcedUnderline(): Promise<boolean>;
20
+ export declare function isForcedAntiWhite(): Promise<boolean>;
21
+ export declare function getPrinterDensity(): Promise<number>;
22
+ export declare function getForcedRowHeight(): Promise<number>;
23
+ export declare function getCurrentFontName(): Promise<string>;
17
24
  export declare function printText(text: string): Promise<void>;
18
25
  export declare function printTextWithFont(text: string, typeface: string, fontsize: number): Promise<void>;
19
26
  export declare function printOriginalText(text: string): Promise<void>;
@@ -21,20 +28,29 @@ export declare function printImage(base64: string): Promise<void>;
21
28
  export declare function printBitmapCustom(base64: string, type: number): Promise<void>;
22
29
  export declare function printBarCode(data: string, symbology: number, height: number, width: number, textposition: number): Promise<void>;
23
30
  export declare function printQRCode(data: string, modulesize: number, errorlevel: number): Promise<void>;
31
+ export declare function print2DCode(data: string, symbology: number, modulesize: number, errorlevel: number): Promise<void>;
24
32
  export declare function printColumnsText(texts: string[], widths: number[], aligns: number[]): Promise<void>;
25
33
  export declare function printColumnsString(texts: string[], widths: number[], aligns: number[]): Promise<void>;
26
34
  export declare function sendRAWData(data: number[]): Promise<void>;
27
35
  export declare function lineWrap(lines: number): Promise<void>;
28
36
  export declare function cutPaper(): Promise<void>;
37
+ export declare function getCutPaperTimes(): Promise<number>;
38
+ export declare function getPrinterBBMDistance(): Promise<number>;
29
39
  export declare function autoOutPaper(): Promise<void>;
30
40
  export declare function openDrawer(): Promise<void>;
41
+ export declare function getDrawerStatus(): Promise<number>;
42
+ export declare function getOpenDrawerTimes(): Promise<number>;
31
43
  export declare function labelLocate(): Promise<void>;
32
44
  export declare function labelOutput(): Promise<void>;
33
45
  export declare function sendLCDCommand(flag: number): Promise<void>;
46
+ export declare function sendLCDString(text: string): Promise<void>;
47
+ export declare function sendLCDDoubleString(topText: string, bottomText: string): Promise<void>;
34
48
  export declare function sendLCDFillString(text: string, size: number, fill: boolean): Promise<void>;
35
49
  export declare function sendLCDMultiString(texts: string[], align: number[]): Promise<void>;
36
50
  export declare function sendLCDBitmap(base64: string): Promise<void>;
37
51
  export declare function enterPrinterBuffer(clean: boolean): Promise<void>;
38
52
  export declare function exitPrinterBuffer(commit: boolean): Promise<void>;
39
53
  export declare function commitPrinterBuffer(): Promise<void>;
54
+ export declare function exitPrinterBufferWithCallback(commit: boolean): Promise<void>;
55
+ export declare function commitPrinterBufferWithCallback(): Prom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gB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEnD;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoangnh0099/react-native-sunmi-printer",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "The new sunmi printer library",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -23,6 +23,15 @@ export interface Spec extends TurboModule {
23
23
  setFontSize(fontsize: number): Promise<void>;
24
24
  setPrinterStyle(key: number, value: number): Promise<void>;
25
25
 
26
+ // Print Style Query
27
+ getForcedDouble(): Promise<number>;
28
+ isForcedBold(): Promise<boolean>;
29
+ isForcedUnderline(): Promise<boolean>;
30
+ isForcedAntiWhite(): Promise<boolean>;
31
+ getPrinterDensity(): Promise<number>;
32
+ getForcedRowHeight(): Promise<number>;
33
+ getCurrentFontName(): Promise<string>;
34
+
26
35
  // Text
27
36
  printText(text: string): Promise<void>;
28
37
  printTextWithFont(
@@ -49,6 +58,12 @@ export interface Spec extends TurboModule {
49
58
  modulesize: number,
50
59
  errorlevel: number
51
60
  ): Promise<void>;
61
+ print2DCode(
62
+ data: string,
63
+ symbology: number,
64
+ modulesize: number,
65
+ errorlevel: number
66
+ ): Promise<void>;
52
67
 
53
68
  // Table
54
69
  printColumnsText(
@@ -70,8 +85,14 @@ export interface Spec extends TurboModule {
70
85
  cutPaper(): Promise<void>;
71
86
  autoOutPaper(): Promise<void>;
72
87
 
88
+ // Paper Info
89
+ getCutPaperTimes(): Promise<number>;
90
+ getPrinterBBMDistance(): Promise<number>;
91
+
73
92
  // Cash Drawer
74
93
  openDrawer(): Promise<void>;
94
+ getDrawerStatus(): Promise<number>;
95
+ getOpenDrawerTimes(): Promise<number>;
75
96
 
76
97
  // Label
77
98
  labelLocate(): Promise<void>;
@@ -79,6 +100,8 @@ export interface Spec extends TurboModule {
79
100
 
80
101
  // LCD
81
102
  sendLCDCommand(flag: number): Promise<void>;
103
+ sendLCDString(text: string): Promise<void>;
104
+ sendLCDDoubleString(topText: string, bottomText: string): Promise<void>;
82
105
  sendLCDFillString(text: string, size: number, fill: boolean): Promise<void>;
83
106
  sendLCDMultiString(texts: string[], align: number[]): Promise<void>;
84
107
  sendLCDBitmap(base64: string): Promise<void>;
@@ -87,6 +110,8 @@ export interface Spec extends TurboModule {
87
110
  enterPrinterBuffer(clean: boolean): Promise<void>;
88
111
  exitPrinterBuffer(commit: boolean): Promise<void>;
89
112
  commitPrinterBuffer(): Promise<void>;
113
+ exitPrinterBufferWithCallback(commit: boolean): Promise<void>;
114
+ commitPrinterBufferWithCallback(): Promise<void>;
90
115
  }
91
116
 
92
117
  export default TurboModuleRegistry.getEnforcing<Spec>('SunmiPrinter');
package/src/index.tsx CHANGED
@@ -67,6 +67,35 @@ export function setPrinterStyle(key: number, value: number): Promise<void> {
67
67
  return SunmiPrinter.setPrinterStyle(key, value);
68
68
  }
69
69
 
70
+ // Print Style Query
71
+ export function getForcedDouble(): Promise<number> {
72
+ return SunmiPrinter.getForcedDouble();
73
+ }
74
+
75
+ export function isForcedBold(): Promise<boolean> {
76
+ return SunmiPrinter.isForcedBold();
77
+ }
78
+
79
+ export function isForcedUnderline(): Promise<boolean> {
80
+ return SunmiPrinter.isForcedUnderline();
81
+ }
82
+
83
+ export function isForcedAntiWhite(): Promise<boolean> {
84
+ return SunmiPrinter.isForcedAntiWhite();
85
+ }
86
+
87
+ export function getPrinterDensity(): Promise<number> {
88
+ return SunmiPrinter.getPrinterDensity();
89
+ }
90
+
91
+ export function getForcedRowHeight(): Promise<number> {
92
+ return SunmiPrinter.getForcedRowHeight();
93
+ }
94
+
95
+ export function getCurrentFontName(): Promise<string> {
96
+ return SunmiPrinter.getCurrentFontName();
97
+ }
98
+
70
99
  // Text
71
100
  export function printText(text: string): Promise<void> {
72
101
  return SunmiPrinter.printText(text);
@@ -118,6 +147,15 @@ export function printQRCode(
118
147
  return SunmiPrinter.printQRCode(data, modulesize, errorlevel);
119
148
  }
120
149
 
150
+ export function print2DCode(
151
+ data: string,
152
+ symbology: number,
153
+ modulesize: number,
154
+ errorlevel: number
155
+ ): Promise<void> {
156
+ return SunmiPrinter.print2DCode(data, symbology, modulesize, errorlevel);
157
+ }
158
+
121
159
  // Table
122
160
  export function printColumnsText(
123
161
  texts: string[],
@@ -149,6 +187,14 @@ export function cutPaper(): Promise<void> {
149
187
  return SunmiPrinter.cutPaper();
150
188
  }
151
189
 
190
+ export function getCutPaperTimes(): Promise<number> {
191
+ return SunmiPrinter.getCutPaperTimes();
192
+ }
193
+
194
+ export function getPrinterBBMDistance(): Promise<number> {
195
+ return SunmiPrinter.getPrinterBBMDistance();
196
+ }
197
+
152
198
  export function autoOutPaper(): Promise<void> {
153
199
  return SunmiPrinter.autoOutPaper();
154
200
  }
@@ -158,6 +204,14 @@ export function openDrawer(): Promise<void> {
158
204
  return SunmiPrinter.openDrawer();
159
205
  }
160
206
 
207
+ export function getDrawerStatus(): Promise<number> {
208
+ return SunmiPrinter.getDrawerStatus();
209
+ }
210
+
211
+ export function getOpenDrawerTimes(): Promise<number> {
212
+ return SunmiPrinter.getOpenDrawerTimes();
213
+ }
214
+
161
215
  // Label
162
216
  export function labelLocate(): Promise<void> {
163
217
  return SunmiPrinter.labelLocate();
@@ -172,6 +226,17 @@ export function sendLCDCommand(flag: number): Promise<void> {
172
226
  return SunmiPrinter.sendLCDCommand(flag);
173
227
  }
174
228
 
229
+ export function sendLCDString(text: string): Promise<void> {
230
+ return SunmiPrinter.sendLCDString(text);
231
+ }
232
+
233
+ export function sendLCDDoubleString(
234
+ topText: string,
235
+ bottomText: string
236
+ ): Promise<void> {
237
+ return SunmiPrinter.sendLCDDoubleString(topText, bottomText);
238
+ }
239
+
175
240
  export function sendLCDFillString(
176
241
  text: string,
177
242
  size: number,
@@ -203,3 +268,11 @@ export function exitPrinterBuffer(commit: boolean): Promise<void> {
203
268
  export function commitPrinterBuffer(): Promise<void> {
204
269
  return SunmiPrinter.commitPrinterBuffer();
205
270
  }
271
+
272
+ export function exitPrinterBufferWithCallback(commit: boolean): Promise<void> {
273
+ return SunmiPrinter.exitPrinterBufferWithCallback(commit);
274
+ }
275
+
276
+ export function commitPrinterBufferWithCallback(): Promise<void> {
277
+ return SunmiPrinter.commitPrinterBufferWithCallback();
278
+ }