public interface

SecIrisCallback

com.sec.biometric.iris.SecIrisCallback

This interface is deprecated.
Deprecated since v1.1. No replacement

Class Overview

Used by ISV apps to intercept iris capturing events.

Note: Callbacks will not be running in UI thread. So you will have to switch context to ui thread for doing any ui updation.

Summary

Public Methods
abstract void onCaptureFailed(int errorcode)
Callback for indicating capture failure.
abstract void onCaptureSuccess()
Callback for indicating successful capture.
abstract void onEyeInfoUiHints(String eyeDist, String eyeOpen)
Callback to provide feedback regarding the iris image being captured.
abstract void onTimeOut()
Callback for indicating that the image capture did not complete within the specific time frame.
abstract void showPreviewFrame(byte[] bytesPreview, int w, int h, int rotation)
Callback for giving the preview images to the app.

Public Methods

public abstract void onCaptureFailed (int errorcode)

Callback for indicating capture failure.

Parameters
errorcode error code for the failure.

public abstract void onCaptureSuccess ()

Callback for indicating successful capture.

public abstract void onEyeInfoUiHints (String eyeDist, String eyeOpen)

Callback to provide feedback regarding the iris image being captured. Based on this, the third-party-app can give necessary feedback to the user.

Parameters
eyeDist approximate distance between the eye and the IR camera.
eyeOpen indicates whether the eye is open or closed.
Usage

A third party ISV app can implement this callback to give feedbacks to the user regarding wether camera needs to be moved near to person whose iris is being captured, wether his eyes has to be opened further etc. The feedback values given in EyeOpen are "Open Eyes" or "Open Eyes Wider".

     private String mEyeDist;
     private String mEyeOpen;    
     public void onEyeInfoUiHints(String EyeDist, String EyeOpen) {
         mEyeOpen = EyeOpen;
         mEyeDist = EyeDist;
         mHandler.post(new Runnable() {
             public void run() {
                 int eye_distance = Integer.valueOf(mEyeDist);
                 String eye_open = mEyeOpen;
                 {
                     if (eye_distance < 16 && eye_distance > 0) {
                         preview.setBackgroundResource(R.drawable.red_single);
                     } else if (eye_distance >= 16 && eye_distance < 25) {
                         preview.setBackgroundResource(R.drawable.green);
                     }
                     
                     if (eye_open == "Open Eyes") {
                         //DO ACTION
                     } else if (eye_open == "Open Eyes Wider") {
                        //DO ACTION
                     }
                 }
             }
         });
     }
 

public abstract void onTimeOut ()

Callback for indicating that the image capture did not complete within the specific time frame. Currently timeout value is set at 30 seconds.

public abstract void showPreviewFrame (byte[] bytesPreview, int w, int h, int rotation)

Callback for giving the preview images to the app.

Parameters
bytesPreview bitmap byte array to be used for preview.
w width of the preview bitmap.
h width of the preview bitmap.
rotation degree of rotation at which the image is captured.
Usage

A third party ISV app can implement this callback to display the preview image. A probable usage to show preview is as below where R.id.preview is a surface view created by app.


     private int mRotation;
     private byte[] mBytesData;
     public void showPreviewFrame(byte[] bytesPreview, int w, int h, int rotation) {
         mBytesData = bytesPreview;
         mRotation = rotation;
         final int width = w;
         final int height = h;
         mHandler.post(new Runnable() {
             public void run() {
                 SurfaceView preview = (SurfaceView) findViewById(R.id.preview);
                 Paint circlePaint = null, reflectPaint = null, bitmapPaint = null;
                 int[] pixelsPreview = null;
                 if (pixelsPreview == null) {
                     pixelsPreview = new int[width * height];
                 }
                 for (int i = 0; i < pixelsPreview.length; i++) {
                     final int index = mRotation > 90 ? pixelsPreview.length - i - 1 : i;
                     int p = (mBytesData[index] & 0xff);
                     pixelsPreview[i] = p | (p << 8) | (p << 16) | 0xff000000;
                 }
                 SurfaceHolder holder = preview.getHolder();
                 Canvas canvas = null;
                 try {
                     canvas = holder.lockCanvas();
                     if (canvas != null) {
                         if (mRotation == 90) {
                             canvas.scale(canvas.getWidth() * 1.0f / height, -canvas.getHeight() * 1.0f / width);
                             canvas.rotate(90);
                             canvas.translate(-width, -height);
                         } else {
                             canvas.scale(canvas.getWidth() * 1.0f / width, canvas.getHeight() * 1.0f / height);
                         }
                         if (bitmapPaint == null) {
                             bitmapPaint = new Paint(Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG);
                             bitmapPaint.setColor(0xff40d0ff);
                             bitmapPaint.setStyle(Paint.Style.STROKE);
                             bitmapPaint.setStrokeWidth(1f);
                             circlePaint = new Paint(bitmapPaint);
                             circlePaint.setColor(0x8040d0ff);
                             reflectPaint = new Paint(bitmapPaint);
                             reflectPaint.setColor(0xffff0000);
                         }
                         System.gc();
                         canvas.drawColor(Color.TRANSPARENT, android.graphics.PorterDuff.Mode.CLEAR);
                         canvas.drawBitmap(pixelsPreview, 0, width, 0, 0, width, height, true, bitmapPaint);
                     }
                 } finally {
                     if (canvas != null) {
                         holder.unlockCanvasAndPost(canvas);
                     }
                 }
             }
         });
     }