Resource Base
Table of contents

iOS API Reference - Regular Camera Methods

You are viewing a history document page of DCE v1.0.3.

Method Description
updateCameraSettingFromJson Update camera filter and focus settings from Json
updateCameraSettingFromFile Update camera filter and focus settings from file
getVersion Check current DCE version
getCameraCurrentState Get camera current state
getCameraDesiredState Get camera desired state
setCameraDesiredState Set Camera on/off
pauseCamera Pause Camera
resumeCamera Resume Camera
startScanning Start scanning
stopScanning Stop scanning
addCameraListener Add camera listener (on preview original, filtered or fast frames)
getTorchCurrentState Get torch current state
getTorchDesiredState Get torch desired state
setTorchDesiredState Set torch state
addTorchListener Add torch listener
getCameraPosition Get current camera position
switchCameraPosition Switch camera position front/back
getResolution Get current resolution setting
setResolution Set resolution

updateCameraSettingFromJson

There are Some detailed settings that can be updated from JSON string or file. View JSON data template and explanation

- (void)updateCameraSettingFromJson:(NSString*)params;

Parameters

The camera setting JSON Strings.

Code Snippet

To update from JSON string:

  • Objective-C
  • Swift
  1. [dce updateCameraSettingFromJson:@"json string"];
    
  2. dce.updateCameraSetting(fromJson: "Your json string")
    

updateCameraSettingFromFile

There are some detailed settings that can be updated from JSON string or file.

- (void)updateCameraSettingFromFile:(NSString*)filePath;

Parameters

The camera setting JSON Strings.

Code Snippet

To update from JSON file:

  • Objective-C
  • Swift
  1. [dce updateCameraSettingFromFile:@"your json file path"];
    
  2. dce.updateCameraSettingFromFile(fromFile: "Your file path")
    

This is the template for updateCameraSettingFromJson and updateCameraSettingFromFile:

{
    //Absolute sharpness value, A threshold value for controlling filter
    "abssharpnessthreshold":200,
    //Sensor value, A threshold value for controlling filter
    "sensorvalue":3,        
    //A threshold value for gray scale analysis
    "graydiffthreshold":30,
    //A threshold for judging whether the device is shaking
    "sharpnessthreshold":0.2,
    //A threshold for judging whether the device is shaking violently
    "sharpnessthresholdlarge":0.4,
    //A threshold value for calculating sharpness
    "absgraythreshold":35,
    //A threshold value for controlling auto zoom
    "conversioncountthreshold":30,
        //A threshold value that controlling auto focus
    "claritythreshold":0.1
}

getVersion

Users can check the current DCE version by using this API.

- (NSString*)getVersion;

Return Value

NSString: The version number.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getVersion];
    
  2. dce.getVersion()
    

getCameraCurrentState

Get the current status (on/off) of the camera.

- (CameraState)getCameraCurrentState NS_SWIFT_NAME(getCameraCurrentState());

Return Value

CameraState: An argument that stands for the camera state. One of the CameraState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getCameraCurrentState];
    
  2. dce.getCameraCurrentState()
    

getCameraDesiredState

Get the desired status (on/off)of the camera.

- (CameraState)getCameraDesiredState NS_SWIFT_NAME(getCameraDesiredState());

Return Value

CameraState: An argument that stands for the camera state. One of the CameraState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getCameraDesiredState];
    
  2. dce.getCameraDesiredState()
    

setCameraDesiredState

Set the camera state.

- (void)setCameraDesiredState:(CameraState)state;

Parameters

CameraState: An argument that stands for the camera state. One of the CameraState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce setCameraDesiredState:CAMERA_STATE_ON];
    
  2. dce.setCameraDesiredState(CAMERA_STATE_ON)
    

pauseCamera and resumeCamera

Note: these APIs are created for pausing & resuming the camera but the camera module is still working when paused. if you want to shut down camera module please use stopScanning.

- (void)resumeCamera NS_SWIFT_NAME(resumeCamera());
- (void)pauseCamera NS_SWIFT_NAME(pauseCamera());

Code Snippet

  • Objective-C
  • Swift
  1. [dce pauseCamera];
    [dce resumeCamera];
    
  2. dce.pauseCamera()
    dce.resumeCamera()
    

stopScanning and startScanning

Control the stopping & starting of the camera module.

- (void)startScanning;
- (void)stopScanning;

Code Snippet

  • Objective-C
  • Swift
  1. [dce startScanning];
    [dce stopScanning];
    
  2. dce.startScanning()
    dce.stopScanning()
    

addCameraListener

Add Camera Listener

- (void)addCameraListener:(id)listener NS_SWIFT_NAME(addCameraListener(_:));

Parameters

Listener: The camera listener.

Code Snippet

  • Objective-C
  • Swift
  1. [dce addCameraListener:self];
    
  2. dce.addCameraListener(self)
    

getTorchCurrentState

Get the current torch state.

- (TorchState)getTorchCurrentState;

Return Value

TorchState: An argument that stands for the torch state. One of the TorchState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getTorchCurrentState];
    
  2. dce.getTorchCurrentState()
    

getTorchDesiredState

Get desired torch state (on/off)

- (TorchState)getTorchDesiredState;

Return Value

TorchState: An argument that stands for the torch state. One of the TorchState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getTorchDesiredState];
    
  2. dce.getTorchDesiredState()
    

setTorchDesiredState

Set the torch on/off.

- (void)setTorchDesiredState:(TorchState)state NS_SWIFT_NAME(setTorchDesiredState(_:));

Return Value

TorchState: An argument that stands for the torch state. One of the TorchState value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce setTorchDesiredState:TorchState.on];
    
  2. dce.setTorchDesiredState(TorchState.on)
    

addTorchListener

Add the torch listener.

- (void)addTorchListener:(id)listener NS_SWIFT_NAME(addTorchListener(_:));

Parameters

Listener: The torch listener.

Code Snippet

  • Objective-C
  • Swift
  1. [dce addTorchListener:self];
    
  2. dce.addTorchListener(self)
    

getCameraPosition

Get the camera position. DCE will use the back camera as default.

- (CameraPosition)getCameraPosition;

Return Value

CameraPosition: An argument that stands for which camera is selected. One of the CameraPosition value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getCameraPosition];
    
  2. dce.getCameraPosition()
    

switchCameraPosition

Change the camera (front/back).

- (void)switchCameraPosition;

Parameters

CameraPosition: An argument that stands for which camera is selected. One of the CameraPosition value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce switchCameraPosition];
    
  2. dce.switchCameraPosition()
    

getResolution

Get the current resolution setting.

- (NSString*)getResolution;

Return Value

NSString: One of the Resolution value.

Code Snippet

  • Objective-C
  • Swift
  1. [dce getResolution];
    
  2. dce.getResolution()
    

setResolution

Set the resolution.

- (void)setResolution:(Resolution)resolution;

Parameters

Resolution: Input one of the Resolution value to set the resolution.

Code Snippet

  • Objective-C
  • Swift
  1. [dce setResolution:RESOLUTION_1080P];
    
  2. dce.setResolution(EnumResolution.EnumRESOLUTION_1080P)
    

Remarks

If the pre-set resolution is unavailable for the current device, the SDK will select the highest available resolution below the pre-set value.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 4.x
    • Version 4.2.0
    • Version 4.0.2
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.0.3
    • Version 3.0.2
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.21
    • Version 2.3.20
    • Version 2.3.12
    • Version 2.3.11
    • Version 2.3.10
    • Version 2.3.5
    • Version 2.3.4
    • Version 2.3.3
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.1
    • Version 2.0.0
Change +