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.

Interface IDCVBarcodeReader

A barcode reader object accesses to a camera via DCVCameraView object at native level, then perform continuous barcode scanning on the incoming frames.

interface IDCVBarcodeReader
Method Description
InitLicense Initialize the license of the Dynamsoft Barcode Reader module.
GetVersion Get the version of DCVBarcodeReader, which is packaged in Dynamsoft Capture Vision.
GetRuntimeSettings Get the current runtime settings of DCVBarcodeReader.
UpdateRuntimeSettings (DBRRuntimeSettings) Update the barcode decoding settings with a DBRRuntimeSettings struct.
UpdateRuntimeSettings (EnumDBRPresetTemplate) Update the barcode decoding settings with a preset template (from the EnumDBRPresetTemplate items).
UpdateRuntimeSettings (String) Update the barcode decoding settings with a JSON String.
ResetRuntimeSettings Reset the runtime settings of DCVBarcodeReader to default.
OutputRuntimeSettingsToString Output the runtime settings of DCVBarcodeReader to string.
StartScanning Start the barcode decoding thread.
StopScanning Stop the barcode decoding thread.
SetCameraEnhancer Set camera enhancer as the source of video stream. The library will be able to continuously obtain video frames from the camera enhancer when this method is triggered.
AddResultListener Specifies an event handler that fires after the library finishes scanning a frame.
MinImageReadingInterval MinImageReadingInterval indicates the minimum interval between two barcode decoding.
EnableResultVerification Enable Result Verification feature to improve the accuracy of barcode results for video streaming barcode decoding.
EnableDuplicateFilter Enable Duplicate Filter feature to filter out the duplicate results in the period of duplicateForgetTime for video barcode decoding.
DuplicateForgetTime Set/get the period of duplicateForgetTime, Default value is 3000(ms).

InitLicense

Initialize the license of Dynamsoft Capture Vision - Barcode Reader module.

void InitLicense(string licenseKey, ILicenseVerificationListener listener)

Parameters

licenseKey: A license key.

Code Snippet

public partial class DBRRendererPage : ContentPage, ILicenseVerificationListener
{
    public DBRRendererPage()
    {
        App.barcodeReader.InitLicense("Put your license key here.", this);
        ...
    }
    ...
    public void ILicenseVerificationListener.LicenseVerificationCallback(bool isSuccess, string msg)
    {
        if (!isSuccess) 
        {
            Console.WriteLine(msg);
        }
    }
}

GetVersion

Get the version of DCVBarcodeReader, which is packaged in Dynamsoft Capture Vision.

string GetVersion()

Return Value

The Version of DCVBarcodeReader.

GetRuntimeSettings

Get the current runtime settings of DCVBarcodeReader.

DBRRuntimeSettings GetRuntimeSettings()

Return Value

An object of DBRRuntimeSettings that stores the runtime settings.

Code Snippet

DBRRuntimeSettings settings = App.barcodeReader.GetRuntimeSettings();
settings.BarcodeFormatIds = EnumBarcodeFormat.BF_CODE_128 | EnumBarcodeFormat.BF_QR_CODE;
settings.ExpectedBarcodeCount = 0;
settings.Timeout = 300;
try 
{
    App.barcodeReader.UpdateRuntimeSettings(settings);
}
catch(DCVException ex)
{
    Console.WriteLine("Exception caught: ", ex.Message);
}

UpdateRuntimeSettings(DBRRuntimeSettings)

Update the barcode decoding settings with a DBRRuntimeSettings struct.

void UpdateRuntimeSettings(DBRRuntimeSettings settings)

Parameters

settings: An object that stores DBRRuntimeSettings.

Code Snippet

/* How to update runtime settings using the runtime settings object */
DBRRuntimeSettings settings = App.barcodeReader.GetRuntimeSettings();
settings.BarcodeFormatIds = EnumBarcodeFormat.BF_CODE_128 | EnumBarcodeFormat.BF_QR_CODE;
settings.ExpectedBarcodeCount = 0;
settings.Timeout = 300;
try 
{
    App.barcodeReader.UpdateRuntimeSettings(settings);
}
catch(DCVException ex)
{
    Console.WriteLine("Exception caught: ", ex.Message);
}

UpdateRuntimeSettings(EnumPresetTemplate)

Update the barcode decoding settings with a preset template (from the EnumDBRPresetTemplate items).

void UpdateRuntimeSettings(EnumDBRPresetTemplate)

Parameters

settings: One of the EnumDBRPresetTemplate member that indicates a preset template.

Code Snippet

/* How to update using one of the preset templates */
App.barcodeReader.UpdateRuntimeSettings(EnumDBRPresetTemplate.VIDEO_SINGLE_BARCODE);

