Directory

← Back

Barcode Scanner

Barcode scanner wrapper of QuaggaJS for Vaadin 14

Author

Contributors

Rating

Vaadin 14 Java integration of @granite-elements/granite-qrcode-scanner

After construct BarcodeScanner need to call initAndStart() method. (barcodeScanner.initAndStart())

Sample code

        BarcodeScanner barcodeScanner = new BarcodeScanner();
        Label lastScannedLabel = new Label("Last scanned value: unknown");
        barcodeScanner.setConsumer(event ->{
            System.out.println("data: " + event.toString());
            lastScannedLabel.setText("Last scanned value: "+event.getCodeResult().getCode());
        });
        add(barcodeScanner);
        add(lastScannedLabel);
        barcodeScanner.setReaders(DecoderEnum.CODE_39_READER);

        barcodeScanner.setStopAfterScan(false);
        add(new Button("stop",e->{
            barcodeScanner.stop();
        }));
        add(new Button("start",e->{
            barcodeScanner.initAndStart();
        }));
        BarcodeScanner barcodeScanner = new BarcodeScanner(event ->{
            System.out.println("data: " + event.toString());
            lastScannedLabel.setText("Last scanned value: "+event.getCodeResult().getCode());
        });
        Label lastScannedLabel = new Label("Last scanned value: unknown");
        add(barcodeScanner);
        add(lastScannedLabel);
        barcodeScanner.setReaders(DecoderEnum.CODE_39_READER);

        barcodeScanner.setStopAfterScan(false);
        add(new Button("stop",e->{
            barcodeScanner.stop();
        }));
        add(new Button("start",e->{
            barcodeScanner.initAndStart();
        }));

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

fix test, add comments

Released
2020-03-11
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 14+
Browser
N/A
Online