@sincpro/printer-expo 1.0.3 → 1.0.4
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/android/build.gradle +2 -2
- package/android/libs/sincpro-printer-sdk.aar +0 -0
- package/android/src/main/java/sincpro/expo/printer/entrypoint/PrinterModule.kt +112 -1
- package/build/SincproPrinter.d.ts +25 -1
- package/build/SincproPrinter.d.ts.map +1 -1
- package/build/SincproPrinter.js +27 -0
- package/build/SincproPrinter.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/types/printer.types.d.ts +56 -4
- package/build/types/printer.types.d.ts.map +1 -1
- package/build/types/printer.types.js.map +1 -1
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
Binary file
|
|
@@ -4,10 +4,16 @@ import android.content.Context
|
|
|
4
4
|
import com.sincpro.printer.SincproPrinterSdk
|
|
5
5
|
import com.sincpro.printer.domain.Alignment
|
|
6
6
|
import com.sincpro.printer.domain.BarcodeType
|
|
7
|
+
import com.sincpro.printer.domain.CutterConfig
|
|
8
|
+
import com.sincpro.printer.domain.Density
|
|
7
9
|
import com.sincpro.printer.domain.FontSize
|
|
8
10
|
import com.sincpro.printer.domain.MediaConfig
|
|
11
|
+
import com.sincpro.printer.domain.MediaType
|
|
12
|
+
import com.sincpro.printer.domain.Orientation
|
|
13
|
+
import com.sincpro.printer.domain.PrinterConfig
|
|
9
14
|
import com.sincpro.printer.domain.Receipt
|
|
10
15
|
import com.sincpro.printer.domain.ReceiptLine
|
|
16
|
+
import com.sincpro.printer.domain.Speed
|
|
11
17
|
import expo.modules.kotlin.functions.Coroutine
|
|
12
18
|
import expo.modules.kotlin.modules.Module
|
|
13
19
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
@@ -124,6 +130,42 @@ class PrinterModule : Module() {
|
|
|
124
130
|
sdk.bixolon.connectivity.getDpi()
|
|
125
131
|
}
|
|
126
132
|
|
|
133
|
+
// ============================================================
|
|
134
|
+
// CONFIGURATION API
|
|
135
|
+
// ============================================================
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Set and apply printer configuration
|
|
139
|
+
* - Sets as default for future connections
|
|
140
|
+
* - If connected, applies immediately to printer
|
|
141
|
+
*/
|
|
142
|
+
AsyncFunction("setConfig") Coroutine { config: Map<String, Any?> ->
|
|
143
|
+
val printerConfig = parsePrinterConfig(config)
|
|
144
|
+
sdk.bixolon.connectivity.setDefaultConfig(printerConfig)
|
|
145
|
+
// Apply immediately if connected
|
|
146
|
+
if (sdk.bixolon.connectivity.isConnected()) {
|
|
147
|
+
sdk.bixolon.connectivity
|
|
148
|
+
.applyConfig(printerConfig)
|
|
149
|
+
.getOrThrow()
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
Function("getConfig") {
|
|
154
|
+
val config = sdk.bixolon.connectivity.getDefaultConfig()
|
|
155
|
+
mapOf(
|
|
156
|
+
"marginLeft" to config.marginLeft,
|
|
157
|
+
"marginTop" to config.marginTop,
|
|
158
|
+
"density" to config.density.name.lowercase(),
|
|
159
|
+
"speed" to config.speed.name.lowercase(),
|
|
160
|
+
"orientation" to config.orientation.name.lowercase(),
|
|
161
|
+
"autoCutter" to
|
|
162
|
+
mapOf(
|
|
163
|
+
"enabled" to config.autoCutter.enabled,
|
|
164
|
+
"fullCut" to config.autoCutter.fullCut,
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
127
169
|
// ============================================================
|
|
128
170
|
// PRINT API - Text
|
|
129
171
|
// ============================================================
|
|
@@ -270,15 +312,84 @@ class PrinterModule : Module() {
|
|
|
270
312
|
if (preset != null) {
|
|
271
313
|
return when (preset) {
|
|
272
314
|
"continuous58mm" -> MediaConfig.continuous58mm()
|
|
315
|
+
"continuous72mm" -> MediaConfig.continuous72mm()
|
|
273
316
|
"continuous80mm" -> MediaConfig.continuous80mm()
|
|
274
317
|
else -> MediaConfig.continuous80mm()
|
|
275
318
|
}
|
|
276
319
|
}
|
|
277
320
|
|
|
321
|
+
// Custom width in mm (converts to dots automatically)
|
|
322
|
+
val widthMm = (data["widthMm"] as? Number)?.toInt()
|
|
323
|
+
if (widthMm != null) {
|
|
324
|
+
val heightMm = (data["heightMm"] as? Number)?.toInt() ?: 0
|
|
325
|
+
val type = parseMediaType(data["type"] as? String)
|
|
326
|
+
val gapMm = (data["gapMm"] as? Number)?.toInt() ?: 0
|
|
327
|
+
|
|
328
|
+
return when (type) {
|
|
329
|
+
MediaType.CONTINUOUS -> MediaConfig.continuous(widthMm)
|
|
330
|
+
MediaType.GAP -> MediaConfig.label(widthMm, heightMm, gapMm)
|
|
331
|
+
MediaType.BLACK_MARK -> MediaConfig.blackMark(widthMm, heightMm, gapMm)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Direct dots configuration
|
|
278
336
|
val widthDots = (data["widthDots"] as? Number)?.toInt() ?: 640
|
|
279
337
|
val heightDots = (data["heightDots"] as? Number)?.toInt() ?: 0
|
|
338
|
+
val type = parseMediaType(data["type"] as? String)
|
|
339
|
+
val gapDots = (data["gapDots"] as? Number)?.toInt() ?: 0
|
|
340
|
+
|
|
341
|
+
return MediaConfig(widthDots, heightDots, type, gapDots)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
private fun parseMediaType(value: String?): MediaType =
|
|
345
|
+
when (value?.lowercase()) {
|
|
346
|
+
"continuous" -> MediaType.CONTINUOUS
|
|
347
|
+
"gap", "label" -> MediaType.GAP
|
|
348
|
+
"black_mark", "blackmark" -> MediaType.BLACK_MARK
|
|
349
|
+
else -> MediaType.CONTINUOUS
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
private fun parsePrinterConfig(data: Map<String, Any?>): PrinterConfig {
|
|
353
|
+
val marginLeft = (data["marginLeft"] as? Number)?.toInt() ?: 0
|
|
354
|
+
val marginTop = (data["marginTop"] as? Number)?.toInt() ?: 0
|
|
355
|
+
val density = parseDensity(data["density"] as? String)
|
|
356
|
+
val speed = parseSpeed(data["speed"] as? String)
|
|
357
|
+
val orientation = parseOrientation(data["orientation"] as? String)
|
|
358
|
+
val autoCutter = parseCutterConfig(data["autoCutter"] as? Map<String, Any?>)
|
|
359
|
+
|
|
360
|
+
return PrinterConfig(marginLeft, marginTop, density, speed, orientation, autoCutter)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
private fun parseDensity(value: String?): Density =
|
|
364
|
+
when (value?.lowercase()) {
|
|
365
|
+
"light" -> Density.LIGHT
|
|
366
|
+
"medium" -> Density.MEDIUM
|
|
367
|
+
"dark" -> Density.DARK
|
|
368
|
+
"extra_dark", "extradark" -> Density.EXTRA_DARK
|
|
369
|
+
else -> Density.MEDIUM
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
private fun parseSpeed(value: String?): Speed =
|
|
373
|
+
when (value?.lowercase()) {
|
|
374
|
+
"slow" -> Speed.SLOW
|
|
375
|
+
"medium" -> Speed.MEDIUM
|
|
376
|
+
"fast" -> Speed.FAST
|
|
377
|
+
"extra_fast", "extrafast" -> Speed.EXTRA_FAST
|
|
378
|
+
else -> Speed.MEDIUM
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
private fun parseOrientation(value: String?): Orientation =
|
|
382
|
+
when (value?.lowercase()) {
|
|
383
|
+
"top_to_bottom", "toptobottom" -> Orientation.TOP_TO_BOTTOM
|
|
384
|
+
"bottom_to_top", "bottomtotop" -> Orientation.BOTTOM_TO_TOP
|
|
385
|
+
else -> Orientation.TOP_TO_BOTTOM
|
|
386
|
+
}
|
|
280
387
|
|
|
281
|
-
|
|
388
|
+
private fun parseCutterConfig(data: Map<String, Any?>?): CutterConfig {
|
|
389
|
+
if (data == null) return CutterConfig.DISABLED
|
|
390
|
+
val enabled = data["enabled"] as? Boolean ?: false
|
|
391
|
+
val fullCut = data["fullCut"] as? Boolean ?: true
|
|
392
|
+
return CutterConfig(enabled, fullCut)
|
|
282
393
|
}
|
|
283
394
|
|
|
284
395
|
private fun parseReceipt(data: Map<String, Any?>): Receipt {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BluetoothDevice, PairedPrinter, PrinterStatus, PrinterInfo, PrintTextOptions, PrintTextsOptions, PrintQROptions, PrintBarcodeOptions, PrintImageOptions, PrintPdfOptions, PrintKeyValueOptions, PrintReceiptOptions, Receipt } from './types';
|
|
1
|
+
import type { BluetoothDevice, PairedPrinter, PrinterStatus, PrinterInfo, PrinterConfig, PrintTextOptions, PrintTextsOptions, PrintQROptions, PrintBarcodeOptions, PrintImageOptions, PrintPdfOptions, PrintKeyValueOptions, PrintReceiptOptions, Receipt } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Bluetooth API for device discovery
|
|
4
4
|
*/
|
|
@@ -54,6 +54,30 @@ export declare const connection: {
|
|
|
54
54
|
*/
|
|
55
55
|
getDpi: () => number;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Configuration API for printer settings
|
|
59
|
+
*/
|
|
60
|
+
export declare const config: {
|
|
61
|
+
/**
|
|
62
|
+
* Set printer configuration (margins, density, speed, cutter)
|
|
63
|
+
* This sets the default config and applies it immediately if connected
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* await config.set({
|
|
67
|
+
* marginLeft: 10,
|
|
68
|
+
* marginTop: 5,
|
|
69
|
+
* density: 'dark',
|
|
70
|
+
* speed: 'fast',
|
|
71
|
+
* autoCutter: { enabled: true, fullCut: true }
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
set: (printerConfig: PrinterConfig) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Get current printer configuration
|
|
78
|
+
*/
|
|
79
|
+
get: () => PrinterConfig;
|
|
80
|
+
};
|
|
57
81
|
/**
|
|
58
82
|
* Print API for all printing operations
|
|
59
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SincproPrinter.d.ts","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,OAAO,EACR,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SincproPrinter.d.ts","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,OAAO,EACR,MAAM,SAAS,CAAC;AAkDjB;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;4BACmB,eAAe,EAAE;IAEvC;;OAEG;6BACoB,aAAa,EAAE;CACvC,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;;;OAIG;gCACyB,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAGtE;;;;;OAKG;sBACe,MAAM,SAAS,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAG3E;;OAEG;sBACa,OAAO,CAAC,IAAI,CAAC;IAE7B;;OAEG;sBACa,OAAO,CAAC,IAAI,CAAC;IAE7B;;OAEG;uBACc,OAAO;IAExB;;OAEG;qBACY,OAAO,CAAC,aAAa,CAAC;IAErC;;OAEG;mBACU,OAAO,CAAC,WAAW,CAAC;IAEjC;;OAEG;kBACS,MAAM;CACnB,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;;;;;;;;;;;;OAaG;yBACkB,aAAa,KAAG,OAAO,CA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EG;qBACU,MAAM,YAAY,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;QAG/D;;WAEG;uBACY,MAAM,EAAE,YAAY,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGpE;;WAEG;mBACQ,MAAM,YAAY,cAAc,KAAG,OAAO,CAAC,IAAI,CAAC;QAG3D;;WAEG;wBACa,MAAM,YAAY,mBAAmB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGrE;;WAEG;kCACuB,MAAM,YAAY,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAAC;QAG7E;;WAEG;gCACqB,MAAM,YAAY,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;QAGzE;;WAEG;sCAC2B,MAAM,KAAG,MAAM;QAE7C;;WAEG;2BACgB,OAAO,YAAY,mBAAmB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGzE;;WAEG;wBACa,MAAM,SAAS,MAAM,YAAY,oBAAoB,KAAG,OAAO,CAAC,IAAI,CAAC;;CAetF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/build/SincproPrinter.js
CHANGED
|
@@ -62,6 +62,33 @@ export const connection = {
|
|
|
62
62
|
getDpi: () => NativeModule.getDpi(),
|
|
63
63
|
};
|
|
64
64
|
// ============================================================
|
|
65
|
+
// CONFIGURATION API
|
|
66
|
+
// ============================================================
|
|
67
|
+
/**
|
|
68
|
+
* Configuration API for printer settings
|
|
69
|
+
*/
|
|
70
|
+
export const config = {
|
|
71
|
+
/**
|
|
72
|
+
* Set printer configuration (margins, density, speed, cutter)
|
|
73
|
+
* This sets the default config and applies it immediately if connected
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* await config.set({
|
|
77
|
+
* marginLeft: 10,
|
|
78
|
+
* marginTop: 5,
|
|
79
|
+
* density: 'dark',
|
|
80
|
+
* speed: 'fast',
|
|
81
|
+
* autoCutter: { enabled: true, fullCut: true }
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
set: (printerConfig) => NativeModule.setConfig(printerConfig),
|
|
86
|
+
/**
|
|
87
|
+
* Get current printer configuration
|
|
88
|
+
*/
|
|
89
|
+
get: () => NativeModule.getConfig(),
|
|
90
|
+
};
|
|
91
|
+
// ============================================================
|
|
65
92
|
// PRINT API
|
|
66
93
|
// ============================================================
|
|
67
94
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SincproPrinter.js","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SincproPrinter.js","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA4DxD,MAAM,YAAY,GAAG,mBAAmB,CAA6B,gBAAgB,CAAC,CAAC;AAEvF,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,gBAAgB,EAAE,GAAsB,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE;IAE1E;;OAEG;IACH,iBAAiB,EAAE,GAAoB,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE;CAC3E,CAAC;AAEF,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,OAAe,EAAE,SAAkB,EAAiB,EAAE,CACvE,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC;IAEnD;;;;;OAKG;IACH,WAAW,EAAE,CAAC,EAAU,EAAE,IAAa,EAAE,SAAkB,EAAiB,EAAE,CAC5E,YAAY,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;IAE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O,EAAE,CAAC,IAAY,EAAE,OAA6B,EAAiB,EAAE,CACtE,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC;IAE1C;;OAEG;IACH,WAAW,EAAE,CAAC,UAAkB,EAAE,OAA2B,EAAiB,EAAE,CAC9E,YAAY,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC;IAEpD;;OAEG;IACH,SAAS,EAAE,CAAC,UAAkB,EAAE,OAAyB,EAAiB,EAAE,CAC1E,YAAY,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC;IAElD;;OAEG;IACH,eAAe,EAAE,CAAC,UAAkB,EAAU,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,UAAU,CAAC;IAEzF;;OAEG;IACH,OAAO,EAAE,CAAC,OAAgB,EAAE,OAA6B,EAAiB,EAAE,CAC1E,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,OAA8B,EAAiB,EAAE,CACtF,YAAY,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC;CAClD,CAAC;AAEF,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,SAAS;IACT,UAAU;IACV,KAAK;CACN,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport type {\n BluetoothDevice,\n PairedPrinter,\n PrinterStatus,\n PrinterInfo,\n PrinterConfig,\n PrintTextOptions,\n PrintTextsOptions,\n PrintQROptions,\n PrintBarcodeOptions,\n PrintImageOptions,\n PrintPdfOptions,\n PrintKeyValueOptions,\n PrintReceiptOptions,\n Receipt,\n} from './types';\n\n/**\n * Native module interface matching PrinterModule.kt\n */\ninterface SincproPrinterNativeModule {\n // Bluetooth\n getPairedDevices(): BluetoothDevice[];\n getPairedPrinters(): PairedPrinter[];\n\n // Connection\n connectBluetooth(address: string, timeoutMs?: number): Promise<void>;\n connectWifi(ip: string, port?: number, timeoutMs?: number): Promise<void>;\n connectUsb(): Promise<void>;\n disconnect(): Promise<void>;\n isConnected(): boolean;\n getStatus(): Promise<PrinterStatus>;\n getInfo(): Promise<PrinterInfo>;\n getDpi(): number;\n\n // Configuration\n setConfig(config: PrinterConfig): Promise<void>;\n getConfig(): PrinterConfig;\n\n // Print - Text\n printText(text: string, options?: PrintTextOptions): Promise<void>;\n printTexts(texts: string[], options?: PrintTextsOptions): Promise<void>;\n\n // Print - QR & Barcode\n printQR(data: string, options?: PrintQROptions): Promise<void>;\n printBarcode(data: string, options?: PrintBarcodeOptions): Promise<void>;\n\n // Print - Images & PDF\n printImageBase64(base64Data: string, options?: PrintImageOptions): Promise<void>;\n printPdfBase64(base64Data: string, options?: PrintPdfOptions): Promise<void>;\n getPdfPageCount(base64Data: string): number;\n\n // Print - Receipt\n printReceipt(receipt: Receipt, options?: PrintReceiptOptions): Promise<void>;\n\n // Print - Key-Value\n printKeyValue(key: string, value: string, options?: PrintKeyValueOptions): Promise<void>;\n}\n\nconst NativeModule = requireNativeModule<SincproPrinterNativeModule>('SincproPrinter');\n\n// ============================================================\n// BLUETOOTH API\n// ============================================================\n\n/**\n * Bluetooth API for device discovery\n */\nexport const bluetooth = {\n /**\n * Get all paired/bonded Bluetooth devices\n */\n getPairedDevices: (): BluetoothDevice[] => NativeModule.getPairedDevices(),\n\n /**\n * Get paired devices that are printers\n */\n getPairedPrinters: (): PairedPrinter[] => NativeModule.getPairedPrinters(),\n};\n\n// ============================================================\n// CONNECTION API\n// ============================================================\n\n/**\n * Connection API for printer connectivity\n */\nexport const connection = {\n /**\n * Connect to printer via Bluetooth\n * @param address MAC address (e.g., \"00:11:22:33:44:55\")\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectBluetooth: (address: string, timeoutMs?: number): Promise<void> =>\n NativeModule.connectBluetooth(address, timeoutMs),\n\n /**\n * Connect to printer via WiFi\n * @param ip IP address (e.g., \"192.168.1.100\")\n * @param port TCP port (default: 9100)\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectWifi: (ip: string, port?: number, timeoutMs?: number): Promise<void> =>\n NativeModule.connectWifi(ip, port, timeoutMs),\n\n /**\n * Connect to printer via USB\n */\n connectUsb: (): Promise<void> => NativeModule.connectUsb(),\n\n /**\n * Disconnect from current printer\n */\n disconnect: (): Promise<void> => NativeModule.disconnect(),\n\n /**\n * Check if currently connected\n */\n isConnected: (): boolean => NativeModule.isConnected(),\n\n /**\n * Get printer status (paper, cover, errors)\n */\n getStatus: (): Promise<PrinterStatus> => NativeModule.getStatus(),\n\n /**\n * Get printer info (model, firmware, serial)\n */\n getInfo: (): Promise<PrinterInfo> => NativeModule.getInfo(),\n\n /**\n * Get printer DPI\n */\n getDpi: (): number => NativeModule.getDpi(),\n};\n\n// ============================================================\n// CONFIGURATION API\n// ============================================================\n\n/**\n * Configuration API for printer settings\n */\nexport const config = {\n /**\n * Set printer configuration (margins, density, speed, cutter)\n * This sets the default config and applies it immediately if connected\n * @example\n * ```ts\n * await config.set({\n * marginLeft: 10,\n * marginTop: 5,\n * density: 'dark',\n * speed: 'fast',\n * autoCutter: { enabled: true, fullCut: true }\n * });\n * ```\n */\n set: (printerConfig: PrinterConfig): Promise<void> => NativeModule.setConfig(printerConfig),\n\n /**\n * Get current printer configuration\n */\n get: (): PrinterConfig => NativeModule.getConfig(),\n};\n\n// ============================================================\n// PRINT API\n// ============================================================\n\n/**\n * Print API for all printing operations\n */\nexport const print = {\n /**\n * Print a single line of text\n */\n text: (text: string, options?: PrintTextOptions): Promise<void> =>\n NativeModule.printText(text, options),\n\n /**\n * Print multiple lines of text\n */\n texts: (texts: string[], options?: PrintTextsOptions): Promise<void> =>\n NativeModule.printTexts(texts, options),\n\n /**\n * Print a QR code\n */\n qr: (data: string, options?: PrintQROptions): Promise<void> =>\n NativeModule.printQR(data, options),\n\n /**\n * Print a barcode\n */\n barcode: (data: string, options?: PrintBarcodeOptions): Promise<void> =>\n NativeModule.printBarcode(data, options),\n\n /**\n * Print an image from base64\n */\n imageBase64: (base64Data: string, options?: PrintImageOptions): Promise<void> =>\n NativeModule.printImageBase64(base64Data, options),\n\n /**\n * Print a PDF page from base64\n */\n pdfBase64: (base64Data: string, options?: PrintPdfOptions): Promise<void> =>\n NativeModule.printPdfBase64(base64Data, options),\n\n /**\n * Get page count from a PDF (base64)\n */\n getPdfPageCount: (base64Data: string): number => NativeModule.getPdfPageCount(base64Data),\n\n /**\n * Print a complete receipt with header, body, footer\n */\n receipt: (receipt: Receipt, options?: PrintReceiptOptions): Promise<void> =>\n NativeModule.printReceipt(receipt, options),\n\n /**\n * Print a key-value pair (two columns)\n */\n keyValue: (key: string, value: string, options?: PrintKeyValueOptions): Promise<void> =>\n NativeModule.printKeyValue(key, value, options),\n};\n\n// ============================================================\n// DEFAULT EXPORT\n// ============================================================\n\n/**\n * Sincpro Printer SDK for Expo\n */\nconst SincproPrinter = {\n bluetooth,\n connection,\n print,\n};\n\nexport default SincproPrinter;\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
export { default } from './SincproPrinter';
|
|
10
|
-
export { bluetooth, connection, print } from './SincproPrinter';
|
|
10
|
+
export { bluetooth, connection, config, print } from './SincproPrinter';
|
|
11
11
|
export * from './types';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGxE,cAAc,SAAS,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
// Main module export
|
|
10
10
|
export { default } from './SincproPrinter';
|
|
11
|
-
export { bluetooth, connection, print } from './SincproPrinter';
|
|
11
|
+
export { bluetooth, connection, config, print } from './SincproPrinter';
|
|
12
12
|
// Type exports
|
|
13
13
|
export * from './types';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAExE,eAAe;AACf,cAAc,SAAS,CAAC","sourcesContent":["/**\n * @sincpro/printer-expo\n *\n * Expo module for Bluetooth/WiFi/USB thermal printers.\n * Supports Bixolon label printers.\n *\n * @packageDocumentation\n */\n\n// Main module export\nexport { default } from './SincproPrinter';\nexport { bluetooth, connection, config, print } from './SincproPrinter';\n\n// Type exports\nexport * from './types';\n"]}
|
|
@@ -29,17 +29,69 @@ export interface PrinterInfo {
|
|
|
29
29
|
* Media configuration
|
|
30
30
|
*/
|
|
31
31
|
export interface MediaConfig {
|
|
32
|
-
/** Use preset instead of manual
|
|
32
|
+
/** Use preset instead of manual configuration */
|
|
33
33
|
preset?: MediaPreset;
|
|
34
|
-
/**
|
|
34
|
+
/** Custom width in millimeters (auto-converts to dots) */
|
|
35
|
+
widthMm?: number;
|
|
36
|
+
/** Custom height in millimeters (for labels) */
|
|
37
|
+
heightMm?: number;
|
|
38
|
+
/** Gap/mark size in millimeters */
|
|
39
|
+
gapMm?: number;
|
|
40
|
+
/** Width in dots (use widthMm for easier configuration) */
|
|
35
41
|
widthDots?: number;
|
|
36
|
-
/** Height in dots (
|
|
42
|
+
/** Height in dots (use heightMm for easier configuration) */
|
|
37
43
|
heightDots?: number;
|
|
44
|
+
/** Gap in dots */
|
|
45
|
+
gapDots?: number;
|
|
46
|
+
/** Media type */
|
|
47
|
+
type?: MediaType;
|
|
38
48
|
}
|
|
39
49
|
/**
|
|
40
50
|
* Media presets
|
|
41
51
|
*/
|
|
42
|
-
export type MediaPreset = 'continuous58mm' | 'continuous80mm';
|
|
52
|
+
export type MediaPreset = 'continuous58mm' | 'continuous72mm' | 'continuous80mm';
|
|
53
|
+
/**
|
|
54
|
+
* Media type for labels and continuous paper
|
|
55
|
+
*/
|
|
56
|
+
export type MediaType = 'continuous' | 'gap' | 'label' | 'black_mark';
|
|
57
|
+
/**
|
|
58
|
+
* Printer configuration (global settings)
|
|
59
|
+
*/
|
|
60
|
+
export interface PrinterConfig {
|
|
61
|
+
/** Left margin in dots */
|
|
62
|
+
marginLeft?: number;
|
|
63
|
+
/** Top margin in dots */
|
|
64
|
+
marginTop?: number;
|
|
65
|
+
/** Print density */
|
|
66
|
+
density?: PrintDensity;
|
|
67
|
+
/** Print speed */
|
|
68
|
+
speed?: PrintSpeed;
|
|
69
|
+
/** Print orientation */
|
|
70
|
+
orientation?: PrintOrientation;
|
|
71
|
+
/** Auto cutter configuration */
|
|
72
|
+
autoCutter?: CutterConfig;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Print density levels
|
|
76
|
+
*/
|
|
77
|
+
export type PrintDensity = 'light' | 'medium' | 'dark' | 'extra_dark';
|
|
78
|
+
/**
|
|
79
|
+
* Print speed levels
|
|
80
|
+
*/
|
|
81
|
+
export type PrintSpeed = 'slow' | 'medium' | 'fast' | 'extra_fast';
|
|
82
|
+
/**
|
|
83
|
+
* Print orientation
|
|
84
|
+
*/
|
|
85
|
+
export type PrintOrientation = 'top_to_bottom' | 'bottom_to_top';
|
|
86
|
+
/**
|
|
87
|
+
* Auto cutter configuration
|
|
88
|
+
*/
|
|
89
|
+
export interface CutterConfig {
|
|
90
|
+
/** Enable auto cutter */
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
/** Full cut (true) or partial cut (false) */
|
|
93
|
+
fullCut?: boolean;
|
|
94
|
+
}
|
|
43
95
|
/**
|
|
44
96
|
* Font size options
|
|
45
97
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.types.d.ts","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;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B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printer.types.js","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Printer types for @sincpro/printer-expo\n */\n\n/**\n * Printer status from getStatus()\n */\nexport interface PrinterStatus {\n connectionState: ConnectionState;\n hasPaper: boolean;\n isCoverOpen: boolean;\n isOverheated: boolean;\n hasError: boolean;\n errorMessage: string | null;\n}\n\n/**\n * Connection state\n */\nexport type ConnectionState = 'DISCONNECTED' | 'CONNECTING' | 'CONNECTED' | 'ERROR';\n\n/**\n * Printer info from getInfo()\n */\nexport interface PrinterInfo {\n model: string;\n firmware: string;\n serial: string;\n dpi: number;\n}\n\n/**\n * Media configuration\n */\nexport interface MediaConfig {\n /** Use preset instead of manual
|
|
1
|
+
{"version":3,"file":"printer.types.js","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Printer types for @sincpro/printer-expo\n */\n\n/**\n * Printer status from getStatus()\n */\nexport interface PrinterStatus {\n connectionState: ConnectionState;\n hasPaper: boolean;\n isCoverOpen: boolean;\n isOverheated: boolean;\n hasError: boolean;\n errorMessage: string | null;\n}\n\n/**\n * Connection state\n */\nexport type ConnectionState = 'DISCONNECTED' | 'CONNECTING' | 'CONNECTED' | 'ERROR';\n\n/**\n * Printer info from getInfo()\n */\nexport interface PrinterInfo {\n model: string;\n firmware: string;\n serial: string;\n dpi: number;\n}\n\n/**\n * Media configuration\n */\nexport interface MediaConfig {\n /** Use preset instead of manual configuration */\n preset?: MediaPreset;\n \n /** Custom width in millimeters (auto-converts to dots) */\n widthMm?: number;\n /** Custom height in millimeters (for labels) */\n heightMm?: number;\n /** Gap/mark size in millimeters */\n gapMm?: number;\n \n /** Width in dots (use widthMm for easier configuration) */\n widthDots?: number;\n /** Height in dots (use heightMm for easier configuration) */\n heightDots?: number;\n /** Gap in dots */\n gapDots?: number;\n \n /** Media type */\n type?: MediaType;\n}\n\n/**\n * Media presets\n */\nexport type MediaPreset = 'continuous58mm' | 'continuous72mm' | 'continuous80mm';\n\n/**\n * Media type for labels and continuous paper\n */\nexport type MediaType = 'continuous' | 'gap' | 'label' | 'black_mark';\n\n/**\n * Printer configuration (global settings)\n */\nexport interface PrinterConfig {\n /** Left margin in dots */\n marginLeft?: number;\n /** Top margin in dots */\n marginTop?: number;\n /** Print density */\n density?: PrintDensity;\n /** Print speed */\n speed?: PrintSpeed;\n /** Print orientation */\n orientation?: PrintOrientation;\n /** Auto cutter configuration */\n autoCutter?: CutterConfig;\n}\n\n/**\n * Print density levels\n */\nexport type PrintDensity = 'light' | 'medium' | 'dark' | 'extra_dark';\n\n/**\n * Print speed levels\n */\nexport type PrintSpeed = 'slow' | 'medium' | 'fast' | 'extra_fast';\n\n/**\n * Print orientation\n */\nexport type PrintOrientation = 'top_to_bottom' | 'bottom_to_top';\n\n/**\n * Auto cutter configuration\n */\nexport interface CutterConfig {\n /** Enable auto cutter */\n enabled: boolean;\n /** Full cut (true) or partial cut (false) */\n fullCut?: boolean;\n}\n\n/**\n * Font size options\n */\nexport type FontSize = 'small' | 'medium' | 'large' | 'xlarge';\n\n/**\n * Alignment options\n */\nexport type Alignment = 'left' | 'center' | 'right';\n\n/**\n * Barcode types\n */\nexport type BarcodeType =\n | 'CODE128'\n | 'CODE39'\n | 'EAN13'\n | 'EAN8'\n | 'UPCA'\n | 'UPCE'\n | 'CODE93'\n | 'CODABAR';\n\n/**\n * Print text options\n */\nexport interface PrintTextOptions {\n fontSize?: FontSize;\n alignment?: Alignment;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print texts options (multiple lines)\n */\nexport interface PrintTextsOptions {\n fontSize?: FontSize;\n media?: MediaConfig;\n}\n\n/**\n * Print QR options\n */\nexport interface PrintQROptions {\n size?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print barcode options\n */\nexport interface PrintBarcodeOptions {\n type?: BarcodeType;\n height?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print image options\n */\nexport interface PrintImageOptions {\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print PDF options\n */\nexport interface PrintPdfOptions {\n page?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print key-value options\n */\nexport interface PrintKeyValueOptions {\n fontSize?: FontSize;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print receipt options\n */\nexport interface PrintReceiptOptions {\n media?: MediaConfig;\n copies?: number;\n}\n"]}
|
package/package.json
CHANGED