Class: ImageCaptureControl

ImageCaptureControl()

new ImageCaptureControl()

Methods

addCameraInitializationFailedListener(successCallback, errorCallback, cameraInitializationFailedHandler)

This method would receive the events related to the camera initialization
Parameters:
Name Type Description
successCallback function Default Success Call back function name when the event is registered
errorCallback function Default Error Call back function name
cameraInitializationFailedHandler function a var to hold the camera initialization failed event when it is actually raised
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. cameraInitializationfailedHandler : marker call back to be invoked if camera Initialization is failed. It is recommended to use this callback as place for calling any UI operations on ImageCaptureControl.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function cameraInitializationFailedCallback(){
   alert('cameraInitializationFailed');
}
imgCaptureControl.addCameraInitializationFailedListener(successCallback,errorCallback,cameraInitializationFailedCallback);

addCameraInitializationListener(successCallback, errorCallback, cameraInitializationHandler)

This method would receive the events related to the camera initialization
Parameters:
Name Type Description
successCallback function Default Success Call back function name when the event is registered
errorCallback function Default Error Call back function name
cameraInitializationHandler function a var to hold the camera initialization event when it is actually raised
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. cameraInitializationHandler - marker call back to be invoked after camera Initialization is done. It is recommended to use this callback as place for calling any UI operations on ImageCaptureControl.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function cameraInitializationCallback(){
  alert('cameraInitialization');
}
imgCaptureControl.addCameraInitializationListener(successCallback,errorCallback,cameraInitializationCallback);

addCameraView(successCB:, errorCB:, layoutObject)

Method to add the ImageCaptureControl view to the screen. This method is responsible for adding the view on the visible screen with the specified Layout values.
Parameters:
Name Type Description
successCB: function Default Success Call back function name
errorCB: function Default Error call back function name
layoutObject Object a 'Layout' object mentioning the Frame values for the ImageCaptureControl object. Refer to 'Layout' object for containing values.
Properties
Name Type Attributes Description
x Number <optional>
x position of the image capture control
y Number <optional>
y position of the image capture control
width Number <optional>
width of the image capture control
height Number <optional>
height of the image capture control
visibility Boolean <optional>
image capture control is visible or not
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var Layout = kfxCordova.getLayoutProperties();
Layout.x = 10;
Layout.y =10;
Layout.width= 300;
Layout.height = 400;
Layout.visibility = true; // By default visibility is 'true'

var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.addCameraView(successCallback,errorCallback, Layout);

addFocusListener(successCallback, errorCallback, focusCallback)

This method would receive the AutoFocus at the ImageCaptureControl and the new corresponding details are captured in success call back.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
focusCallback function a var to hold the focus value returned from the ImageCaptureControl
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. By Default, the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. focusCallback - will have the JSON object giving the current focuslevel of the Camera, whenever focus changes the value will be changing.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function focusCallback(){
  alert('focusCallback');
}
imgCaptureControl.addFocusListener(successCallback,errorCallback,focusCallback);

addImageCapturedListener(successCallback, errorCallback, imageCaptureCallback)

A listener that will be called when an image was captured. This will only be sent after the control receives a takePicture message. The control will wait until the desired stability, levelness, and camera adjustments are met and then capture an image. It would then send the imageID of the captured image to success call back method. Add this event listener before calling the 'takePicture' method.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
imageCaptureCallback function A JSON object containing the properties of the captured image object. Check the 'Image' object for its properties.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. imageCaptureCallback - will have the JSON object of the captured KfxKEDImage properties. The captured Image is stored in ImageArray. The image can be retrieved using methods on ImageArray.
Example
function imageCaptureCallback(imageObject)
{
     alert(JSON.stringify(imageObject));
}
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.addImageCapturedListener(successCallback, errorCallback, imageCaptureCallback);

addLevelnessListener(successCallback, errorCallback, levelnessCallback)

This method would receive the levelness at the ImageCaptureControl and the new corresponding details are captured in success call back.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
levelnessCallback function a JSON variable to hold the levelness of device
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. levelnessCallback - JSON object returned for every levelness changed event, and contains the current levelness of the device.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function levelnessCallback(){
  alert('levelnessCallback');
}
imgCaptureControl.addLevelnessListener(successCallback,errorCallback,levelnessCallback);

addStabilityDelayListener(successCallback, errorCallback, stabilityCallback)

This method would receive the Stability delay changed/updated at the ImageCaptureControl and the new corresponding details are captured in success call back.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
stabilityCallback function a JSON object returning the current stability od the device
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. stabilityCallback - will have the current stability of the device.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function stabilityCallback(){
  alert('stabilityCallback');
}
imgCaptureControl.addStabilityDelayListener(successCallback,errorCallback,stabilityCallback);

