android.device
Class ScanManager

java.lang.Object
  extended by android.device.ScanManager

public class ScanManager
extends java.lang.Object

The ScanManager class provides developers access to barcode reader related in the device


Constructor Summary
ScanManager()
           
 
Method Summary
 boolean closeScanner()
          Turn off the power for the bar code reader.
 int getOutputMode()
          get current the scan result output mode
 int getOutputParameter(int type)
          get the scan successed behavior states
 boolean getScannerState()
          get the scanner power states
 int getScannerType()
           
 boolean getTriggerLockState()
          get the scan trigger status
 boolean lockTriggler()
          Set the scan trigger inactive (disable the scan button)
 boolean openScanner()
          Turn on the power for the bar code reader.
 boolean resetScannerParameters()
          Set factory defaults for all barcode symbology types.
 boolean setOutputParameter(int type, int value)
          Set the scan behavior.
 boolean startDecode()
          Call this method to start decoding.
 boolean stopDecode()
          This stops any data acquisition currently in progress.
 boolean switchOutputMode(int mode)
          Use this function to set the output mode of the barcode reader (either send output to text box or as Android intent).
 boolean unlockTriggler()
          Set the scan trigger active (enable the scan button)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScanManager

public ScanManager()
Method Detail

switchOutputMode

public boolean switchOutputMode(int mode)

Use this function to set the output mode of the barcode reader (either send output to text box or as Android intent).

TextBox Mode allows the captured data to be sent to the text box in focus.

Intent mode allows the captured data to be sent as an implicit Intent. Application interested in the scan data should register an action as urovo.rcv.message broadcast listerner.

In the onReceive(Context context, Intent arg1) method, get the information as follow:
byte[] barcode=arg1.getByteArrayExtra("barcode");
int barcodelen=arg1.getIntExtra("length",0);
byte type=arg1.getByteExtra("barcodeType",(byte)0);

The information are bar code data, length of bar code data, and bar code type (symbology).

Parameters:
mode - Set to 0 if barcode output is to be sent as intent, barcode output is to be sent to the text box in focus
Returns:
Returns true if successful. Returns false if failed.

getOutputMode

public int getOutputMode()
get current the scan result output mode

Returns:
Returns zero if the barcode is sent as intent. Returns 1 if barcode is sent to the text box in focus

setOutputParameter

public boolean setOutputParameter(int type,
                                  int value)
Set the scan behavior.

Parameters:
type - The behavior.
value - the behavior value: 0 or 1   
Type Value
1 0 No beep; 1 Beep
2 0 No vibration; 1 Vibrate
3 0 Do not append CR on scan output string; 1 Append CR on scan output string
Returns:
Returns true if set successful

getOutputParameter

public int getOutputParameter(int type)
get the scan successed behavior states

Parameters:
type - is behavior type: 1 is beep; 2 is vibrate; 3 Append 'return'character;
Returns:
1 enable the @param behavior, 0 disable

openScanner

public boolean openScanner()
Turn on the power for the bar code reader.

Returns:
false if failed. true if success,

closeScanner

public boolean closeScanner()
Turn off the power for the bar code reader.

Returns:
false if failed. true if success,

getScannerState

public boolean getScannerState()
get the scanner power states

Returns:
true if the scanner power on.

stopDecode

public boolean stopDecode()
This stops any data acquisition currently in progress.

Returns:
true if stop successed.

startDecode

public boolean startDecode()
Call this method to start decoding.

Returns:
true if the sanner and the trigger is already active

lockTriggler

public boolean lockTriggler()
Set the scan trigger inactive (disable the scan button)

Returns:
Returns true if successful. Returns false if failed.

unlockTriggler

public boolean unlockTriggler()
Set the scan trigger active (enable the scan button)

Returns:
Returns true if successful. Returns false if failed.

getTriggerLockState

public boolean getTriggerLockState()
get the scan trigger status

Returns:
true if the scan trigger is already active

getScannerType

public int getScannerType()

resetScannerParameters

public boolean resetScannerParameters()
Set factory defaults for all barcode symbology types.

Returns:
true if succeed