Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Objective-C API Reference - Video Methods


startFrameDecoding

Starts a new thread to decode barcodes from the inner frame queue.

-(void)startFrameDecoding:(NSInteger)maxQueueLength
            maxResultQueueLength:(NSInteger)maxResultQueueLength
            width:(NSInteger)width
            height:(NSInteger)height
            stride:(NSInteger)stride
            format:(EnumImagePixelFormat)format
            templateName:(NSString* _Nonnull)templateName
            error:(NSError* _Nullable * _Nullable)error;

Parameters

[in] maxQueueLength The max number of frames waiting for decoding.
[in] maxResultQueueLength The max number of frames whose results (text result/localization result) will be kept.
[in] width The width of the frame image in pixels.
[in] height The height of the frame image in pixels.
[in] stride The stride (or scan width) of the frame image.
[in] format The image pixel format used in the image byte array.
[in] templateName The template name.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
NSError __autoreleasing * _Nullable error;
[barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let error: NSError? = NSError()
barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:&error)

startFrameDecodingEx

Start a new thread to decode barcodes from the inner frame queue with specific frame decoding setting defined in iFrameDecodingParameters struct.

-(void)startFrameDecodingEx:(iFrameDecodingParameters* _Nullable) parameters
                templateName:(NSString* _Nonnull)templateName
                    error:(NSError* _Nullable __autoreleasing* _Nullable)error;

Parameters

[in] parameters The frame decoding parameters.
[in] templateName The template name.
[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
NSError __autoreleasing * _Nullable error;
iFrameDecodingParameters *parameters = [barcodeReader getFrameDecodingParameters:nil];
parameters.maxQueueLength = 2;
parameters.maxResultQueueLength = 10;
parameters.width = 1024;
parameters.height = 720;
parameters.stride = 720;
parameters.imagePixelFormat = EnumImagePixelFormatBinary;
[barcodeReader startFrameDecodingEx:parameters templateName:@"" error:&error];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let error: NSError? = NSError()
let parameters = barcodeReader.getFrameDecodingParameters
parameters?.maxQueueLength = 2
parameters?.maxResultQueueLength = 10
parameters?.width = 1024
parameters?.height = 720
parameters?.stride = 720
parameters?.imagePixelFormat = EnumImagePixelFormat.Binary
barcodeReader.StartFrameDecodingEx(parameter: parameters!, templateName: "", error: &error)

appendFrame

Appends a frame image buffer to the inner frame queue.

-(NSInteger)appendFrame:(NSData* _Nullable) bufferBytes;

Parameters

[in] bufferBytes The array of bytes which contain the image data.

Return value

Returns the ID of the appended frame.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
NSError __autoreleasing * _Nullable error;
[barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];
NSInteger frameId = [barcodeReader appendFrame:bufferBytes];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let error: NSError? = NSError()
barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:&error)
let frameId = barcodeReader.appendFrame(bufferBytes:bufferBytes)

stopFrameDecoding

Stops the frame decoding thread created by startFrameDecoding or startFrameDecodingEx.

-(void)stopFrameDecoding:(NSError* _Nullable * _Nullable)error;

Parameters

[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
NSError __autoreleasing * _Nullable error;
[barcodeReader startFrameDecoding:2 maxResultQueueLength:10 width:1024 height:720 stride:720 format:EnumImagePixelFormatBinary templateName:@"" error:&error];
[barcodeReader stopFrameDecoding:&error];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let error: NSError? = NSError()
barcodeReader.startFrameDecoding(maxQueueLength:2, maxResultQueueLength:10, width:1024, height:720, stride:720, format:EnumImagePixelFormat.Binary, templateName:"", error:nil)
barcodeReader.stopFrameDecoding(error:&error)

getFrameDecodingParameters

Initialize frame decoding parameters with default values.

-(iFrameDecodingParameters*_Nullable)getFrameDecodingParameters:(NSError* _Nullable * _Nullable)error;

Parameters

[in,out] error Input a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return value

Returns frame decoding parameters.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
iFrameDecodingParameters *parameters = [barcodeReader getFrameDecodingParameters:nil];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let parameters = barcodeReader.getFrameDecodingParameters(error: nil)

setDBRErrorDelegate

Sets callback function to process errors generated during frame decoding.

-(void)setDBRErrorDelegate:(id _Nullable)errorDelegate userData:(NSObject* _Nullable)userData;

Parameters

[in] errorDelegate Callback function.
[in] userData Customized arguments passed to your function.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
[barcodeReader setDBRErrorDelegate:self userData:nil];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
barcodeReader.setDBRErrorDelegate(errorDelegate:self, userData:nil)

setDBRTextResultDelegate

Set callback function to process text results generated during frame decoding.

-(void)setDBRTextResultDelegate:(id _Nullable)textResultDelegate userData:(NSObject* _Nullable)userData;

Parameters

[in] textResultDelegate Callback function.
[in] userDataCustomized arguments passed to your function.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
[barcodeReader setDBRTextResultDelegate:self userData:nil];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
barcodeReader.setDBRTextResultDelegate(textResultDelegate:self, userData:nil)

setDBRIntermediateResultDelegate

Set callback function to process intermediate results generated during frame decoding.

-(void)setDBRIntermediateResultDelegate:(id _Nullable)intermediateResultDelegate userData:(NSObject* _Nullable)userData;	

Parameters

[in] intermediateResultDelegate Callback function.
[in] userData Customized arguments passed to your function.

Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
[barcodeReader setDBRIntermediateResultDelegate:self userData:nil];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
barcodeReader.setDBRIntermediateResultDelegate(intermediateResultDelegate:self, userData:nil)

getLengthOfFrameQueue

Get length of current inner frame queue.

-(NSInteger)getLengthOfFrameQueue;

Return value

Returns the length of the inner frame queue.


Code Snippet

Objective-C:

DynamsoftBarcodeReader *barcodeReader;
iDMDLSConnectionParameters* lts = [[iDMDLSConnectionParameters alloc] init];
lts.organizationID = @"200001";
lts.sessionPassword = @"******";
barcodeReader = [[DynamsoftBarcodeReader alloc] initLicenseFromDLS:lts verificationDelegate:self];
- (void)DLSLicenseVerificationCallback:(bool)isSuccess error:(NSError * _Nullable)error
{
        //TODO add your code for license verification
}
NSInteger length = [barcodeReader getLengthOfFrameQueue];

Swift:

let lts = iDMDLSConnectionParameters()
lts.organizationID = "200001"
lts.sessionPassword = "******"
let barcodeReader = DynamsoftBarcodeReader(licenseFromDLS: dls, verificationDelegate: self)
func DLSLicenseVerificationCallback(_ isSuccess: Bool, error: Error?)
{
    print("isSucc : \(isSuccess) error : \(String(describing: error))")
}
let length = barcodeReader.getLengthOfFrameQueue()

This page is compatible for:

Version 7.5

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest Version
  • version 8.4
  • version 8.2.5
  • version 8.2
  • version 8.1.2
  • version 8.0
  • version 7.6
  • version 7.5
Change +
© 2003–2021 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support