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.

Advanced Settings Methods

Method Description
InitRuntimeSettingsWithFile Initialize runtime settings with the settings in a given JSON file.
InitRuntimeSettingsWithString Initialize runtime settings with the settings in a given JSON string.
AppendTplFileToRuntimeSettings Append a new template file to the current runtime settings.
AppendTplStringToRuntimeSettings Append a new template string to the current runtime settings.
GetParameterTemplateCount Get the count of the parameter templates.
GetParameterTemplateName Get the parameter template name by index.
OutputSettingsToFile Output runtime settings to a settings file (JSON file).
OutputSettingsToString Output runtime settings to a string.
OutputSettingsToStringPtr Output runtime settings to a string.
FreeSettingsString Free memory allocated for runtime settings string.

InitRuntimeSettingsWithFile

Initialize runtime settings with the settings in a given JSON file.

int dynamsoft::dbr::CBarcodeReader::InitRuntimeSettingsWithFile (const char* pFilePath, const ConflictMode conflictMode, char errorMsgBuffer[] = NULL, int errorMsgBufferLen = 0)	

Parameters
[in] pFilePath The path of the settings file.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings and replace with the new template.
[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 256. The error message will be copied to the buffer.
[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessage[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessage, 256);
delete reader;

InitRuntimeSettingsWithString

Initialize runtime settings with the settings in a given JSON string.

int dynamsoft::dbr::CBarcodeReader::InitRuntimeSettingsWithString (const char* content, const ConflictMode conflictMode, char errorMsgBuffer[] = NULL, int errorMsgBufferLen = 0)	

Parameters
[in] content A JSON string that represents the content of the settings.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings and replace with the new template.
[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 256. The error message will be copied to the buffer.
[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessage[256];
reader->InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_OVERWRITE, errorMessage, 256);
delete reader;

AppendTplFileToRuntimeSettings

Append a new template file to the current runtime settings.

int dynamsoft::dbr::CBarcodeReader::AppendTplFileToRuntimeSettings (const char* pFilePath, const ConflictMode conflictMode, char errorMsgBuffer[] = NULL, const int errorMsgBufferLen = 0)

Parameters
[in] pFilePath The path of the settings file.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 256. The error message will be copied to the buffer.
[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessage[256];
reader->AppendTplFileToRuntimeSettings("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_IGNORE, errorMessage, 256);
delete reader;

AppendTplStringToRuntimeSettings

Append a new template string to the current runtime settings.

int dynamsoft::dbr::CBarcodeReader::AppendTplStringToRuntimeSettings (const char* content, const ConflictMode conflictMode, char errorMsgBuffer[] = NULL, const int errorMsgBufferLen = 0)	

Parameters
[in] content A JSON string that represents the content of the settings.
[in] conflictMode The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
[in,out] errorMsgBufferOptional The buffer is allocated by caller and the recommended length is 256. The error message will be copied to the buffer.
[in] errorMsgBufferLenOptional The length of the allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessage[256];
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessage, 256);
delete reader;

GetParameterTemplateCount

Gets the count of the parameter templates.

int dynamsoft::dbr::CBarcodeReader::GetParameterTemplateCount ()	

Return Value
Returns the count of parameter template.


Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
int currentTemplateCount = reader->GetParameterTemplateCount();
delete reader;

GetParameterTemplateName

Gets the parameter template name by index.

int dynamsoft::dbr::CBarcodeReader::GetParameterTemplateName (const int index, char nameBuffer[], int nameBufferLen)	

Parameters
[in] index The index of the parameter template array.
[in,out] nameBuffer The buffer is allocated by caller and the recommended nameBufferLen is 256. The template name will be copied to the buffer.
[in] nameBufferLen The length of allocated buffer.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
int currentTemplateCount = reader->GetParameterTemplateCount();
int templateIndex = 1;
// notice that the value of 'templateIndex' should less than currentTemplateCount.
char templateName[256];
reader->GetParameterTemplateName(templateIndex, templateName, 256);
delete reader;

OutputSettingsToFile

Output runtime settings to a settings file (JSON file).

int dynamsoft::dbr::CBarcodeReader::OutputSettingsToFile (const char* pFilePath, const char* pSettingsName)	

Parameters
[in] pFilePath The output file path which stores current settings.
[in] pSettingsName A unique name for declaring current runtime settings.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
reader->OutputSettingsToFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\CurrentRuntimeSettings.json", "currentRuntimeSettings");
delete reader;

OutputSettingsToString

Output runtime settings to a string.

int dynamsoft::dbr::CBarcodeReader::OutputSettingsToString (char content[], const int contentLen, const char* pSettingsName)

Parameters
[in,out] content The output string which stores the contents of current settings.
[in] contentLen The length of the output string.
[in] pSettingsName A unique name for declaring current runtime settings.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
char content[256];
reader->OutputSettingsToString(content, 256, "currentRuntimeSettings");
delete reader;

OutputSettingsToStringPtr

Output runtime settings to a string.

int dynamsoft::dbr::CBarcodeReader::OutputSettingsToStringPtr (char** content, const char* pSettingsName)	

Parameters
[in,out] content The output string which stores the contents of current settings.
[in] pSettingsName A unique name for declaring current runtime settings.

Return Value
Returns error code (returns 0 if the function operates successfully).
You can call GetErrorString to get detailed error message.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
char* content = NULL;
reader->OutputSettingsToStringPtr(&content, "currentRuntimeSettings");
reader->FreeSettingsString(&content);
delete reader;

FreeSettingsString

Free memory allocated for runtime settings string.

void dynamsoft::dbr::CBarcodeReader::FreeSettingsString (char** content	)	

Parameters
[in] content The runtime settings string.

Code Snippet

CBarcodeReader* reader = new CBarcodeReader();
reader->InitLicense("t0260NwAAAHV***************");
char errorMessageInit[256];
char errorMessageAppend[256];
reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessageInit, 256);
reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessageAppend, 256);
char* content = NULL;
reader->OutputSettingsToStringPtr(&content, "currentRuntimeSettings");
reader->FreeSettingsString(&content);
delete reader;

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 8.6.0
  • Version 8.4.0
  • Version 8.2.5
  • Version 8.2.3
  • Version 8.2.1
  • Version 8.2.0
  • Version 8.1.3
  • Version 8.1.2
  • Version 8.1.0
  • Version 8.0.0
  • Version 7.6.0
  • Version 7.5.0
Change +
© 2003–2021 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support