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
[dce updateCameraSettingFromJson:@"json string"];
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
[dce updateCameraSettingFromFile:@"your json file path"];
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
[dce getVersion];
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
[dce getCameraCurrentState];
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
[dce getCameraDesiredState];
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
[dce setCameraDesiredState:CAMERA_STATE_ON];
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
[dce pauseCamera]; [dce resumeCamera];
dce.pauseCamera() dce.resumeCamera()
stopScanning and startScanning
Control the stopping & starting of the camera module.
- (void)startScanning;
- (void)stopScanning;
Code Snippet
- Objective-C
- Swift
[dce startScanning]; [dce stopScanning];
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
[dce addCameraListener:self];
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
[dce getTorchCurrentState];
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
[dce getTorchDesiredState];
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
[dce setTorchDesiredState:TorchState.on];
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
[dce addTorchListener:self];
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
[dce getCameraPosition];
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
[dce switchCameraPosition];
dce.switchCameraPosition()
getResolution
Get the current resolution setting.
- (NSString*)getResolution;
Return Value
NSString
: One of the Resolution
value.
Code Snippet
- Objective-C
- Swift
[dce getResolution];
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
[dce setResolution:RESOLUTION_1080P];
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.