addTorchLuminanceListener(successCallback, errorCallback, torchLuminanceHandler)

This method would receive the events related to the Torch Luminance level.
Parameters:
Name Type Description
successCallback function Default Success Call back function name when the event is registered
errorCallback function Default Error Call back function name
torchLuminanceHandler function a var to hold the Torch Luminance event when it is actually raised
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. torchLuminanceHandler - marker call back to be invoked when torch luminance level changes.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
function torchLuminanceHandler(Luminance){
  alert('Torch Luminance level'+Luminance.TorchLuminance);
}
imgCaptureControl.addTorchLuminanceListener(successCallback,errorCallback,torchLuminanceHandler);

forceTakePicture(successCallback, errorCallback)

Calling this method will stat the image capture process, but constraints like levelness, stability, and page detection will be ignored. The control will attempt to take a picture as quickly as possible. The event listener "addImageCapturedListener" will receive the delegate call back message and will have the corresponding capture image details.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS The picture was successfully captured for iOS and "OK" for Android errorCallback - KMC_EV_LICENSING The picture was not successfully captured, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.forceTakePicture(successCallback,errorCallback);

forceTakePictureFocusAgain(successCallback, errorCallback, parameters)

Calling this method will start the image capture process, but constraints like levelness, stability, and page detection will be ignored. The control will attempt to take a picture as quickly as possible. The event listener "addImageCapturedListener" will receive the delegate call back message and will have the corresponding capture image details.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object focusAgain flag
Properties
Name Type Attributes Description
focusAgain Boolean <optional>
if set Forces capturing an image after an optional additional autofocus cycle
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS The picture was successfully captured for iOS and "OK" for Android errorCallback - KMC_EV_LICENSING The picture was not successfully captured, and returns the licensing error code.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.forceTakePictureFocusAgain(successCallback,errorCallback, { focusAgain:true });

getAllowableResolutions(successCallback, errorCallback)

Method to get list of resolutions returned, may differ depending on the value of videoFrame in CaptureOptions of ImageCaptureControl. This method should not be called until after the CameraInitializationEvent is fired
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
Returns:
Example
function successCallback(response){
      alert("Success ImageCaptureControl.getAllowableResolutions "+JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}

var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.getAllowableResolutions(successCallback,errorCallback);

getId(successCallback, errorCallback)

Method to get the ID of the created ImageCapture Control The retrieved ID can be used to bind any capture experiences with the ImageCapture Control. This would enhance the way Image Capture Control appears
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - success call back with ImageCapture Control ID errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var imageCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
var imageCaptureControlID = null;
imageCaptureControl.getId(function(success){
    imageCaptureControlID = success;
},function(error){
    alert(JSON.stringify(error));
});

getImageCaptureViewOptions()

Method returning the 'ImageCaptureControl' class properties that can be set by the user. Use this object as an input parameter to set the properties of the ImageCaptureControl class. The parameters are grouped, and has the below mentioned default values.
Example
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
var  imageCaptureViewOptions =  imgCaptureControl.getImageCaptureViewOptions();
imageCaptureViewOptions should be like below {
   LevelingOptions: {
      enabled: true,
      deviceDeclinationPitch: 0,
      deviceDeclinationRoll: 0
   },
   CaptureOptions: {
      FlashMode: "OFF",
      videoFrame: false,
      gpsUsage: true
   }
};

getMaxFocusAreas(successCallback, errorCallback)

Method to get device's maximum number of focusable areas. This method should not be called until after the CameraInitializationEvent is fired
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The maximum number of supported focus areas, or 0 if unsupported errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,JSONException & Exception.
Example
function successCallback(response){
      alert("Success ImageCaptureControl.getMaxFocusAreas "+response);
}
function errorCallback(error){
      alert(JSON.stringify(error));
}

var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.getMaxFocusAreas(successCallback,errorCallback);

getOptions(successCallback, errorCallback)

Method to get the properties of the native ImageCaptureControl class.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - JSONObject representing ImageCaptureControl Options. JSONObject structure can also be known from getImageCaptureViewOptions() method. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,JSONException & Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}

var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.getOptions(successCallback,errorCallback);

removeCameraInitializationFailedListener(successCallback, errorCallback)

The method would remove the listener and would not receive any camera initialization failed events
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeCameraInitializationFailedListener(successCallback,errorCallback);

removeCameraInitializationListener(successCallback, errorCallback)

The method would remove the listener and would not receive any camera initialization events
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeCameraInitializationListener(successCallback,errorCallback);

