public class Scanner
extends java.lang.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()  | 
android.os.Bundle | 
getParams(android.os.Bundle parameters)
Gets the current configuration for requested params in Bundle format. 
 | 
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)  | 
void | 
setParams(android.os.Bundle parameters)
Sets the param names and values
 After calling enable(), user must wait for IDLE status before calling setParams() API. 
 | 
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();
ScannerExceptionpublic 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
ScannerExceptionpublic void read()
          throws ScannerException
* @throws ScannerException The exception will thrown if error occurs during the read request.Example Usage: scanner.read();
ScannerExceptionpublic 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
ScannerExceptionpublic void setInterfaceConfig(InterfaceConfig interfaceConfig) throws ScannerException
ScannerExceptionpublic android.os.Bundle getParams(android.os.Bundle parameters)
                            throws ScannerException
Example Usage: scanner.enable(); Bundle requiredParams = new Bundle(); requiredParams.putString("decoder_ean8",""); requiredParams.putString("decoder_ean13",""); requiredParams.putString("decoder_code39",""); requiredParams.putString("decoder_code128",""); . . . Bundle params = scanner.getParams(requiredParams); . . Bundle allParams = scanner.getParams(new Bundle());
parameters - An empty bundle or names of the required parameters in bundle formatScannerExceptionpublic void setParams(android.os.Bundle parameters)
               throws ScannerException
Example Usage: scanner.enable(); Bundle params = new Bundle(); params.putString("decoder_ean8","true"); params.putString("beam_timer","1000"); params.putString("picklist","1"); scanner.setParams(params);
parameters - Parameter names and values in Bundle format. Every value must be in String formatScannerException