{"_id":"@ashish293/react-native-honeywell-scanner","_rev":"3-826ce2db6ec1409a5fca79151d00d263","name":"@ashish293/react-native-honeywell-scanner","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@ashish293/react-native-honeywell-scanner","version":"1.0.0","keywords":["react-native","honeywell","scanner","barcode"],"author":{"name":"Ashish"},"license":"MIT","_id":"@ashish293/react-native-honeywell-scanner@1.0.0","maintainers":[{"name":"ashish293","email":"ashish293.dev@gmail.com"}],"dist":{"shasum":"0191672974923e2b9ca7f66bb808ed3492403869","tarball":"https://registry.npmjs.org/@ashish293/react-native-honeywell-scanner/-/react-native-honeywell-scanner-1.0.0.tgz","fileCount":10,"integrity":"sha512-39IFHwfajZ0decxzALfmK6ixSPJCY1/YdTYMziSLgUslBPV4NEUDzL3LOiuwqDmJRrGBd66vm89zsAVLLvaQxg==","signatures":[{"sig":"MEYCIQCBZoaDEEREBs28eb4s0iym2m/V8XTyHNgGwl6uIl7DiAIhAOvUo1PSXChj9CL16DIteFCKC2kFpDf7Z4VYxpfxzoPS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149217},"main":"src/index","types":"src/index","gitHead":"42a65c9bef94488dde29db3886a5adcabd31185a","_npmUser":{"name":"ashish293","email":"ashish293.dev@gmail.com"},"_npmVersion":"11.16.0","description":"Honeywell barcode scanner integration for React Native","directories":{},"_nodeVersion":"24.18.0","codegenConfig":{"name":"NativeHoneywellScannerSpec","type":"modules","android":{"javaPackageName":"com.honeywellscanner"},"jsSrcsDir":"src"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"19.2.3","typescript":"^5.8.3","react-native":"0.85.3"},"peerDependencies":{"react":"*","react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-honeywell-scanner_1.0.0_1783313352889_0.19493168221753154","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ashish293/react-native-honeywell-scanner","version":"1.0.1","keywords":["react-native","honeywell","scanner","barcode"],"author":{"name":"Ashish"},"license":"MIT","_id":"@ashish293/react-native-honeywell-scanner@1.0.1","maintainers":[{"name":"ashish293","email":"ashish293.dev@gmail.com"}],"dist":{"shasum":"ea9c80c767e3808f56cd58c84f19febe23dfe1e6","tarball":"https://registry.npmjs.org/@ashish293/react-native-honeywell-scanner/-/react-native-honeywell-scanner-1.0.1.tgz","fileCount":10,"integrity":"sha512-nA9QgHN1IIOjG2uKEffAeiSRmBejK3wBAEK5dRXD2zpT3bKT77ghIuXQqnkfhWPilZQqJEuS0I9drQG/Bls5xQ==","signatures":[{"sig":"MEUCIF/CA+at0QnQBK9vAMOt9X33R1IvFUiBwfX+1AYT2HXFAiEA1FORHrzAJfwSsghFtXaWTArmqNONu33fH0NPr/QSjN0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149250},"main":"src/index","types":"src/index","gitHead":"4fe2a9cd76f5e31620e4bf6d1ef5e867387a5211","_npmUser":{"name":"ashish293","email":"ashish293.dev@gmail.com"},"_npmVersion":"11.16.0","description":"Honeywell barcode scanner integration for React Native","directories":{},"_nodeVersion":"24.18.0","codegenConfig":{"name":"NativeHoneywellScannerSpec","type":"modules","android":{"javaPackageName":"com.honeywellscanner"},"jsSrcsDir":"src"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"19.2.3","typescript":"^5.8.3","react-native":"0.85.3"},"peerDependencies":{"react":"*","react-native":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-native-honeywell-scanner_1.0.1_1783314232640_0.5423708144412458","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@ashish293/react-native-honeywell-scanner","version":"1.0.2","publishConfig":{"access":"public"},"description":"Honeywell barcode scanner integration for React Native","main":"src/index","types":"src/index","keywords":["react-native","honeywell","scanner","barcode"],"author":{"name":"Ashish"},"license":"MIT","peerDependencies":{"react":"*","react-native":"*"},"devDependencies":{"react":"19.2.3","react-native":"0.85.3","typescript":"^5.8.3"},"codegenConfig":{"name":"NativeHoneywellScannerSpec","type":"modules","jsSrcsDir":"src","android":{"javaPackageName":"com.honeywellscanner"}},"gitHead":"fbe42b29f4c72e7ada65923477bbdbd7ac636c14","_id":"@ashish293/react-native-honeywell-scanner@1.0.2","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-2sZszNdQ9x1GqdPPnpz0kbhOaBmwfJ/+Oj9cWXNyAJgnQZzTvwA38YxK8vt1mA5QoGDnS4pbFcxATAuZkbCQWw==","shasum":"190f045c6f84e6a2b65be8663be3e67fb0a40caa","tarball":"https://registry.npmjs.org/@ashish293/react-native-honeywell-scanner/-/react-native-honeywell-scanner-1.0.2.tgz","fileCount":10,"unpackedSize":149462,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDXlKyeLt7RTIn5FpqToXjtWgUzsDahFy9IgnTqyV3hawIgKE3WeF/Y3ZTZSsE2FrVyFmatU1H4W9700oDAQMUl/4s="}]},"_npmUser":{"name":"ashish293","email":"ashish293.dev@gmail.com"},"directories":{},"maintainers":[{"name":"ashish293","email":"ashish293.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-honeywell-scanner_1.0.2_1784105998643_0.5952851212030015"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T04:49:12.657Z","modified":"2026-07-15T08:59:58.887Z","1.0.0":"2026-07-06T04:49:13.031Z","1.0.1":"2026-07-06T05:03:52.784Z","1.0.2":"2026-07-15T08:59:58.778Z"},"author":{"name":"Ashish"},"license":"MIT","keywords":["react-native","honeywell","scanner","barcode"],"description":"Honeywell barcode scanner integration for React Native","maintainers":[{"name":"ashish293","email":"ashish293.dev@gmail.com"}],"readme":"# @ashish293/react-native-honeywell-scanner\n\nA lightweight, modern React Native TurboModule integration for physical Honeywell Android barcode scanners. It interacts directly with the Honeywell Data Collection Service SDK.\n\n---\n\n## Features\n\n- **TurboModule Support**: Ready for React Native's New Architecture.\n- **Hardware Bindings**: Interfaces directly with Honeywell's native decoder engine.\n- **Auto Lifecycle Handling**: Automatically releases scanner hardware when the app is paused/backgrounded, and re-claims it upon returning to the foreground.\n- **Stateful Software Triggers**: Programmatically fire the scanning beam from JavaScript with auto-resets on success or fail.\n- **Runtime Properties Configuration**: Enable/disable specific barcode types and configure scanner properties dynamically from the JS layer.\n- **Symbology Support**: Provides decoded barcode strings alongside metadata (Symbology, Aim ID, Charset, Timestamps).\n\n---\n\n## Installation\n\n```bash\nnpm install git+https://github.com/ashish293/react-native-honeywell-scanner.git\n```\nor with Yarn:\n```bash\nyarn add git+https://github.com/ashish293/react-native-honeywell-scanner.git\n```\n\n### 1. Place Honeywell DataCollection SDK\nSince Honeywell's `DataCollection.aar` is a proprietary archive file, you must obtain it from the Honeywell Developer Portal and place it inside the library's local directory:\n\nMove `DataCollection.aar` to:\n`node_modules/@ashish293/react-native-honeywell-scanner/android/libs/DataCollection.aar`\n\n### 2. Main App Gradle Configuration\nTo comply with Android Gradle Plugin 8+ restrictions (which forbid direct local `.aar` file packaging in libraries), the library compiles the `.aar` as `compileOnly`. You must tell your main application's packaging tool to package this `.aar` by adding it directly to your main app's dependencies:\n\nOpen `android/app/build.gradle` of your project, and append the following line inside the `dependencies` block:\n```groovy\ndependencies {\n    // ...\n    // Include Honeywell's local AAR directly so it compiles and packages in the app\n    implementation files(\"../../node_modules/@ashish293/react-native-honeywell-scanner/android/libs/DataCollection.aar\")\n}\n```\n\n### 3. Android Manifest Permissions\nAdd the following permission inside your main project's `android/app/src/main/AndroidManifest.xml`:\n\n```xml\n<uses-permission android:name=\"com.honeywell.decode.permission.DECODE\" />\n```\n\n---\n\n## Usage\n\n### The Recommended Hook Way: `useHoneywellScanner`\nThe custom hook handles the complete lifecycle (initialization, event subscription, focus/blur claims, and unmount cleanups) and exposes helper actions to control software triggers dynamically:\n\n```typescript\nimport React, { useState, useCallback } from 'react';\nimport { StyleSheet, Text, View, TouchableOpacity, Alert, ActivityIndicator } from 'react-native';\nimport { useHoneywellScanner } from '@ashish293/react-native-honeywell-scanner';\nimport { useIsFocused } from '@react-navigation/native';\n\nexport default function App() {\n  const isFocused = useIsFocused();\n  const [scannedText, setScannedText] = useState<string>('');\n\n  const { status, isScanning, errorMsg, toggleScan } = useHoneywellScanner(\n    useCallback((data: string) => {\n      setScannedText(data);\n    }, []),\n    isFocused,\n    {\n      onFailure: (err) => {\n        Alert.alert('Scan Failed', err);\n      },\n      properties: {\n        // Example: disable Aztec symbology, enable QR Code\n        \"symbology_aztec_enabled\": false,\n        \"symbology_qr_enabled\": true,\n      }\n    }\n  );\n\n  return (\n    <View style={styles.container}>\n      <Text style={styles.title}>Status: {status}</Text>\n      {errorMsg ? <Text style={styles.error}>{errorMsg}</Text> : null}\n      \n      <Text style={styles.result}>Result: {scannedText}</Text>\n\n      <TouchableOpacity\n        onPress={toggleScan}\n        style={styles.button}\n        disabled={status !== 'READY'}\n      >\n        {isScanning ? (\n          <ActivityIndicator color=\"white\" />\n        ) : (\n          <Text style={styles.buttonText}>Trigger Scanner</Text>\n        )}\n      </TouchableOpacity>\n    </View>\n  );\n}\n\nconst styles = StyleSheet.create({\n  container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F8F9FC' },\n  title: { fontSize: 18, fontWeight: 'bold', color: '#1E1E24' },\n  error: { color: 'red', marginTop: 8 },\n  result: { marginVertical: 30, fontSize: 16, color: '#6E6E77' },\n  button: { backgroundColor: '#FF2D55', paddingHorizontal: 24, paddingVertical: 14, borderRadius: 8 },\n  buttonText: { color: 'white', fontWeight: 'bold' }\n});\n```\n\n---\n\n## API Reference\n\n### `useHoneywellScanner(onSuccess, isFocused, options)`\nA custom hook that initializes, claims, and releases the hardware scanner.\n- **`onSuccess`**: `(data: string) => void` - Callback triggered with the decoded barcode string on a successful scan.\n- **`isFocused`**: `boolean` - (Optional, default `true`). Controls focus/blur transition. When `false`, the hook automatically releases control of the scanner engine.\n- **`options`**: `UseHoneywellScannerOptions` - (Optional) custom handlers and properties configurations.\n  - `onFailure?: (error: string) => void` - Callback when scanning fails or times out.\n  - `properties?: Record<string, any>` - Map of properties to set on the scanner reader upon claim.\n- **Returns**: An object containing:\n  - `status: ScannerStatus` (e.g. `'READY'`, `'INITIALIZING'`, `'RELEASED'`, etc.)\n  - `isScanning: boolean` - Whether the software scanner beam is active.\n  - `errorMsg: string` - Error messages if initialization or claim failed.\n  - `claim: () => Promise<boolean>` - Manually request scanner hardware lock.\n  - `release: () => Promise<boolean>` - Manually release scanner hardware lock.\n  - `startScan: () => Promise<boolean>` - Turn the software scanner beam ON.\n  - `stopScan: () => Promise<boolean>` - Turn the software scanner beam OFF.\n  - `toggleScan: () => Promise<boolean>` - Alternates the software scanner beam.\n\n---\n\n### `HoneywellScannerBridge`\n\n#### `isSupported: boolean`\nReturns `true` if the app is running on a compatible Android device with the Honeywell scanner service available.\n\n#### `initialize(): Promise<boolean>`\nConnects to the Honeywell system service. Resolves to `true` on success.\n\n#### `claim(): Promise<boolean>`\nRequests exclusive control of the scanner engine. Must be called after `initialize()` to capture hardware button scanner events.\n\n#### `release(): Promise<boolean>`\nRelinquishes hardware lock to allow other apps on the device to access the scan laser.\n\n#### `softwareTrigger(state: boolean): Promise<boolean>`\nInstructs the hardware engine to trigger scanning. Set to `true` to turn the laser beam on, and `false` to turn it off.\n\n#### `setProperties(properties: Record<string, any>): Promise<boolean>`\nConfigures hardware properties on the reader device (e.g. toggling specific symbology decoders).\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}