public abstract class ScanTrustCameraManager extends Object
This class can be directly used to manage the camera, but for consumer facing apps, it is recommended to use the controller classes that wrap this one and manage a smooth scanning experience. It should be instantiated in the creation phase of your screen.
Handling:
It is up to the user to determine when to start and stop the camera or the processing. But in general the camera is started in Activity.onResume()
and released in Activity.onPause()
.
Modifier and Type | Class and Description |
---|---|
static class |
ScanTrustCameraManager.Builder
Builder class for the camera manager
|
static interface |
ScanTrustCameraManager.ManagerCallback
Callback interface for the camera events.
|
Constructor and Description |
---|
ScanTrustCameraManager() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
checkCodePositioning(QRCodeData data)
Checks if the code is centered in the image
|
abstract void |
doAutoFocus(float motionX,
float motionY,
int viewWidth,
int viewHeight)
Triggers the camera's auto-focus on the provided touch location.
|
abstract void |
doZoomIn(Handler zoomHandler)
Performs the automatic zooming-in if the camera is not already zoomed-in.
|
static CameraApiVersion |
getPreferredCameraApi(Activity activity)
Provides the version of the camera api that will be used for the current phone.
|
abstract <T extends View> |
getPreviewView()
Returns the View that was created by the manager and on which the camera preview is drawn.
|
abstract boolean |
isZoomedOut()
Is the camera zoomed-out
|
abstract void |
pauseProcessing()
Pauses the ScanTrust frame processing.
|
abstract void |
releaseCamera()
Stops the ScanTrust frame processing, stops the preview and releases the underlying camera object.
|
abstract void |
resetAuthParams()
Reset the authentication parameters.
|
abstract void |
resetZoom()
Resets the "zoom-in" flow (i.e.
|
abstract void |
restartProcessing()
Restarts the ScanTrust frame processing.
|
abstract void |
setAuthParams(int blurThresholdBias)
Pass the custom settings to the underlying processor
|
abstract void |
setAuthScanning(boolean scanForAuthentication)
Triggers the processing for the authentication, as opposed to the processing for the content of the codes.
|
abstract void |
setCameraTorchModeOnOff(boolean turnOn)
Turns the torch on or off depending on the value of turnOn.
|
abstract void |
setScalingFactor(int physicalSize)
Sets the scaling factor for the QR detection according to the given code physical size.
|
abstract void |
startCamera()
Starts the underlying camera object, its preview and starts the ScanTrust frame processing once the setup is done.
|
public abstract void doZoomIn(Handler zoomHandler)
zoomHandler
- A handler to be notified when the zoom-in is finished.public abstract boolean checkCodePositioning(QRCodeData data)
data
- The code's datapublic abstract void setScalingFactor(int physicalSize)
physicalSize
- the code size in 10^-4 mpublic abstract void restartProcessing()
public abstract void pauseProcessing()
public abstract void startCamera()
public abstract void releaseCamera()
public abstract void setCameraTorchModeOnOff(boolean turnOn)
turnOn
- true to turn the torch onpublic abstract void resetZoom()
public abstract void setAuthScanning(boolean scanForAuthentication)
scanForAuthentication
- True to start the authentication processingpublic abstract boolean isZoomedOut()
public abstract void doAutoFocus(float motionX, float motionY, int viewWidth, int viewHeight)
View.OnTouchListener.onTouch(View, MotionEvent)
The view's dimensions are required to map the touch to the sensor's space.motionX
- The x touch locationmotionY
- The y touch locationviewWidth
- The view's widthviewHeight
- The views' heightpublic abstract <T extends View> T getPreviewView()
T
- a subclass of View
public abstract void setAuthParams(int blurThresholdBias)
blurThresholdBias
- the blur thresholdpublic abstract void resetAuthParams()
public static CameraApiVersion getPreferredCameraApi(Activity activity) throws CameraAccessException
activity
- An activity to access the Context.CAMERA_SERVICE
CameraApiVersion
.CameraAccessException
- if something went wrong