Dev Center
Table of contents

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	char errorMessage[256];
	reader->InitRuntimeSettingsWithFile("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_OVERWRITE, errorMessage, 256);
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	char errorMessage[256];
	reader->InitRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_OVERWRITE, errorMessage, 256);
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	char errorMessage[256];
	reader->AppendTplFileToRuntimeSettings("C:\\Program Files (x86)\\Dynamsoft\\{Version number}\\Templates\\RuntimeSettings.json", CM_IGNORE, errorMessage, 256);
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	char errorMessage[256];
	reader->AppendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", CM_IGNORE, errorMessage, 256);
    // add further process
    reader->Recycle();
}

GetParameterTemplateCount

Gets the count of the parameter templates.

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

Return Value
Returns the count of parameter template.


Code Snippet

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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();
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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);
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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");
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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");
    // add further process
    reader->Recycle();
}

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

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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);
    // add further process
    reader->Recycle();
}

FreeSettingsString

Free memory allocated for runtime settings string.

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

Parameters
[in] content The runtime settings string.

Code Snippet

char errorBuf[512];
dynamsoft::dbr::CBarcodeReader::InitLicense("YOUR-LICENSE-KEY", errorBuf, 512);
CBarcodeReader* reader = CBarcodeReader::GetInstance();
if(reader != NULL)
{
	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);
    // add further process
    reader->Recycle();
}

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +