public class BarcodeScanner extends java.lang.Object implements BarCodeReader.DecodeCallback, BarCodeReader.ErrorCallback
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
BARCODEPORT_RECEIVEDDATA_ACTION
扫描获得数据广播
|
static java.lang.String |
BARCODEPORT_RECEIVEDDATA_EXTRA_DATA |
static java.lang.String |
BARCODEPROT_RECEIVEDDATA_TYPE |
构造器和说明 |
---|
BarcodeScanner() |
限定符和类型 | 方法和说明 |
---|---|
static void |
decode()
开始扫码
|
static void |
decode(java.lang.String pref,
java.lang.String suff)
开始扫码
|
static java.util.List<BarcodeBean> |
getBarcodeBeans()
获取当前码制配置集合
|
static java.util.List<BarcodeBean> |
getPresetBarcodeArray()
获取预设的默认码制配置集合
|
static boolean |
hasBarcodeReader()
检查BarcodeReader是否为空
|
static void |
init(ScannerParams params)
初始化Scanner
|
void |
onDecodeComplete(int symbology,
int length,
byte[] data,
BarCodeReader reader)
Called when a decode operation has completed, either due to a timeout,
a successful decode or canceled by the user.
|
void |
onError(int error,
BarCodeReader reader)
Callback for reader errors.
|
void |
onEvent(int event,
int info,
byte[] data,
BarCodeReader reader)
Called to indicate that the decoder detected an event such as MOTION DECTECTED.
|
static void |
prepare(android.content.Context context)
准备配置,在其他所有方法前调用
|
static void |
release()
释放Scanner
|
static void |
setBarcodeBeans(java.util.List<BarcodeBean> beans)
设置码制配置集合
|
static void |
stopDecode()
停止扫码
|
public static final java.lang.String BARCODEPORT_RECEIVEDDATA_ACTION
public static final java.lang.String BARCODEPORT_RECEIVEDDATA_EXTRA_DATA
public static final java.lang.String BARCODEPROT_RECEIVEDDATA_TYPE
public static void prepare(android.content.Context context)
context
- 用于初始化BarcodeReader的contextpublic static void init(ScannerParams params)
params
- 扫描头参数public static void decode()
public static void decode(java.lang.String pref, java.lang.String suff)
pref
- 附加在结果字符串上的前缀suff
- 附加在结果字符串上的后缀public static void stopDecode()
public static void release()
public static boolean hasBarcodeReader()
public void onDecodeComplete(int symbology, int length, byte[] data, BarCodeReader reader)
BarCodeReader.DecodeCallback
BarCodeReader.open(int)
was called from.onDecodeComplete
在接口中 BarCodeReader.DecodeCallback
symbology
- the symbology of decoded bar code if anydata
- the contents of the decoded bar codereader
- the BarCodeUtils service object.public void onEvent(int event, int info, byte[] data, BarCodeReader reader)
BarCodeReader.DecodeCallback
BarCodeReader.open(int)
was called from.onEvent
在接口中 BarCodeReader.DecodeCallback
event
- the type of event that has occurredinfo
- additional event information, if any, else zerodata
- data associated with the event, if any, else nullreader
- the BarCodeUtils service object.public void onError(int error, BarCodeReader reader)
BarCodeReader.ErrorCallback
onError
在接口中 BarCodeReader.ErrorCallback
error
- error code:
reader
- the BarCodeUtils service objectpublic static void setBarcodeBeans(java.util.List<BarcodeBean> beans)
beans
- BarcodeBean数组public static java.util.List<BarcodeBean> getBarcodeBeans()
public static java.util.List<BarcodeBean> getPresetBarcodeArray()