feat(scanner): more work on the scanner and can now scan to prod no lst right now
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 2m41s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 2m41s
This commit is contained in:
40
lstMobile/src/lib/ZebraScanner.ts
Normal file
40
lstMobile/src/lib/ZebraScanner.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
type EmitterSubscription,
|
||||
NativeEventEmitter,
|
||||
NativeModules,
|
||||
} from "react-native";
|
||||
|
||||
const { ZebraScanner } = NativeModules;
|
||||
|
||||
const scannerEmitter = new NativeEventEmitter(ZebraScanner);
|
||||
|
||||
export type ZebraScanResult = {
|
||||
data: string;
|
||||
labelType?: string;
|
||||
source?: string;
|
||||
timestamp: number;
|
||||
};
|
||||
|
||||
export const zebraScanner = {
|
||||
startListening() {
|
||||
ZebraScanner.startListening();
|
||||
},
|
||||
|
||||
stopListening() {
|
||||
ZebraScanner.stopListening();
|
||||
},
|
||||
|
||||
triggerScan() {
|
||||
ZebraScanner.triggerScan();
|
||||
},
|
||||
|
||||
ensureProfile() {
|
||||
ZebraScanner.ensureProfile();
|
||||
},
|
||||
|
||||
addScanListener(
|
||||
callback: (scan: ZebraScanResult) => void,
|
||||
): EmitterSubscription {
|
||||
return scannerEmitter.addListener("barcodeScanned", callback);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user