react-native-urovo-scanner
v1.0.0
Published
React Native package for Urovo Scanner SDK integration - Official SDK implementation
Maintainers
Readme
React Native Urovo Scanner
React Native package for Urovo Scanner SDK integration using the official Urovo SDK v4.1.0326. This package provides a complete TypeScript interface for barcode scanning functionality on Urovo handheld devices.
📱 Features
- ✅ Official Urovo SDK Integration - Uses the official Urovo SDK v4.1.0326
- ✅ Complete TypeScript Support - Full type definitions and IntelliSense
- ✅ Multiple Trigger Modes - ONESHOT, CONTINUOUS, PULSE
- ✅ Comprehensive Barcode Support - QR, Code128, Code39, EAN13, EAN8, UPC-A, UPC-E, DataMatrix, PDF417, Aztec
- ✅ Advanced Configuration - Sound, vibration, keyboard wedge, and more
- ✅ Manual Laser Control - Press/release laser control
- ✅ React Hooks - Modern React patterns with custom hooks
- ✅ Configuration UI Component - Ready-to-use configuration interface
🔧 Installation
npm install react-native-urovo-scannerAndroid Setup
- Add the following to your
android/app/build.gradle:
dependencies {
implementation project(':react-native-urovo-scanner')
}- Add the package to your
MainApplication.java:
import com.reactnativeurovoscanner.UrovoScannerPackage;
public class MainApplication extends Application implements ReactApplication {
// ...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new UrovoScannerPackage() // Add this line
);
}
}- Add permissions to
android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />🚀 Usage
Basic Usage
import React, { useEffect, useState } from 'react';
import { View, Text, Alert } from 'react-native';
import { useUrovoScanner, ScanResult } from 'react-native-urovo-scanner';
const App = () => {
const [scanResults, setScanResults] = useState<ScanResult[]>([]);
const handleScan = (result: ScanResult) => {
setScanResults(prev => [result, ...prev]);
Alert.alert('Scanned', `Value: ${result.value}\nType: ${result.symbology}`);
};
const { isOpened } = useUrovoScanner({
onScanResult: handleScan,
autoOpen: true,
});
return (
<View style={{ flex: 1, padding: 20 }}>
<Text>Scanner Status: {isOpened ? 'Ready' : 'Not Available'}</Text>
{scanResults.map((result, index) => (
<Text key={index}>
{result.value} ({result.symbology})
</Text>
))}
</View>
);
};Advanced Usage with Configuration
import React, { useState } from 'react';
import { View, Button, Modal } from 'react-native';
import {
useUrovoScanner,
ScannerConfiguration,
TRIGGER_MODES
} from 'react-native-urovo-scanner';
const App = () => {
const [showConfig, setShowConfig] = useState(false);
const { isOpened, startScan, stopScan } = useUrovoScanner({
onScanResult: (result) => {
console.log('Scan result:', result);
},
});
return (
<View style={{ flex: 1, padding: 20 }}>
<Button
title="Open Configuration"
onPress={() => setShowConfig(true)}
/>
<Button
title="Start Manual Scan"
onPress={startScan}
disabled={!isOpened}
/>
<Button
title="Stop Manual Scan"
onPress={stopScan}
disabled={!isOpened}
/>
<Modal visible={showConfig} animationType="slide">
<ScannerConfiguration onClose={() => setShowConfig(false)} />
</Modal>
</View>
);
};📚 API Reference
Hooks
useUrovoScanner(options)
Main hook for scanner functionality.
Parameters:
options.onScanResult?: (result: ScanResult) => void- Callback for scan resultsoptions.onScanError?: (error: ScanError) => void- Callback for scan errorsoptions.autoOpen?: boolean- Auto-open scanner on mount (default: true)
Returns:
isOpened: boolean- Scanner availability statusisScanning: boolean- Current scanning statusopenScanner: () => Promise<boolean>- Open scanner functioncloseScanner: () => Promise<boolean>- Close scanner functionstartScan: () => Promise<boolean>- Start scanning functionstopScan: () => Promise<boolean>- Stop scanning functionerror: string | null- Current error state
useScannerConfiguration()
Hook for advanced scanner configuration.
Returns:
config: ScannerConfiguration | null- Current configurationconstants: PropertyIDConstants | null- PropertyID constantsloading: boolean- Loading stateerror: string | null- Error stateupdateParameter: (propertyId: number, value: number) => Promise<boolean>- Update parameter functionrefreshConfiguration: () => Promise<void>- Refresh configuration function
Components
ScannerConfiguration
Ready-to-use configuration component with UI for all scanner settings.
Props:
onClose?: () => void- Callback when closing the configuration
Constants
TRIGGER_MODES
export const TRIGGER_MODES = {
SCAN_TRIGGER_MODE_ONESHOT: 0, // One scan per trigger
SCAN_TRIGGER_MODE_CONTINUOUS: 1, // Continuous scanning
SCAN_TRIGGER_MODE_PULSE: 2, // Pulse scanning
};SCAN_MODES
export const SCAN_MODES = {
SCAN_MODE_BROADCAST: 0, // Broadcast mode
SCAN_MODE_STORAGE: 1, // Storage mode
SCAN_MODE_WEDGE: 2, // Keyboard wedge mode
};Types
ScanResult
interface ScanResult {
value: string; // Scanned barcode value
symbology: string; // Barcode type (QR, CODE128, etc.)
}ScannerConfiguration
interface ScannerConfiguration {
qrCode: number;
code128: number;
code39: number;
ean13: number;
ean8: number;
upca: number;
upce: number;
dataMatrix: number;
pdf417: number;
aztec: number;
keyboardWedge: number;
beepEnabled: number;
vibrateEnabled: number;
}🎯 Supported Barcode Types
- QR Code - Quick Response codes
- Code 128 - High-density linear barcode
- Code 39 - Alphanumeric barcode
- EAN-13 - European Article Number
- EAN-8 - Short EAN barcode
- UPC-A - Universal Product Code
- UPC-E - Compressed UPC
- Data Matrix - 2D matrix barcode
- PDF417 - Stacked linear barcode
- Aztec - 2D matrix barcode
📱 Compatible Devices
- Urovo CT58 - Handheld terminal
- Urovo CT60 - Handheld terminal
- Urovo RT40 - Rugged tablet
- Other Urovo Android devices with built-in scanners
🔧 Configuration Options
Trigger Modes
- ONESHOT: Single scan per trigger activation
- CONTINUOUS: Continuous scanning while trigger is held
- PULSE: Rapid pulse scanning
Barcode Types
Enable/disable specific barcode types:
- QR Code, Code 128, Code 39
- EAN-13, EAN-8, UPC-A, UPC-E
- Data Matrix, PDF417, Aztec
Behavior Settings
- Sound: Enable/disable scan success beep
- Vibration: Enable/disable scan success vibration
- Keyboard Wedge: Enable/disable keyboard input mode
🛠️ Development
Requirements
- React Native 0.60+
- Android SDK 21+
- Urovo device with official SDK support
Building
git clone https://github.com/gglibaak/react-native-urovo-scanner.git
cd react-native-urovo-scanner
npm install
npm run build📝 License
MIT License - see LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please read the Contributing Guide for details.
📞 Support
- Issues: GitHub Issues
- Email: [email protected]
🙏 Acknowledgments
- Built with the official Urovo SDK v4.1.0326
- Designed for professional barcode scanning applications
- Optimized for Urovo handheld devices
Made with ❤️ for the Urovo developer community
