public final class StBarcodeScanner
extends java.lang.Object
getInstance()
限定符和类型 | 类和说明 |
---|---|
static class |
StBarcodeScanner.BarcodeInfo
条码信息
|
static class |
StBarcodeScanner.BarcodeScannerModel
模块信息,包含支持的模块类型,以及模块的信息
|
static class |
StBarcodeScanner.BarcodeScannerModelK |
static class |
StBarcodeScanner.BarcodeScannerModelUnknown |
限定符和类型 | 方法和说明 |
---|---|
<BarcodeScannerModelX> |
getBarcodeScannerInterfaceAs(java.lang.Class<BarcodeScannerModelX> model) |
StBarcodeScanner.BarcodeScannerModel |
getBarcodeScannerModel() |
static StBarcodeScanner |
getInstance()
获取一个条码扫描器对象。
|
static StBarcodeScanner |
getInstance(StBarcodeScanner.BarcodeScannerModel barcodeScannerModel) |
boolean |
init()
初始化设备,初始化需要一定时间s
|
boolean |
isInited()
判断是否初始化,如果已经初始化,返回true
|
java.lang.String |
scan()
进行一次条码扫描
阻塞地执行一次条码扫描,直到扫到条码,或超时。 |
java.lang.String |
scan(java.lang.String charsetName)
进行一次条码扫描
阻塞地执行一次条码扫描,直到扫到条码,或超时。 |
StBarcodeScanner.BarcodeInfo |
scanBarcodeInfo()
进行一次条码扫描
阻塞地执行一次条码扫描,直到扫到条码,或超时。 |
void |
setOnBarcodeScannedLisener(StBarcodeScanner.BarcodeScannerModelUnknown.BsmUnknownOnNewBarcodeScannedListener lisener)
设置监听器,最后一次设置的监听器有效
|
void |
stopScan()
停止当前正在进行的扫描,如果当前没有进行扫描,本函数没有作用
|
void |
trigScan()
触发扫描,异步实现方式
|
void |
uninit()
停止设备,让设备断电,清除监听器设置
|
public void trigScan()
public static StBarcodeScanner getInstance()
StBarcodeScanner
对象。如果失败,返回null
scan()
public static StBarcodeScanner getInstance(StBarcodeScanner.BarcodeScannerModel barcodeScannerModel)
public StBarcodeScanner.BarcodeScannerModel getBarcodeScannerModel()
public final <BarcodeScannerModelX> BarcodeScannerModelX getBarcodeScannerInterfaceAs(java.lang.Class<BarcodeScannerModelX> model)
public boolean init() throws java.lang.InterruptedException
java.lang.InterruptedException
scan()
public void stopScan() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public void uninit()
public void setOnBarcodeScannedLisener(StBarcodeScanner.BarcodeScannerModelUnknown.BsmUnknownOnNewBarcodeScannedListener lisener)
public boolean isInited()
scan()
public java.lang.String scan() throws java.lang.InterruptedException, java.lang.IllegalStateException, java.io.UnsupportedEncodingException
java.lang.InterruptedException
- :当执行函数的线程收到中止信号java.lang.IllegalStateException
- 当执行此函数时连续扫描正在进行中java.io.UnsupportedEncodingException
public java.lang.String scan(java.lang.String charsetName) throws java.lang.InterruptedException, java.lang.IllegalStateException, java.io.UnsupportedEncodingException
charsetName
- 字符编码
java.lang.InterruptedException
- :当执行函数的线程收到中止信号java.lang.IllegalStateException
- 当执行此函数时连续扫描正在进行中java.io.UnsupportedEncodingException
public StBarcodeScanner.BarcodeInfo scanBarcodeInfo() throws java.lang.InterruptedException, java.lang.IllegalStateException
StBarcodeScanner.BarcodeInfo
,失败:返回null
java.lang.InterruptedException
- :当执行函数的线程收到中止信号java.lang.IllegalStateException
- 当执行此函数时连续扫描正在进行中