removeCameraView(successCallback, errorCallback)

Method to remove the ImageCaptureControl view off the screen. This method is responsible for removing and making it nil.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
// Create a ImageCaptureControl object
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeCameraView(successCallback,errorCallback);

removeFocusListener(successCallback, errorCallback)

The method would remove the listener and would not receive the AutoFocus events.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeFocusListener(successCallback,errorCallback);

removeImageCapturedListener(successCallback, errorCallback)

The method would remove the listener to the delegate call back of the takePicture method.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with 'ErrorMs' & 'ErrorDesc' giving the description of the error.
Returns:
The return value is captured in the 'successCallback' function for successful operation.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
// after taking picture
imgCaptureControl.removeImageCapturedListener(successCallback,errorCallback);

removeLevelnessListener(successCallback, errorCallback)

The method would remove the listener and would not receive the Stability delay changed/updated. After removing the listener, there will not be any call backs from native .
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeLevelnessListener(successCallback,errorCallback);

removeStabilityDelayListener(successCallback, errorCallback)

The method would remove the listener and would not receive the Stability delay changed/updated. After removing the listener, there will not be any call backs from native .
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
// Create an ImageCaptureControl obj
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
// to remove the stability listener
imgCaptureControl.removeStabilityDelayListener(successCallback,errorCallback);

removeTorchLuminanceListener(successCallback, errorCallback)

The method would remove the listener and would not receive any Torch Luminance level change events
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error Call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.removeTorchLuminanceListener(successCallback,errorCallback);

setCameraType(successCallback, errorCallback, cameraType)

Method to set the camera type for image capture. The resolution parameter must be one of the strings "FRONT_CAMERA" or "BACK_CAMERA"
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
cameraType String one of the strings representing desired camera type.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
// create the Capture Control Object
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
         ImageCaptureControl.setCameraType(function(sus){
            alert("Success ImageCaptureControl.setCameraType "+JSON.stringify(sus));
         }, function(err){
           alert("Error! ImageCaptureControl.setCameraType "+JSON.stringify(err));
         },{"BACK_CAMERA");

      }, function(error){
       alert("Error! ImageCaptureControl.setCameraType "+JSON.stringify(error));

       });

setFocusAreas(successCallback, errorCallback, parameters)

