|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.device.ScanManager
public class ScanManager
The ScanManager class provides developers access to barcode reader related in the device
To decode bar codes with this class, use the following steps:
openScanner()
to power on the bar code reader.
getParameterInts(int[])
.
PropertyID
object value and call
setParameterInts(int[], int[])
.
public void getOutputMode() {
   int[] index = new int[]{
PropertyID.WEDGE_KEYBOARD_ENABLE};
   int[] value = scan.getParameterInts(index);
}
public void setOutputMode() {
   int[] index = new int[]{
PropertyID.WEDGE_KEYBOARD_ENABLE,
PropertyID.WEDGE_KEYBOARD_TYPE,
PropertyID.GOOD_READ_BEEP_ENABLE};
   int[] value = new int[]{1, 1, 1};
   int ret = scan.setParameterInts(index, value);
}
Intent mode allows the captured data to be sent as an implicit Intent. Application interested in the scan data should register default action as android.intent.ACTION_DECODE_DATA broadcast listerner.
public void updatetDecodingIntent() {
   int[] index = new int[]{
PropertyID.WEDGE_INTENT_ACTION_NAME,
PropertyID.WEDGE_INTENT_DATA_STRING_TAG};
   String[] value = scan.getParameterString(index);
   value[0] = "android.scan.data";
   value[1] = "dataString";
   boolean ret = scan.setParameterInts(index, value);
}
startDecode()
.
if the configured PropertyID.WEDGE_KEYBOARD_ENABLE
is 0.Your registered broadcast receiver will be called when a successful decode occurs.
stopDecode()
to end the decode session.
closeScanner()
to power off the bar code reader.
Field Summary | |
---|---|
static java.lang.String |
ACTION_DECODE
|
static java.lang.String |
BARCODE_LENGTH_TAG
String contains the label length of the bar code |
static java.lang.String |
BARCODE_STRING_TAG
|
static java.lang.String |
BARCODE_TYPE_TAG
String contains the label type of the bar code |
static java.lang.String |
DECODE_DATA_TAG
String contains the output data as a byte array. |
Constructor Summary | |
---|---|
ScanManager()
|
Method Summary | |
---|---|
boolean |
closeScanner()
Turn off the power for the bar code reader. |
void |
enableAllSymbologies(boolean enable)
Enables or disables all supported symbologies. |
void |
enableSymbology(Symbology barcodeType,
boolean enable)
Enables or disables a barcode symbology type. |
int |
getOutputMode()
get current the scan result output mode |
int[] |
getParameterInts(int[] id_buffer)
Gets one or more programming parameters of type Integer from the scan engine |
java.lang.String[] |
getParameterString(int[] id_buffer)
Gets label programming parameters of type String at the specified indexs. |
boolean |
getScannerState()
get the scanner power states |
boolean |
getTriggerLockState()
get the scan trigger status |
Triggering |
getTriggerMode()
Returns current configure triggering decode mode. |
boolean |
isSymbologyEnabled(Symbology barcodeType)
Returns current enable setting for a particular barcode symbology. |
boolean |
isSymbologySupported(Symbology barcodeType)
Return true if the device's decoder is able to read a particular barcode symbology. |
boolean |
lockTrigger()
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. |
int |
setParameterInts(int[] id_buffer,
int[] value_buffer)
Sets one or more label programming parameters of type Int |
boolean |
setParameterString(int[] id_buffer,
java.lang.String[] value_buffer)
Set the scanner parameter of type String at the specified indexes. |
void |
setTriggerMode(Triggering mode)
This method set specifies which mode to control decode. |
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 |
unlockTrigger()
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 |
Field Detail |
---|
public static final java.lang.String ACTION_DECODE
public static final java.lang.String BARCODE_STRING_TAG
public static final java.lang.String BARCODE_TYPE_TAG
public static final java.lang.String BARCODE_LENGTH_TAG
public static final java.lang.String DECODE_DATA_TAG
Constructor Detail |
---|
public ScanManager()
Method Detail |
---|
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 android.intent.ACTION_DECODE_DATA 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).
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
public int getOutputMode()
public boolean openScanner()
public boolean closeScanner()
public boolean getScannerState()
public boolean stopDecode()
public boolean startDecode()
public boolean lockTrigger()
public boolean unlockTrigger()
public boolean getTriggerLockState()
public boolean resetScannerParameters()
public void setTriggerMode(Triggering mode)
Specifies
- which mode.
a trigger will activate the scan engine and start decoding. It will be deactivated when a valid code is found, or when time out is reached.
Pulse - a trigger will activate the scan engine, and start decoding. It will be deactivated when a valid code is found, or when the trigger is released, or when the time out is reached.
Continuous - Scan engine is always on and always decoding.
Triggering
public Triggering getTriggerMode()
Triggering
public int setParameterInts(int[] id_buffer, int[] value_buffer)
id_buffer
- The indexes to the parameters to be set. PropertyID
value_buffer
- the values to be used.
public int[] getParameterInts(int[] id_buffer)
id_buffer
- The indexes to the programming parameteres. PropertyID
public boolean setParameterString(int[] id_buffer, java.lang.String[] value_buffer)
id_buffer
- to the parameter that is to be set PropertyID
value_buffer
- the string used to set the parameter
public java.lang.String[] getParameterString(int[] id_buffer)
id_buffer
- The indexes to the programming parameteres. PropertyID
public boolean isSymbologySupported(Symbology barcodeType)
barcodeType
- Barcode type is one of the Symbology
.
public boolean isQRSupported(ScanManager decoder) {
  return decoder.isSymbologySupported(Symbology.QRCODE);
}
public boolean isSymbologyEnabled(Symbology barcodeType)
barcodeType
- This gets the current enable setting for a particular data
type. (one of the barcode typein the Symbology
class).
public boolean isCode128Enabled(ScanManager decoder) {
  return decoder.isSymbologyEnabled(Symbology.CODE128);
}
public void enableAllSymbologies(boolean enable)
enable
- Specifies whether or not the symbologies will be enabled. If
false, the symbologies are disabled, otherwise they are
enabled.
public void enableAll(ScanManager decoder) {
  decoder.enableAllSymbologies(true);
}
public void enableSymbology(Symbology barcodeType, boolean enable)
barcodeType
- Indicates the type of data whose enable setting is to be
altered. (one of the barcode type in the
Symbology
class).enable
- Specifies whether or not the data type will be enabled. If
false, the data type is disabled, otherwise it is enabled.
public void enableCode128(ScanManager decoder) {
  decoder.enableSymbology(Symbology.CODE128, true);
}
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |