scan - Scan Barcode
Scan a barcode using USB-attached barcode scanner.
Usage:
- command: scan [<format>]
[expect: [hex] <expectText>]
[extract: <extractText>]
[extractKey: <key>...]
[retry: <retryCount>]
[timeout: <timeout>]
[with:
[- trigger:<DDTPxx|RDTPxx> <kind> <level> [<triggerDuration>]]
Argument |
Description |
|---|---|
format |
Format of code to scan (optional as of pltOS v2.0.30) |
expectText |
Text to expect in the barcode. If the |
extractText |
Regular expression to extract (uses RE2 Syntax, except |
key |
Key(s) in which to store extracted text. To save multiple values, use multiple capture groups. |
retryCount |
Number of times to retry the test step (optional) |
timeout |
Timeout, with time suffix ( |
RDTPxx/DDTPxx |
Optional trigger pin to initiate scanning. Only RDTP and DDTP probes are supported as trigger signals. |
kind |
Trigger kind: |
level |
Trigger level: |
triggerDuration |
Pulse duration, e.g. |
At most one trigger: entry may be given under with:.
Supported format values:
format |
Description |
|---|---|
|
Any barcode payload; the result is the raw scanned text. |
|
Requires the scanned payload to be a 48-bit MAC address in
|
(omitted) |
No format check. The raw payload is matched against expect (if given) and/or parsed with extract (if given). |
title: "Scan serial number"
suite:
- steps:
- command: scan ANY
extractKey: MY_BARCODE
- command: serial set %MY_BARCODE%
title: "Scan barcode with expected substring"
suite:
- steps:
- command: scan
# "MN-004137-01EN"
expect: "MN-"
extractKey: BARCODE_EXPECTED
title: "Scan barcode and extract multiple values"
suite:
- steps:
- command: scan
# "MN-004137-01EN"
extract: "^MN-(\\d+)-(\\d+.*)$"
extractKey: NUM SUFFIX
See also