Resource Base
Table of contents

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.
updateSettings() Updates the specified CaptureVisionTemplate with an updated SimplifiedCaptureVisionSettings object.
resetSettings() Restores all runtime settings to their original default values.

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);

See Also

Structure of a Parameter Template File

outputSettings

Returns an object that contains settings for the specified CaptureVisionTemplate.

Syntax

outputSettings(templateName: string): Promise<string>;

Parameters

templateName: specifies a CaptureVisionTemplate by its name. If passed “*”, the returned object will contain all templates.

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): 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: boolean that specifies whether to initiates a JSON file download.

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);
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");

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();

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version(2.2.10)
  • Version 2.x
    • Version 2.0.30
    • Version 2.0.20
    • Version 2.0.10
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support