UpdateRuntimeSettings(String)

Update the barcode decoding settings with a JSON String.

void UpdateRuntimeSettings(String template) 

Parameters

settings: A stringified JSON data that contains barcode decoding settings. The available settings include but not limited in DBRRuntimeSettings. You can access full feature of DBR when upload the settings from a JSON data.

Code Snippet

/* How to update the settings using a JSON string */
try 
{
    App.barcodeReader.UpdateRuntimeSettings("{\"ImageParameter\":{\"BarcodeFormatIds\":[\"BF_ALL\"],\"BarcodeFormatIds_2\":null,\"DeblurLevel\":0,\"ExpectedBarcodesCount\":0,\"LocalizationModes\":[{\"Mode\":\"LM_SCAN_DIRECTLY\",\"ScanDirection\":1},{\"Mode\":\"LM_CONNECTED_BLOCKS\"}],\"Name\":\"video-speed-first\",\"ScaleDownThreshold\":2300,\"Timeout\":500},\"Version\":\"3.0\"}");
}
catch(DCVException ex)
{
    Console.WriteLine("Exception caught: ", ex.Message);
}

ResetRuntimeSettings

Reset the barcode decoding settings to default value.

void ResetRuntimeSettings()

OutputRuntimeSettingsToString

Output the barcode decoding settings to string.

string OutputRuntimeSettingsToString()

Return Value

A string that stores the barcode decoding settings. The barcode settings string can be applied to debug barcode decoding settings.

StartScanning

Start the barcode decoding thread.

void StartScanning()

StopScanning

Stop the barcode decoding thread.

void StopScanning()

SetCameraEnhancer

Set camera enhancer as the source of video stream. The library will be able to continuously obtain video frames from the camera enhancer when this method is triggered.

void SetCameraEnhancer(IDCVCameraEnhancer dce);

Parameters

dce: An instance of IDCVCameraEnhancer.

Code Snippet

App.dbr.SetCameraEnhancer(App.dce);

AddResultListener

Specifies an event handler that fires after the library finishes scanning a frame.

void AddResultlistener(IBarcodeResultListener listener)

Code Snippet

The following code snippet shows how to use barcode reader module to decode from video stream.

// Add IBarcodeResultListener to your page class
public partial class DBRRendererPage : ContentPage, IBarcodeResultListener
{
    public DBRRendererPage()
    {
        // Add the result listener so that you can receive the barcode results from the BarcodeResultCallback.
        App.barcodeReader.AddResultListener(this);
        // You have to set camera enhancer as the video source to decode from video stream.
        App.barcodeReader.SetCameraEnhancer();
        ...
    }
    ...
    protected override void OnAppearing()
    {
        base.OnAppearing();
        // Open the camera.
        App.camera.Open();
        // Start the barcode decoding thread.
        App.barcodeReader.StartScanning();
    }

    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        App.camera.Close();
        App.barcodeReader.StopScanning();
    }
    public void BarcodeResultCallback(BarcodeResult[] barcodeResults)
    {
        // Add your code to execute here when barcode results are received.
    }
}

MinImageReadingInterval

MinImageReadingInterval indicates the minimum interval between two barcode decoding.

int MinImageReadingInterval { get; set; }

Code Snippet

App.dbr.EnableResultVerification = true;

EnableResultVerification

Enable Result Verification feature to improve the accuracy of barcode results for video streaming barcode decoding.

Note: Result verification feature only effects on the OneD barcode results that are decoded from the video streaming.

bool EnableResultVerification { get; set; }

Code Snippet

App.dbr.EnableResultVerification = true;

EnableDuplicateFilter

Enable Duplicate Filter feature to filter out the duplicate results in the period of duplicateForgetTime for video barcode decoding. Barcode results with the same BarcodeText and BarcodeFormatString will be returned only once during the period. The default value of duplicateForgetTime is 3000ms.

bool EnableDuplicateFilter { get; set; }

Code Snippet

App.dbr.DuplicateForgetTime = 1000;
App.dbr.EnableDuplicateFilter = true;

DuplicateForgetTime

Set/get the period of duplicateForgetTime, Default value is 3000(ms). View EnableDuplicateFilter for more information.

int DuplicateForgetTime { get; set; }

Code Snippet

App.dbr.DuplicateForgetTime = 1000;
App.dbr.EnableDuplicateFilter = true;

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 2.x
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
    • Version 1.x
      • Version 1.2.1
      • Version 1.2.0
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
      • Version 1.1.11
      • Version 1.1.9
      • Version 1.1.8
      • Version 1.1.7
      • Version 1.1.6
      • Version 1.1.5
      • Version 1.1.4
      • Version 1.1.3
      • Version 1.1.2
      • Version 1.1.1
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support