Android API Reference - BarcodeReader Parameter and Runtime Settings Advanced 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. |
getAllParameterTemplateNames |
Gets the parameter templates name array. |
outputSettingsToFile |
Output runtime settings to a settings file (JSON file). |
outputSettingsToString |
Output runtime settings to a string. |
setModeArgument |
Set argument value for the specified mode parameter. |
getModeArgument |
Get argument value for the specified mode parameter. |
initRuntimeSettingsWithFile
Initialize runtime settings with the settings in a given JSON file.
void com.dynamsoft.barcode.BarcodeReader.initRuntimeSettingsWithFile(String filePath, int enumConflictMode) throws BarcodeReaderException
Parameters
filePath
: The path of the settings file.
enumConflictMode
: 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.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
reader.initRuntimeSettingsWithFile("your template file path", EnumConflictMode.CM_OVERWRITE);
initRuntimeSettingsWithString
Initialize runtime settings with the settings in a given JSON string.
void com.dynamsoft.barcode.BarcodeReader.initRuntimeSettingsWithString(String content, int enumConflictMode)throws BarcodeReaderException
Parameters
content
: A JSON string that represents the content of the settings.
enumConflictMode
: 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.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
reader.initRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_OVERWRITE);
appendTplFileToRuntimeSettings
Append a new template file to the current runtime settings.
void com.dynamsoft.barcode.BarcodeReader.appendTplFileToRuntimeSettings(String filePath, int enumConflictMode) throws BarcodeReaderException
Parameters
filePath
: The path of the settings file.
enumConflictMode
: The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
reader.appendTplFileToRuntimeSettings("your template file path", EnumConflictMode.CM_IGNORE);
appendTplStringToRuntimeSettings
Append a new template string to the current runtime settings.
void com.dynamsoft.barcode.BarcodeReader.appendTplStringToRuntimeSettings(String content, int enumConflictMode) throws BarcodeReaderException
Parameters
content
: A JSON string that represents the content of the settings.
enumConflictMode
: The parameter setting mode, which decides whether to inherit parameters from previous template setting or to overwrite previous settings with the new template.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
reader.initRuntimeSettingsWithString("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\"], \"ExpectedBarcodesCount\":10}}", EnumConflictMode.CM_OVERWRITE);
reader.appendTplStringToRuntimeSettings("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_OneD\"], \"ExpectedBarcodesCount\":20}}", EnumConflictMode.CM_IGNORE);
getAllParameterTemplateNames
Gets the parameter templates name array.
String [] com.dynamsoft.barcode.BarcodeReader.getAllParameterTemplateNames()
Return value
The template name array.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
String[] templateNames = reader.getAllParameterTemplateNames();
outputSettingsToFile
Output runtime settings to a settings file (JSON file).
void com.dynamsoft.barcode.BarcodeReader.outputSettingsToFile(String filePath, String settingsName) throws BarcodeReaderException
Parameters
filePath
: The output file path which stores current settings.
settingsName
: A unique name for declaring current runtime settings.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
reader.outputSettingsToFile("your saving file path", "currentRuntimeSettings");
outputSettingsToString
Output runtime settings to a string.
String com.dynamsoft.barcode.BarcodeReader.outputSettingsToString(String settingsName) throws BarcodeReaderException
Parameters
settingsName
A unique name for declaring current runtime settings.
Return value
The output string which stores the contents of current settings.
Code Snippet
BarcodeReader reader = new BarcodeReader("t0260NwAAAHV***************");
String settingStr = reader.outputSettingsToString("currentRuntimeSettings");
setModeArgument
Sets the optional argument for a specified mode in Modes parameters.
void setModeArgument(String modesName, int index, String argumentName, String argumentValue) throws BarcodeReaderException
Parameters
modesName
: The mode parameter name to set argument.
index
: The array index of mode parameter to indicate a specific mode.
argumentName
: The name of the argument to set.
argumentValue
: The value of the argument to set.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader();
PublicRuntimeSettings settings = reader.getRuntimeSettings();
settings.binarizationModes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK;
reader.updateRuntimeSettings(settings);
reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1");
Remarks
Check the available modes and arguments below:
BarcodeColourModes
BinarizationModes
ColourClusteringModes
ColourConversionModes
DeformationResistingModes
ImagePreprocessingModes
IntermediateResultSavingMode
LocalizationModes
RegionPredetectionModes
ScaleUpModes
TextFilterModes
TextureDetectionModes
getModeArgument
Gets the optional argument for a specified mode in Modes parameters.
String getModeArgument(String modesName, int index, String argumentName) throws BarcodeReaderException
Parameters
modesName
: The mode parameter name to get argument.
index
: The array index of mode parameter to indicate a specific mode.
argumentName
: The name of the argument to get.
Return Value
the optional argument for a specified mode in Modes parameters.
Exceptions
Code Snippet
BarcodeReader reader = new BarcodeReader();
PublicRuntimeSettings settings = reader.getRuntimeSettings();
settings.binarizationModes[0] = EnumBinarizationMode.BM_LOCAL_BLOCK;
reader.updateRuntimeSettings(settings);
reader.setModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy", "1");
String argumentValue = reader.getModeArgument("BinarizationModes", 0, "EnableFillBinaryVacancy");
Remarks
Check the available modes and arguments below: