raxon-barcode-scanner 0.1.6 → 0.1.8
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 +11 -5
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/java/expo/modules/raxonbarcodescanner/RaxonBarcodeScannerModule.kt +61 -1
- package/build/RaxonBarcodeScanner.types.d.ts +6 -0
- package/build/RaxonBarcodeScanner.types.d.ts.map +1 -1
- package/build/RaxonBarcodeScanner.types.js.map +1 -1
- package/build/useBarcodeScanner.d.ts.map +1 -1
- package/build/useBarcodeScanner.js +1 -0
- package/build/useBarcodeScanner.js.map +1 -1
- package/package.json +3 -2
- package/src/RaxonBarcodeScanner.types.ts +6 -0
- package/src/useBarcodeScanner.ts +1 -0
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# raxon-barcode-scanner
|
|
2
2
|
|
|
3
|
-
Zebra ve benzeri kurumsal Android cihazlarda fiziksel barkod okuyucudan gelen veriyi React Native / Expo uygulamanıza aktaran hook tabanlı paket.
|
|
3
|
+
Zebra, Honeywell ve benzeri kurumsal Android cihazlarda fiziksel barkod okuyucudan gelen veriyi React Native / Expo uygulamanıza aktaran hook tabanlı paket.
|
|
4
4
|
|
|
5
5
|
## Özellikler
|
|
6
6
|
|
|
7
7
|
- `useBarcodeScanner` hook ile basit entegrasyon
|
|
8
8
|
- Zebra DataWedge profilini otomatik oluşturma / güncelleme
|
|
9
|
+
- Honeywell Data Collection Intent API ile tarayıcı claim / release
|
|
9
10
|
- Klavye gibi davranan (HID / keyboard-wedge) okuyucu desteği: tuş vuruşları tamponlanır, Enter/Tab ile tek barkod olarak yayınlanır ve UI'a sızmaz
|
|
10
11
|
- Android 13+ broadcast receiver uyumluluğu
|
|
11
12
|
- Expo Modules API ile autolinking
|
|
@@ -58,19 +59,23 @@ useBarcodeScanner(enabled, onReadBarcode, {
|
|
|
58
59
|
intentAction: 'com.myapp.barcode.ACTION',
|
|
59
60
|
profileName: 'MyAppScanner',
|
|
60
61
|
configureDataWedge: true,
|
|
62
|
+
configureHoneywell: true,
|
|
61
63
|
captureKeyboard: true,
|
|
62
64
|
});
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
| Seçenek | Varsayılan | Açıklama |
|
|
66
68
|
| --- | --- | --- |
|
|
67
|
-
| `intentAction` | `com.raxon.barcode.ACTION` |
|
|
68
|
-
| `profileName` | `RaxonBarcodeScanner` | DataWedge profil adı |
|
|
69
|
-
| `configureDataWedge` | `true` |
|
|
69
|
+
| `intentAction` | `com.raxon.barcode.ACTION` | Barkod broadcast action (DataWedge / Honeywell) |
|
|
70
|
+
| `profileName` | `RaxonBarcodeScanner` | DataWedge profil adı veya Honeywell profil adı |
|
|
71
|
+
| `configureDataWedge` | `true` | Zebra cihazlarda profili otomatik yapılandır |
|
|
72
|
+
| `configureHoneywell` | `true` | Honeywell cihazlarda tarayıcıyı otomatik claim et |
|
|
70
73
|
| `captureKeyboard` | `true` | Klavye modundaki (HID) okuyucuları yakala |
|
|
71
74
|
|
|
72
75
|
`configureDataWedge: false` kullanın eğer DataWedge profilini MDM veya manuel olarak yönetiyorsanız. Bu durumda `intentAction` değerinin profildeki Intent Output action ile eşleşmesi gerekir.
|
|
73
76
|
|
|
77
|
+
`configureHoneywell: false` kullanın eğer Honeywell tarayıcı ayarlarını cihaz üzerinden veya MDM ile yönetiyorsanız. Bu durumda `intentAction` değerinin Data Intent action ile eşleşmesi gerekir.
|
|
78
|
+
|
|
74
79
|
## Test projesi
|
|
75
80
|
|
|
76
81
|
Depodaki `example` uygulaması modülü test etmek içindir.
|
|
@@ -90,7 +95,8 @@ npm run open:android
|
|
|
90
95
|
## Desteklenen cihazlar
|
|
91
96
|
|
|
92
97
|
- Zebra TC serisi ve DataWedge yüklü cihazlar
|
|
93
|
-
-
|
|
98
|
+
- Honeywell CT/CK/EDA serisi ve Data Collection servisi yüklü cihazlar
|
|
99
|
+
- DataWedge veya Intent Output ile broadcast gönderen diğer kurumsal Android cihazlar
|
|
94
100
|
- Klavye (HID / keyboard-wedge) modunda çalışan okuyucular ve el terminalleri
|
|
95
101
|
|
|
96
102
|
## npm yayını
|
|
@@ -5,6 +5,7 @@ import android.content.BroadcastReceiver
|
|
|
5
5
|
import android.content.Context
|
|
6
6
|
import android.content.Intent
|
|
7
7
|
import android.content.IntentFilter
|
|
8
|
+
import android.content.pm.PackageManager
|
|
8
9
|
import android.os.Build
|
|
9
10
|
import android.os.Bundle
|
|
10
11
|
import android.os.SystemClock
|
|
@@ -22,9 +23,17 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
22
23
|
private const val DATAWEDGE_PACKAGE = "com.symbol.datawedge"
|
|
23
24
|
private const val SET_CONFIG_EXTRA = "com.symbol.datawedge.api.SET_CONFIG"
|
|
24
25
|
|
|
26
|
+
private const val HONEYWELL_DATA_COLLECTION_PACKAGE = "com.intermec.datacollectionservice"
|
|
27
|
+
private const val HONEYWELL_ACTION_CLAIM_SCANNER = "com.honeywell.aidc.action.ACTION_CLAIM_SCANNER"
|
|
28
|
+
private const val HONEYWELL_ACTION_RELEASE_SCANNER = "com.honeywell.aidc.action.ACTION_RELEASE_SCANNER"
|
|
29
|
+
private const val HONEYWELL_EXTRA_SCANNER = "com.honeywell.aidc.extra.EXTRA_SCANNER"
|
|
30
|
+
private const val HONEYWELL_EXTRA_PROFILE = "com.honeywell.aidc.extra.EXTRA_PROFILE"
|
|
31
|
+
private const val HONEYWELL_EXTRA_PROPERTIES = "com.honeywell.aidc.extra.EXTRA_PROPERTIES"
|
|
32
|
+
|
|
25
33
|
private val BARCODE_DATA_KEYS = listOf(
|
|
26
34
|
"com.symbol.datawedge.data_string",
|
|
27
35
|
"com.motorolasolutions.emdk.datawedge.data_string",
|
|
36
|
+
"com.wavelink.extra.data_string",
|
|
28
37
|
"data",
|
|
29
38
|
"barcode_string",
|
|
30
39
|
"SCAN_BARCODE1",
|
|
@@ -34,7 +43,9 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
34
43
|
private val SYMBOLOGY_KEYS = listOf(
|
|
35
44
|
"com.symbol.datawedge.label_type",
|
|
36
45
|
"com.motorolasolutions.emdk.datawedge.label_type",
|
|
46
|
+
"com.wavelink.extra.codeid",
|
|
37
47
|
"label_type",
|
|
48
|
+
"codeId",
|
|
38
49
|
"aimId"
|
|
39
50
|
)
|
|
40
51
|
|
|
@@ -50,6 +61,7 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
50
61
|
|
|
51
62
|
private var broadcastReceiver: BroadcastReceiver? = null
|
|
52
63
|
private var isListening = false
|
|
64
|
+
private var honeywellScannerClaimed = false
|
|
53
65
|
private var keyInterceptor: KeyInterceptorCallback? = null
|
|
54
66
|
private val wedgeBuffer = StringBuilder()
|
|
55
67
|
private var lastWedgeKeyTime = 0L
|
|
@@ -86,12 +98,17 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
86
98
|
val profileName = (options?.get("profileName") as? String)?.takeIf { it.isNotBlank() }
|
|
87
99
|
?: DEFAULT_PROFILE_NAME
|
|
88
100
|
val configureDataWedge = options?.get("configureDataWedge") as? Boolean ?: true
|
|
101
|
+
val configureHoneywell = options?.get("configureHoneywell") as? Boolean ?: true
|
|
89
102
|
val captureKeyboard = options?.get("captureKeyboard") as? Boolean ?: true
|
|
90
103
|
|
|
91
|
-
if (configureDataWedge) {
|
|
104
|
+
if (configureDataWedge && isZebraDevice()) {
|
|
92
105
|
configureDataWedgeProfile(profileName, intentAction)
|
|
93
106
|
}
|
|
94
107
|
|
|
108
|
+
if (configureHoneywell && isHoneywellDevice()) {
|
|
109
|
+
claimHoneywellScanner(intentAction, profileName)
|
|
110
|
+
}
|
|
111
|
+
|
|
95
112
|
registerBarcodeReceiver(intentAction)
|
|
96
113
|
|
|
97
114
|
if (captureKeyboard) {
|
|
@@ -110,6 +127,7 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
110
127
|
}
|
|
111
128
|
}
|
|
112
129
|
broadcastReceiver = null
|
|
130
|
+
releaseHoneywellScanner()
|
|
113
131
|
uninstallKeyboardCapture()
|
|
114
132
|
isListening = false
|
|
115
133
|
}
|
|
@@ -327,4 +345,46 @@ class RaxonBarcodeScannerModule : Module() {
|
|
|
327
345
|
}
|
|
328
346
|
context.sendBroadcast(intent)
|
|
329
347
|
}
|
|
348
|
+
|
|
349
|
+
private fun isPackageInstalled(packageName: String): Boolean {
|
|
350
|
+
return try {
|
|
351
|
+
context.packageManager.getPackageInfo(packageName, 0)
|
|
352
|
+
true
|
|
353
|
+
} catch (_: PackageManager.NameNotFoundException) {
|
|
354
|
+
false
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
private fun isZebraDevice(): Boolean = isPackageInstalled(DATAWEDGE_PACKAGE)
|
|
359
|
+
|
|
360
|
+
private fun isHoneywellDevice(): Boolean = isPackageInstalled(HONEYWELL_DATA_COLLECTION_PACKAGE)
|
|
361
|
+
|
|
362
|
+
private fun claimHoneywellScanner(intentAction: String, profileName: String) {
|
|
363
|
+
val properties = Bundle().apply {
|
|
364
|
+
putBoolean("DPR_DATA_INTENT", true)
|
|
365
|
+
putString("DPR_DATA_INTENT_ACTION", intentAction)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
val intent = Intent(HONEYWELL_ACTION_CLAIM_SCANNER).apply {
|
|
369
|
+
setPackage(HONEYWELL_DATA_COLLECTION_PACKAGE)
|
|
370
|
+
putExtra(HONEYWELL_EXTRA_SCANNER, "dcs.scanner.imager")
|
|
371
|
+
putExtra(HONEYWELL_EXTRA_PROFILE, profileName)
|
|
372
|
+
putExtra(HONEYWELL_EXTRA_PROPERTIES, properties)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
context.sendBroadcast(intent)
|
|
376
|
+
honeywellScannerClaimed = true
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
private fun releaseHoneywellScanner() {
|
|
380
|
+
if (!honeywellScannerClaimed) {
|
|
381
|
+
return
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
val intent = Intent(HONEYWELL_ACTION_RELEASE_SCANNER).apply {
|
|
385
|
+
setPackage(HONEYWELL_DATA_COLLECTION_PACKAGE)
|
|
386
|
+
}
|
|
387
|
+
context.sendBroadcast(intent)
|
|
388
|
+
honeywellScannerClaimed = false
|
|
389
|
+
}
|
|
330
390
|
}
|
|
@@ -19,6 +19,12 @@ export type BarcodeScannerOptions = {
|
|
|
19
19
|
* @default true
|
|
20
20
|
*/
|
|
21
21
|
configureDataWedge?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Automatically claim the internal scanner on Honeywell devices via Intent API.
|
|
24
|
+
* Set to false if you manage Honeywell scanner settings manually.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
configureHoneywell?: boolean;
|
|
22
28
|
/**
|
|
23
29
|
* Capture input from scanners that act as a keyboard (HID / keyboard-wedge).
|
|
24
30
|
* Keystrokes are buffered and emitted as a single scan when Enter/Tab is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RaxonBarcodeScanner.types.d.ts","sourceRoot":"","sources":["../src/RaxonBarcodeScanner.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"RaxonBarcodeScanner.types.d.ts","sourceRoot":"","sources":["../src/RaxonBarcodeScanner.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gBAAgB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RaxonBarcodeScanner.types.js","sourceRoot":"","sources":["../src/RaxonBarcodeScanner.types.ts"],"names":[],"mappings":"","sourcesContent":["export type BarcodeScanPayload = {\n code: string;\n symbology?: string;\n};\n\nexport type BarcodeScannerOptions = {\n /**\n * DataWedge intent action used for barcode broadcasts.\n * @default \"com.raxon.barcode.ACTION\"\n */\n intentAction?: string;\n /**\n * DataWedge profile name created or updated for this app.\n * @default \"RaxonBarcodeScanner\"\n */\n profileName?: string;\n /**\n * Automatically configure a DataWedge profile on Zebra devices.\n * Set to false if you manage DataWedge profiles manually.\n * @default true\n */\n configureDataWedge?: boolean;\n /**\n * Capture input from scanners that act as a keyboard (HID / keyboard-wedge).\n * Keystrokes are buffered and emitted as a single scan when Enter/Tab is\n * received; the keys are swallowed so they don't interact with the UI.\n * @default true\n */\n captureKeyboard?: boolean;\n};\n\nexport type RaxonBarcodeScannerModuleEvents = {\n onBarcodeScanned: (params: BarcodeScanPayload) => void;\n};\n\nexport type UseBarcodeScannerResult = {\n isListening: boolean;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"RaxonBarcodeScanner.types.js","sourceRoot":"","sources":["../src/RaxonBarcodeScanner.types.ts"],"names":[],"mappings":"","sourcesContent":["export type BarcodeScanPayload = {\n code: string;\n symbology?: string;\n};\n\nexport type BarcodeScannerOptions = {\n /**\n * DataWedge intent action used for barcode broadcasts.\n * @default \"com.raxon.barcode.ACTION\"\n */\n intentAction?: string;\n /**\n * DataWedge profile name created or updated for this app.\n * @default \"RaxonBarcodeScanner\"\n */\n profileName?: string;\n /**\n * Automatically configure a DataWedge profile on Zebra devices.\n * Set to false if you manage DataWedge profiles manually.\n * @default true\n */\n configureDataWedge?: boolean;\n /**\n * Automatically claim the internal scanner on Honeywell devices via Intent API.\n * Set to false if you manage Honeywell scanner settings manually.\n * @default true\n */\n configureHoneywell?: boolean;\n /**\n * Capture input from scanners that act as a keyboard (HID / keyboard-wedge).\n * Keystrokes are buffered and emitted as a single scan when Enter/Tab is\n * received; the keys are swallowed so they don't interact with the UI.\n * @default true\n */\n captureKeyboard?: boolean;\n};\n\nexport type RaxonBarcodeScannerModuleEvents = {\n onBarcodeScanned: (params: BarcodeScanPayload) => void;\n};\n\nexport type UseBarcodeScannerResult = {\n isListening: boolean;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBarcodeScanner.d.ts","sourceRoot":"","sources":["../src/useBarcodeScanner.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,EACpD,OAAO,CAAC,EAAE,qBAAqB,GAC9B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"useBarcodeScanner.d.ts","sourceRoot":"","sources":["../src/useBarcodeScanner.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,EACpD,OAAO,CAAC,EAAE,qBAAqB,GAC9B,uBAAuB,CAoCzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBarcodeScanner.js","sourceRoot":"","sources":["../src/useBarcodeScanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAE9D,MAAM,UAAU,iBAAiB,CAC/B,OAAgB,EAChB,aAAoD,EACpD,OAA+B;IAE/B,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED,IAAI,YAAY,GAAkC,IAAI,CAAC;QAEvD,CAAC,KAAK,IAAI,EAAE;YACV,MAAM,mBAAmB,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAExD,YAAY,GAAG,mBAAmB,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC3E,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,YAAY,EAAE,MAAM,EAAE,CAAC;YACvB,mBAAmB,CAAC,aAAa,EAAE,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,OAAO;QACP,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport {\n BarcodeScanPayload,\n BarcodeScannerOptions,\n UseBarcodeScannerResult,\n} from './RaxonBarcodeScanner.types';\nimport RaxonBarcodeScanner from './RaxonBarcodeScannerModule';\n\nexport function useBarcodeScanner(\n enabled: boolean,\n onReadBarcode: (payload: BarcodeScanPayload) => void,\n options?: BarcodeScannerOptions\n): UseBarcodeScannerResult {\n const onReadBarcodeRef = useRef(onReadBarcode);\n\n useEffect(() => {\n onReadBarcodeRef.current = onReadBarcode;\n });\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n let subscription: { remove: () => void } | null = null;\n\n (async () => {\n await RaxonBarcodeScanner.startListening(options ?? {});\n\n subscription = RaxonBarcodeScanner.addListener('onBarcodeScanned', (event) => {\n onReadBarcodeRef.current(event);\n });\n })();\n\n return () => {\n subscription?.remove();\n RaxonBarcodeScanner.stopListening();\n };\n }, [\n enabled,\n options?.intentAction,\n options?.profileName,\n options?.configureDataWedge,\n options?.captureKeyboard,\n ]);\n\n return { isListening: enabled };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useBarcodeScanner.js","sourceRoot":"","sources":["../src/useBarcodeScanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAE9D,MAAM,UAAU,iBAAiB,CAC/B,OAAgB,EAChB,aAAoD,EACpD,OAA+B;IAE/B,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED,IAAI,YAAY,GAAkC,IAAI,CAAC;QAEvD,CAAC,KAAK,IAAI,EAAE;YACV,MAAM,mBAAmB,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAExD,YAAY,GAAG,mBAAmB,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC3E,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,YAAY,EAAE,MAAM,EAAE,CAAC;YACvB,mBAAmB,CAAC,aAAa,EAAE,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,OAAO;QACP,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport {\n BarcodeScanPayload,\n BarcodeScannerOptions,\n UseBarcodeScannerResult,\n} from './RaxonBarcodeScanner.types';\nimport RaxonBarcodeScanner from './RaxonBarcodeScannerModule';\n\nexport function useBarcodeScanner(\n enabled: boolean,\n onReadBarcode: (payload: BarcodeScanPayload) => void,\n options?: BarcodeScannerOptions\n): UseBarcodeScannerResult {\n const onReadBarcodeRef = useRef(onReadBarcode);\n\n useEffect(() => {\n onReadBarcodeRef.current = onReadBarcode;\n });\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n let subscription: { remove: () => void } | null = null;\n\n (async () => {\n await RaxonBarcodeScanner.startListening(options ?? {});\n\n subscription = RaxonBarcodeScanner.addListener('onBarcodeScanned', (event) => {\n onReadBarcodeRef.current(event);\n });\n })();\n\n return () => {\n subscription?.remove();\n RaxonBarcodeScanner.stopListening();\n };\n }, [\n enabled,\n options?.intentAction,\n options?.profileName,\n options?.configureDataWedge,\n options?.configureHoneywell,\n options?.captureKeyboard,\n ]);\n\n return { isListening: enabled };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raxon-barcode-scanner",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Zebra and enterprise barcode scanner hook for React Native Expo apps",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "Zebra, Honeywell and enterprise barcode scanner hook for React Native Expo apps",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"barcode",
|
|
21
21
|
"barcode-scanner",
|
|
22
22
|
"zebra",
|
|
23
|
+
"honeywell",
|
|
23
24
|
"datawedge",
|
|
24
25
|
"enterprise-scanner",
|
|
25
26
|
"raxon-barcode-scanner"
|
|
@@ -20,6 +20,12 @@ export type BarcodeScannerOptions = {
|
|
|
20
20
|
* @default true
|
|
21
21
|
*/
|
|
22
22
|
configureDataWedge?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Automatically claim the internal scanner on Honeywell devices via Intent API.
|
|
25
|
+
* Set to false if you manage Honeywell scanner settings manually.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
configureHoneywell?: boolean;
|
|
23
29
|
/**
|
|
24
30
|
* Capture input from scanners that act as a keyboard (HID / keyboard-wedge).
|
|
25
31
|
* Keystrokes are buffered and emitted as a single scan when Enter/Tab is
|