public class Scanner extends Object
Example Usage: Scanner scanner = barcodeManager.getDevice(DeviceIdentifer.DEFAULT); scanner.enable(); scanner.addDataListener(this); scanner.read(); scanner.cancelRead(); scanner.disable();
Modifier and Type | Class and Description |
---|---|
static interface |
Scanner.DataListener
An interface for notifying client applications when the scan data is
available.
|
static interface |
Scanner.StatusListener
An interface for notifying client applications to notify scan events.
|
static class |
Scanner.TriggerType
List of supported trigger type
|
Modifier and Type | Field and Description |
---|---|
Scanner.TriggerType |
triggerType
Specifies the trigger type for the scanner.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataListener(Scanner.DataListener listener)
The client can register to get data notification via callbacks.
|
void |
addStatusListener(Scanner.StatusListener listener)
The client can register to get status notification via callbacks.
|
void |
cancelRead()
This Cancels any pending asynchronous read() calls
|
void |
disable()
Disables the scanner hardware.
|
void |
enable()
Enables the scanner hardware.
|
ScannerConfig |
getConfig()
Gets the current configuration settings for this scanner device.
|
InterfaceConfig |
getInterfaceConfig() |
ScannerInfo |
getScannerInfo()
Returns information about the scanner device.
|
boolean |
isEnabled()
Returns scanner enabled state.
|
boolean |
isReadPending()
Another read() cannot be submitted while a read is pending.
|
void |
read()
Starts an asynchronous Scan.
|
void |
release()
Releases the scanner object resources.
|
void |
removeDataListener(Scanner.DataListener listener)
The client can un-register to get data notification via callbacks.
|
void |
removeStatusListener(Scanner.StatusListener listener)
The client can un-register to get status notification via callbacks.
|
void |
setConfig(ScannerConfig scannerConfig)
Changes the settings for this scanner device.
|
void |
setInterfaceConfig(InterfaceConfig interfaceConfig) |
public Scanner.TriggerType triggerType
public boolean isEnabled()
public boolean isReadPending()
public ScannerInfo getScannerInfo()
public ScannerConfig getConfig() throws ScannerException
Example Usage: scanner.enable(); ScannerConfig config = scanner.getConfig();
ScannerException
public void setConfig(ScannerConfig scannerConfig) throws ScannerException
Example Usage: ScannerConfig scannerConfig = scanner.getConfig(); scannerConfig.scanParams.decodeLEDTime = 10; scanner.setConfig(scannerConfig);
scannerConfig
- The Parameters to use for this scanner device.ScannerException
- Exception will be throw if any error occurs while setting the parameters.public void enable() throws ScannerException
Example Usage: scanner.enable();
ScannerException
- The exception will thrown if the scanner enable fails.public void disable() throws ScannerException
Example Usage: scanner.disable();
ScannerException
- The exception will thrown if the scanner disable fails.public void release() throws ScannerException
ScannerException
public void read() throws ScannerException
* @throws ScannerException The exception will thrown if error occurs during the read request.Example Usage: scanner.read();
ScannerException
public void cancelRead() throws ScannerException
Example Usage: scanner.cancelRead();
ScannerException
- The exception will thrown if error occurs during the
cancelRead request.public void addDataListener(Scanner.DataListener listener)
listener
- The DataListener callabck object.public void removeDataListener(Scanner.DataListener listener)
listener
- public void addStatusListener(Scanner.StatusListener listener)
listener
- public void removeStatusListener(Scanner.StatusListener listener)
listener
- public InterfaceConfig getInterfaceConfig() throws ScannerException
ScannerException
public void setInterfaceConfig(InterfaceConfig interfaceConfig) throws ScannerException
ScannerException