public class SmartScanner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG |
static int |
DEFAULT_MINIMAL_SCORE |
static int |
ID_AUTO_FOCUS |
static int |
ID_DEBUG |
static int |
ID_DECODE |
static int |
ID_DECODE_FAILED |
static int |
ID_DECODE_SUCCEEDED |
static int |
ID_LAUNCH_PRODUCT_QUERY |
static int |
ID_PAUSE_DECODING |
static int |
ID_QUIT |
static int |
ID_RESUME_DECODING |
static int |
ID_TAKE_PICTURE |
static int |
ID_VIDEO_REC_START |
static int |
ID_VIDEO_REC_STOP |
static int |
LANDSCAPE_MODE |
static int |
LANDSCAPE_REVERSE_MODE |
static int |
LEVEL_3 |
static int |
LEVEL_FULL |
static int |
LEVEL_LIMITED |
static int |
NO_CAMERA_ID |
static int |
PORTRAIT_MODE |
static int |
PORTRAIT_REVERSE_MODE |
Constructor and Description |
---|
SmartScanner(android.content.Context context)
Instantiate the SmartScanner object.
|
SmartScanner(android.content.Context context,
int cameraId,
int minScoreCameraAPI2)
Instantiate the SmartScanner object with camera id.
|
Modifier and Type | Method and Description |
---|---|
void |
enableMultipleResultsConfirmation(int numberConfirmations)
While using a behavior that is different from SmartScannerResultBehaviorContinuous.
|
ch.icare.smartscan.camera.controllers.CameraController |
getCameraController()
Gets CameraControllerLegacy used to interact with the device
|
int |
getCameraFPS()
Number of confirmations before validate a result of the decoder.
|
android.content.Context |
getContext()
Get the context.
|
int |
getForcedOrientation()
Gets the forced orientation choose by the user.
|
ch.icare.smartscan.camera.handlers.SmartScannerHandler |
getHandler()
Gets the smartscanner app thread Handler that binds with decoding thread
|
int |
getNumberResultsConfirmation()
Number of confirmations before validate a result of the decoder.
|
android.graphics.Rect |
getRegionOfInterest()
Get current region of interest.
|
java.lang.String |
getTypeSmartscan()
Get the description of the smartscan library used.
|
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 SmartScanner library objects and processes.
|
boolean |
isFlashAvailable()
Checks if flashlight is available on device.
|
boolean |
isForcedOrientationEnabled()
Gets the information about the manual orientation (true/false)
|
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 SmartScanner.
|
void |
restartDecoding()
Restarts the decoding process.
|
void |
setAutoFocusEnabled(boolean isAutoFocusEnabled)
If not already activated we turn on the auto focus.
|
void |
setBeepOn(int beepResId)
Deprecated.
|
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 |
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 |
setOrientationDecoding(boolean forceOrientationEnabled,
int scanOrientation)
Set the new orientation decoding on the device.
|
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 layouts.
|
void |
setVibrateOn(boolean enabled)
Deprecated.
|
void |
setZoomCamera(int zoom)
Set the zoom of the camera.
|
public static final boolean DEBUG
public static final int ID_AUTO_FOCUS
public static final int ID_DECODE
public static final int ID_DECODE_FAILED
public static final int ID_DECODE_SUCCEEDED
public static final int ID_LAUNCH_PRODUCT_QUERY
public static final int ID_QUIT
public static final int ID_RESUME_DECODING
public static final int ID_PAUSE_DECODING
public static final int ID_DEBUG
public static final int ID_VIDEO_REC_START
public static final int ID_VIDEO_REC_STOP
public static final int ID_TAKE_PICTURE
public static final int LEVEL_LIMITED
public static final int LEVEL_FULL
public static final int LEVEL_3
public static final int NO_CAMERA_ID
public static final int DEFAULT_MINIMAL_SCORE
public static final int LANDSCAPE_MODE
public static final int PORTRAIT_MODE
public static final int LANDSCAPE_REVERSE_MODE
public static final int PORTRAIT_REVERSE_MODE
public SmartScanner(android.content.Context context)
context
- Contextpublic SmartScanner(android.content.Context context, int cameraId, int minScoreCameraAPI2)
context
- ContextcameraId
- int (put NO_CAMERA_ID to search all cameras)minScoreCameraAPI2
- Choose the level where switch the new API for the camera
The options are: LEVEL_LIMITED, LEVEL_FULL, LEVEL_3, DEFAULT_MINIMAL_SCORE.
DEFAULT_MINIMAL_SCORE is by default set to LEVEL_LIMITED.public java.lang.String getTypeSmartscan()
public void setOnResultListener(OnDecoderResultFoundListener listener)
public void setOnLoadedListener(OnDecoderLoadedListener listener)
public void setOnErrorListener(OnDecoderErrorListener listener)
public android.content.Context getContext()
public void setContinuousDecoding(boolean isContinuousDecoding)
restartDecoding
. Default is false.isContinuousDecoding
- true if the decoder should decode continuously, false to pause after result@Deprecated public void setBeepOn(int beepResId)
beepResId
- int resource id of the sound file.@Deprecated public void setVibrateOn(boolean enabled)
enabled
- Sets the state of the vibration on the device.public void setFlashEnabled(boolean isFlashEnabled)
isFlashEnabled
- Sets the state of the flash on the device.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.public void setDecodingType(long decodingType, long decodingSubType)
SmartScannerApi2
Bitwise
combinations can be used to specify multiple decoding types.decodingType
- Decoding typedecodingSubType
- Decoding subtypepublic void setRegionOfInterest(android.graphics.Rect rect)
rect
- Rect representation of the region of interestpublic void setTextureView(AutoFitTextureView textureView)
textureView
- AutoFitTextureView view instancepublic void setCanvasDrawer(CanvasDrawerInterface canvasDrawer)
canvasDrawer
- view that implement CanvasDrawerInterfacepublic ch.icare.smartscan.camera.handlers.SmartScannerHandler getHandler()
SmartScannerHandler
public ch.icare.smartscan.camera.controllers.CameraController getCameraController()
CameraController
public java.lang.String getVersion()
public void init()
OnDecoderLoadedListener.onDecoderLoaded(Rect)
occurs.public void release()
public void handleDecoderResult(DecodedResult decodedResult)
OnDecoderResultFoundListener.onResultFound(DecodedResult)
Restarts decoding if continuous decoding is enabled.
This method is called internally.decodedResult
- DecodedResult objectpublic void restartDecoding()
setContinuousDecoding
is false.public void pauseDecoding()
restartDecoding
.public android.graphics.Rect getRegionOfInterest()
public boolean isZoomSupported()
public void setZoomCamera(int zoom)
zoom
- Level of the zoom to set for the camera.public void manualFocus(float x, float y, android.view.View view, boolean isFocusRectangleVisible)
x
- 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)
isAutoFocusEnabled
- Boolean to activate/deactivate the autofocus.public void setOrientationDecoding(boolean forceOrientationEnabled, int scanOrientation)
forceOrientationEnabled
- true if the decoder should decode in manual orientationscanOrientation
- the orientation for decoding.
The options are: LANDSCAPE_MODE, LANDSCAPE_REVERSE_MODE, PORTRAIT_MODE, PORTRAIT_REVERSE_MODEpublic boolean isForcedOrientationEnabled()
public int getForcedOrientation()
public void enableMultipleResultsConfirmation(int numberConfirmations)
numberConfirmations,
- A value between 1 and 10public int getNumberResultsConfirmation()
public int getCameraFPS()