Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class LinkScanner

  1. Object
  2. 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));

Constructors

public LinkScanner(ByteLink link)

Methods

public void start(SuccessCallback<String> onScan)Starts reading on a thread of its own.
public void stop()Stops reading and closes the link.

Inherited methods

Constructor details

LinkScanner

public LinkScanner(ByteLink link)

Parameters

link ByteLink
the scanner’s connection

Method details

start

public void start(SuccessCallback<String> onScan)
Starts reading on a thread of its own. Each code, without its line ending, goes to onScan on the EDT.

Parameters

onScan SuccessCallback<String>
receives each code

stop

public void stop()
Stops reading and closes the link.