Method to set the focus areas for the ImageCaptureControl. Before using this API, apps should first call getMaxFocusAreas to know the maximum number of focus areas on Android platform. If the value returned is 0, focus areas is not supported. Focus area bounds have valid values (0,0) to a maximum of (viewWidth, viewHeight) which are then translated to valid Android/iOS focus area coordinates. When a focus area is set that has bounds outside of the view bounds the focus area rectangle will be clamped to the nearest valid view bound. The width and height of focus areas cannot be 0 or negative. Any Rect in the list passed in must follow the left < right, and top < bottom rule or a KmcRuntimeException will be thrown as this is an invalid focus area Rect. A Rect in the list will also need to have a sufficient area to provide the underlying camera autofocus algorithm enough information to focus on that area. Creating a Rect that has width and height that is between 5-10% of the width and height of the preview view size is recommended. When the Rect area is too small it is likely, but this is highly device dependent, that the camera will use the entire view as the focus area. This method should not be called until after the CameraInitializationEvent is fired
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object one of the JSONObject representing desired Focus Areas.
Properties
Name Type Description
focusAreasAndroid Object JSONArray representing list of FocusAreas for ImageCaptureControlon Android platform will be neglected in iOS platform.
focusAreasiOS Object It should be rect representing FocusArea input on iOS platform will be neglected in Android platform.
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,JSONException & Exception.
Example
function successCallback(response){
      alert("Success ImageCaptureControl.getMaxFocusAreas "+response);
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var focusAreaListAndroid = [{x:"10", y:"10", width:" 220", height:"120"}, {x:"160", y:"160", width:" 120", height:"180"}];
var params = {"focusAreasAndroid" : focusAreaListAndroid, "focusAreasiOS":{x:"10", y:"10", width:" 220", height:"120"}};

var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.setFocusAreas(successCallback,errorCallback);

setImageResolution(successCallback, errorCallback, parameters)

Method to set the desired resolution for image capture. The actual resolution of a captured image may be reversed from what is given (e.g. a 960x1280 image may be returned for a 1280x960 request). The resolution parameter must be one of the given resolutions returned from ImageCaptureControl#getAllowableResolutions() on Android platform. The resolution parameter must be one of the AVCaptureSessionPreset(defined by Apple in AVFoundation) input on iOS platform\n.The supported AVCaptureSessionPresetValues are AVCaptureSessionPresetPhoto,AVCaptureSessionPresetHigh, AVCaptureSessionPresetMedium,AVCaptureSessionPresetLow,AVCaptureSessionPreset352x288,AVCaptureSessionPreset640x480,AVCaptureSessionPreset1280x720,AVCaptureSessionPreset1920x1080,AVCaptureSessionPresetiFrame960x540, AVCaptureSessionPresetiFrame1280x720.\n Note:AVCaptureSessionPresetInputPriority preset is not supported. After calling this method, the ImageCaptureView instance may resize itself. This method should not be called until after the CameraInitializationEvent is fired on Android platform.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object one of the JSONObject representing desired resolution.
Properties
Name Type Description
resolutionAndroid Object It should be picked from JSONArray returned for ImageCaptureControl#getAllowableResolutions() on Android platform will be neglected in iOS platform.
resolutioniOS Object It should be one of AVCaptureSessionPreset input on iOS platform will be neglected in Android platform.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
// create the Capture Control Object
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
imgCaptureControl.getAllowableResolutions(function(resolutionArray){
        // here we get all allowable resolutions
       console.log("Success ImageCaptureControl.getAllowableResolutions "+JSON.stringify(resolutionArray));

         ImageCaptureControl.setImageResolution(function(sus){
            alert("Success ImageCaptureControl.setImageResolution "+JSON.stringify(sus));
         }, function(err){
           alert("Error! ImageCaptureControl.setImageResolution "+JSON.stringify(err));
         },{ "resolutionAndroid" : resolutionArray[3], "resolutioniOS":"AVCaptureSessionPresetHigh");

      }, function(error){
       alert("Error! ImageCaptureControl.getAllowableResolutions "+JSON.stringify(error));

       });

setOptions(successCallback, errorCallback, imageCaptureViewOptions)

Method to set the properties of the native ImageCaptureControl class.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
imageCaptureViewOptions Object It is containing the properties to be set to the ImageCaptureControl
Properties
Name Type Description
LevelingOptions Object Level indicator options of the ImageCaptureControl
Properties
Name Type Attributes Default Description
enabled Boolean <optional>
true Whether the level indicator is enabled.A boolean that indicates whether the level indicator is enabled.
deviceDeclinationPitch Number <optional>
0 The reference pitch that indicates what angle means that the device is level. A property to get or set an angle in degrees that will be used to determine that the device is level. The default value is 0, which indicates that the top and bottom of the device are in the same horizontal plane. A positive value indicates that the top of the device should be higher than the bottom for the device to be considered level,and a negative value means that the bottom should be higher.
deviceDeclinationRoll Number <optional>
0 The reference roll that indicates what angle means that the device is level. A property to get or set an angle in degrees that will be used to determine that the device is level. The default value is 0, which indicates that the left and right sides of the device are in the same horizontal plane. A positive value indicates that the left side of the device should be higher than the right for the device to be considered level,and a negative value means that the right side should be higher.
CaptureOptions Object Capturing options of the ImageCaptureControl
Properties
Name Type Attributes Default Description
FlashMode String <optional>
"OFF" The current camera flash mode.A property to get or set the flash mode, with three values: "ON", "OFF", "AUTO","TORCH" and "AUTOTORCH".
videoFrame Boolean <optional>
false Whether the video frame is returned, or a full-resolution image is captured. A boolean that indicates whether the video frame, or a full-resolution image is returned when capture is requested. Using the video frame may speed up image classification, but will result in less accurate results, as there is less image data to work with.
gpsUsage Boolean <optional>
true Gets or sets GPS usage behavior of the control. Calling this with a value of true will cause the control to embed GPS coordinates in the captured image if Location Services are enabled. A value of false will prevent the inclusion of GPS coordinates in captured images, regardless of the availability of Location Services. Defaults to true.
See:
  • Check the 'errorCallback' method for any failures in case of unexpected behaviour of the method. Generally the error call back would return a JSON object with ErrorMsg & ErrorDesc' giving the description of the error. You can understand what parameters we have to pass by go through this options ImageCaptureControl#getImageCaptureViewOptions
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
// create the Capture Control Object
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
var  ImageCaptureViewOptions =  imgCaptureControl.getImageCaptureViewOptions();
// get default options object
var imgCaptureControl =  kfxCordova.kfxUicontrols.createImageCaptureControl();
var  ImageCaptureViewOptions =  imgCaptureControl.getImageCaptureViewOptions();
// specify the values for the Capture view settings/properties
ImageCaptureViewOptions.CaptureOptions.gpsUsage = true;
// set the options to capture view
imgCaptureControl.setOptions(successCallback,errorCallback,ImageCaptureViewOptions)