Class LinkScanner
java.lang.Object
com.codename1.pos.LinkScanner
A barcode scanner that sends each code as a line over a serial port, USB serial or TCP. (A scanner in keyboard mode needs no class: it types into the focused text field.)
LinkScanner scanner = new LinkScanner(new SerialLink("/dev/ttyACM0", 9600));
scanner.start(code -> System.out.println("Scanned " + code));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstart(SuccessCallback<String> onScan) Starts reading on a thread of its own.voidstop()Stops reading and closes the link.
-
Constructor Details
-
LinkScanner
Parameters
link: the scanner's connection
-
-
Method Details
-
start
Starts reading on a thread of its own. Each code, without its line ending, goes to
onScanon the EDT.Parameters
onScan: receives each code
-
stop
public void stop()Stops reading and closes the link.
-