CaptureVisionRouter Settings
| Name | Description |
|---|---|
| initSettings() | Configures runtime settings using a provided JSON string, an object, or a URL pointing to an object, which contains settings for one or more CaptureVisionTemplates. |
| outputSettings() | Outputs a CaptureVisionTemplate specified by its name. |
| outputSettingsToFile | Generates a Blob object or initiates a JSON file download containing the settings for the specified CaptureVisionTemplate. |
| getSimplifiedSettings() | Retrieves a JSON object that contains simplified settings for the specified CaptureVisionTemplate. |
| getTemplateNames() | Retrieves the names of all the currently available templates. |
| updateSettings() | Updates the specified CaptureVisionTemplate with an updated SimplifiedCaptureVisionSettings object. |
| resetSettings() | Restores all runtime settings to their original default values. |
| switchCapturingTemplate() | Switches the currently active capturing template during the image processing workflow. |
initSettings
Configures runtime settings using a provided JSON string, an object, or a URL pointing to an object, which contains settings for one or more CaptureVisionTemplates.
Syntax
initSettings(settings: string | object): Promise<any>;
Parameters
settings: A JSON string, an object, or a URL pointing to an object that contains settings for one or more CaptureVisionTemplates.
Return value
A promise that resolves when the operation has completed. It provides an object that describes the result.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const settings = {
"CaptureVisionTemplates": [
{
"Name": "ReadSingleBarcode",
"ImageROIProcessingNameArray": ["roi-read-single-barcode"]
}
],
"TargetROIDefOptions": [
{
"Name": "roi-read-single-barcode",
"TaskSettingNameArray": ["task-read-single-barcode"]
}
],
"BarcodeReaderTaskSettingOptions": [
{
"Name": "task-read-single-barcode"
}
]
};
await router.initSettings(settings);
// Later in the code, specify the name of the template to use (e.g., "ReadSingleBarcode" in the sample template).
router.startCapturing("NAME-OF-TEMPLATE-TO-USE");
See Also
Structure of a Parameter Template File
outputSettings
Returns an object that contains settings for the specified CaptureVisionTemplate.
Syntax
outputSettings(templateName: string, includeDefaultValues?: boolean): Promise<string>;
Parameters
templateName: specifies a CaptureVisionTemplate by its name. If passed “*”, the returned object will contain all templates.
includeDefaultValues (optional): Boolean that specifies whether to include default values the output. Default to False.
Return value
A promise that resolves with the object that contains settings for the specified template or all templates.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const settings = await router.outputSettings("ReadSingleBarcode");
console.log(settings);
outputSettingsToFile
Generates a Blob object or initiates a JSON file download containing the settings for the specified CaptureVisionTemplate.
Syntax
outputSettingsToFile(templateName: string, fileName: string, download?: boolean, includeDefaultValues?: boolean): Promise<Blob>;
Parameters
templateName: specifies a CaptureVisionTemplate by its name. If passed “*”, the returned object will contain all templates.
fileName: specifies the name of the file.
download (optional): boolean that specifies whether to initiates a JSON file download.
includeDefaultValues (optional): Boolean that specifies whether to include default values the output. Default to False.
Return value
A promise that resolves with the Blob object that contains settings for the specified template or all templates.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const settings = await router.outputSettingsToFile("ReadSingleBarcode", "read-single-file", true, true);
console.log(settings);
getSimplifiedSettings
Retrieves a JSON object that contains simplified settings for the specified CaptureVisionTemplate.
Syntax
getSimplifiedSettings(templateName: string): Promise<SimplifiedCaptureVisionSettings>;
Parameters
templateName: specifies a CaptureVisionTemplate by its name.
Return Value
A promise that resolves with a JSON object, of type SimplifiedCaptureVisionSettings, which represents the simplified settings for the specified template.
Remarks: If the settings of the specified template are too complex, we cannot create a SimplifiedCaptureVisionSettings, and as a result, it will return an error.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
settings = await router.getSimplifiedSettings("ReadSingleBarcode");
getTemplateNames
Retrieves the names of all the currently available templates.
Syntax
getTemplateNames(): Promise<Array<string>>;;
Return Value
A promise that resolves with an array of string, which represents the names of currently available templates
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
let template_names = await router.getTemplateNames();
updateSettings
Updates the specified CaptureVisionTemplate with an updated SimplifiedCaptureVisionSettings object.
Syntax
updateSettings(templateName: string, settings: SimplifiedCaptureVisionSettings): Promise<any>;
Parameters
templateName: specifies a CaptureVisionTemplate by its name.
settings: the SimplifiedCaptureVisionSettings object that contains updated settings.
Return value
A promise that resolves when the operation has completed. It provides an object that describes the result.
Code snippet
let settings = await router.getSimplifiedSettings("ReadSingleBarcode");
settings.barcodeSettings.barcodeFormatIds =
Dynamsoft.DBR.EnumBarcodeFormat.BF_QR_CODE;
await router.updateSettings("ReadSingleBarcode", settings);
await router.startCapturing("ReadSingleBarcode");
resetSettings
Restores all runtime settings to their original default values.
Syntax
resetSettings(): Promise<any>;
Parameters
None
Return Value
A promise that resolves when the operation has completed. It provides an object that describes the result.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
await router.resetSettings();
switchCapturingTemplate
Switches the currently active capturing template during the image processing workflow. This allows dynamic reconfiguration of the capture process without restarting or reinitializing the system, enabling different settings or rules to be applied on the fly.
Syntax
switchCapturingTemplate(templateName: string): Promise<void>;
Parameters
templateName: The name of the new capturing template to apply.
Return Value
A promise that resolves when the operation has completed.
Code snippet
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
await router.startCapturing("ReadSingleBarcode");
// Switching to ReadRateFirst template
await router.switchCapturingTemplate("ReadBarcodes_ReadRateFirst");
Remarks
Introduced in Dynamsoft Barcode Reader Bundle version 11.2.2000 and Dynamsoft Capture Vision Bundle version 3.2.2000.