Composite Scanning
Composite scanning allows you to set up a workflow where multiple items need to be scanned.
A ViewPluginComposite is a special type of ScanViewPlugin that holds any number of "child" ScanViewPlugins. There are three processing modes available in a plugin composite: sequential, parallel, and parallelFirstScan:
-
In sequential mode, the plugin composite runs each child plugin sequentially in the order they were added. As each plugin gets a result, the next plugin is started.
-
In parallel mode, cutouts for each child plugin are initially displayed simultaneously. As a plugin gets a result, its cutout is hidden so that the user can concentrate on scanning the remaining items. For instance, you can set up a parallel scan configuration consisting of an electric meter together with a barcode. As soon as the last child plugin has scanned successfully, the results for each child scan view plugin are combined and returned as a group.
-
The parallelFirstScan mode operates similar to parallel mode, displaying cutouts for all child plugins initially. However, scanning will complete upon getting the first scan result it sees and returning its value.
Nesting plugin composites is currently not supported. In other words, a ViewPluginComposite cannot include another ViewPluginComposite as a child view plugin. |
With a composite view plugin running in parallel mode, cutouts and visual feedback for all running child plugins are shown at the same time on the scan view. It’s a good idea to individually configure each child plugin so that it is visually distinct from all the others. For instance, in a workflow in which multiple cutouts are simultaneously displayed on the scan view, you could adjust the cutouts so that they do not overlap each other, or, if they do overlap, adjust the appearance of the scan feedback in order for it to be clear to the user which scan feedback comes from which plugin. |
ViewPluginComposite
ViewPluginComposite
is the class that represents a view plugin composite. Each composite consists of:
-
the composite’s plugin ID
-
the processing mode, parallel, sequential, or parallelFirstScan
-
a list of children view plugins
Configuring a plugin composite with JSON
A JSON configuration for a plugin composite looks like this:
{
"viewPluginCompositeConfig": {
"id": "parallel_composite_scanning",
"processingMode": "sequential",
"viewPlugins": [
{
"viewPluginConfig": {
"pluginConfig": {
"id": "licensePlate",
"licensePlateConfig": {
"scanMode": "auto"
}
}
},
"viewPluginConfig": {
"pluginConfig": {
"id": "vin",
"vinConfig": { }
}
}
}
]
}
}
-
viewPluginCompositeConfig
should be the root node of the JSON config. -
processingMode
should be eithersequential
,parallel
, orparallelFirstScan
, depending on the operating mode desired. -
id
should be a valid keyword string and is a required field. -
viewPlugins
is an array where theviewPluginConfig
JSON bodies of each child plugin is listed.
Reading the result
With composite plugins, once all the results have been scanned, the AllResultsReceived
event is fired, providing a list of ScanResult
found for each child plugin, in the order in which they were scanned.
(In a composite with the parallelFirstScan
processing mode, this result is only for the first plugin successfully scanned, and nothing else.)