public class SmartScannerApi2 extends SmartScanner
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
DEFAULT_MINIMAL_SCORE, ID_AUTO_FOCUS, ID_DEBUG, ID_DECODE, ID_DECODE_FAILED, ID_DECODE_SUCCEEDED, ID_LAUNCH_PRODUCT_QUERY, ID_PAUSE_DECODING, ID_QUIT, ID_RESUME_DECODING, LEVEL_3, LEVEL_FULL, LEVEL_LIMITED, NO_CAMERA_ID| Constructor and Description |
|---|
SmartScannerApi2(android.content.Context context)
Instantiate the SmartScannerApi2 object.
|
| Modifier and Type | Method and Description |
|---|---|
CameraControllerApi2 |
getCameraController()
Gets CameraControllerLegacy used to interact with the device
|
android.content.Context |
getContext()
Get the context.
|
SmartScannerHandlerApi2 |
getHandler()
Gets the smartscanner app thread Handler that binds with decoding thread
|
java.lang.String |
getIcareDecodersSDKDescription()
Prints the native SDK build description.
|
android.graphics.Rect |
getRegionOfInterest()
Get current region of interest.
|
java.lang.String |
getTypeSmartscan()
Return the smartscan library activated.
|
java.lang.String |
getVersion()
Displays smartscan java library information.
|
void |
handleDecoderResult(DecodedResult decodedResult)
A valid result has been found, so execute callback if given.
|
void |
init()
Initializes the SmartScannerApi2 library objects and processes.
|
boolean |
isFlashAvailable()
Checks if flashlight is available on device.
|
boolean |
isZoomSupported()
Get the information about the availability of the zoom .
|
void |
manualFocus(float x,
float y,
android.view.View view,
boolean isFocusRectangleVisible)
On double tap we switch to manual focus.
|
void |
pauseDecoding()
Pauses the decoding process.
|
void |
release()
This methods frees memory by releasing objects and processes used by SmartScannerApi2.
|
void |
restartDecoding()
Restarts the decoding process.
|
void |
setAutoFocusEnabled(boolean isAutoFocusEnabled)
If not already activated we turn on the auto focus.
|
void |
setBeepOn(int beepResId)
Enables and set the beep sound when a scan is done.
|
void |
setCameraId(int cameraId)
Sets the camera to use.
|
void |
setCanvasDrawer(CanvasDrawerInterface canvasDrawer)
Sets the CanvasDrawer, ie. the view that displays the target.
|
void |
setContinuousDecoding(boolean isContinuousDecoding)
Restarts decoding as soon as a result has been found, without manual call to
restartDecoding. |
void |
setDebugView(android.view.SurfaceView view)
Defines the SurfaceView holding the debug preview, inside your layout.
|
void |
setDecodingType(long decodingType,
long decodingSubType)
Sets the decoder to use.
|
void |
setFlashEnabled(boolean isFlashEnabled)
Enables/Disables the flashlight LED during the scanning process
|
void |
setOnErrorListener(OnDecoderErrorListener listener) |
void |
setOnLoadedListener(OnDecoderLoadedListener listener) |
void |
setOnResultListener(OnDecoderResultFoundListener listener)
Setting the listeners for the application.
|
void |
setRegionOfInterest(android.graphics.Rect rect)
Allows to manually set the region of interest.
|
void |
setTextureView(AutoFitTextureView textureView)
Defines the AutoFitTextureView holding the camera preview, inside your layout.
|
void |
setVibrateOn(boolean enabled)
Enables the vibration when a scan is done.
|
void |
setVisualDebug(boolean visualDebug)
Activate the visualdebug.
|
void |
setZoomCamera(int zoom)
Set the zoom of the camera.
|
public SmartScannerApi2(android.content.Context context)
context - Contextpublic java.lang.String getTypeSmartscan()
getTypeSmartscan in class SmartScannerpublic void setOnResultListener(OnDecoderResultFoundListener listener)
setOnResultListener in class SmartScannerpublic void setOnLoadedListener(OnDecoderLoadedListener listener)
setOnLoadedListener in class SmartScannerpublic void setOnErrorListener(OnDecoderErrorListener listener)
setOnErrorListener in class SmartScannerpublic android.content.Context getContext()
getContext in class SmartScannerpublic void setVisualDebug(boolean visualDebug)
setVisualDebug in class SmartScannervisualDebug - Boolean to activate visual debug on the smartscan library.public java.lang.String getIcareDecodersSDKDescription()
getIcareDecodersSDKDescription in class SmartScannerpublic void setContinuousDecoding(boolean isContinuousDecoding)
restartDecoding. Default is false.setContinuousDecoding in class SmartScannerisContinuousDecoding - true if the decoder should decode continuously, false to pause after resultpublic void setBeepOn(int beepResId)
setBeepOn in class SmartScannerbeepResId - int resource id of the sound file.public void setVibrateOn(boolean enabled)
setVibrateOn in class SmartScannerenabled - Boolean to set the vibration mode on the device (on or off)public void setFlashEnabled(boolean isFlashEnabled)
setFlashEnabled in class SmartScannerisFlashEnabled - Boolean to set the flash mode on the device (on or off)public boolean isFlashAvailable()
init because it needs to access the camera instance.
For example, a safe place to call this method is in your implementation of
{link OnDecoderLoadedListener.onDecoderLoaded() OnDecoderLoadedListener.onDecoderLoaded }.
For a more straightforward but less reliable method, you can use
getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH) on your activity.isFlashAvailable in class SmartScannerpublic void setDecodingType(long decodingType,
long decodingSubType)
SmartScannerApi2 Bitwise
combinations can be used to specify multiple decoding types.setDecodingType in class SmartScannerdecodingType - Decoding typedecodingSubType - Decoding subtypepublic void setRegionOfInterest(android.graphics.Rect rect)
setRegionOfInterest in class SmartScannerrect - Rect representation of the region of interestpublic void setTextureView(AutoFitTextureView textureView)
setTextureView in class SmartScannertextureView - AutoFitTextureView view instancepublic void setCanvasDrawer(CanvasDrawerInterface canvasDrawer)
setCanvasDrawer in class SmartScannercanvasDrawer - view that implement CanvasDrawerInterfacepublic void setDebugView(android.view.SurfaceView view)
setDebugView in class SmartScannerview - SurfaceView view instancepublic SmartScannerHandlerApi2 getHandler()
getHandler in class SmartScannerSmartScannerHandlerApi2public CameraControllerApi2 getCameraController()
getCameraController in class SmartScannerCameraControllerApi2public java.lang.String getVersion()
getVersion in class SmartScannerpublic void setCameraId(int cameraId)
cameraId - int camera id. On most devices 0 is the first back facing camera.public void init()
OnDecoderLoadedListener#onDecoderLoaded(Rect), OnDecoderLoadedListener.onDecoderLoaded occurs.init in class SmartScannerpublic void release()
release in class SmartScannerpublic void handleDecoderResult(DecodedResult decodedResult)
OnDecoderResultFoundListener#onResultFound(DecodedResult), OnDecoderResultListener.onResultFound
Restarts decoding if continuous decoding is enabled.
This method is called internally.handleDecoderResult in class SmartScannerdecodedResult - DecodedResult objectpublic void restartDecoding()
setContinuousDecoding is false.restartDecoding in class SmartScannerpublic void pauseDecoding()
restartDecoding.pauseDecoding in class SmartScannerpublic android.graphics.Rect getRegionOfInterest()
getRegionOfInterest in class SmartScannerpublic boolean isZoomSupported()
isZoomSupported in class SmartScannerpublic void setZoomCamera(int zoom)
setZoomCamera in class SmartScannerzoom - Level of the zoom to set for the camera.public void manualFocus(float x,
float y,
android.view.View view,
boolean isFocusRectangleVisible)
manualFocus in class SmartScannerx - Position on x axis on the screeny - Position on y axis on the screenview - View where we will draw the focus rectangleisFocusRectangleVisible - Option to draw the focus rectangle or notpublic void setAutoFocusEnabled(boolean isAutoFocusEnabled)
setAutoFocusEnabled in class SmartScannerisAutoFocusEnabled - Boolean to activate/deactivate the autofocus.