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 hex keyword is used, expectText is interpreted as a hex string.

extractText

Regular expression to extract (uses RE2 Syntax, except \C)

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 ("500ms") or in milliseconds (default: 30s)

RDTPxx/DDTPxx

Optional trigger pin to initiate scanning. Only RDTP and DDTP probes are supported as trigger signals.

kind

Trigger kind: active (assert the level before scanning, release afterward), pulse (assert the level for triggerDuration, then release, before scanning starts), or none (no signal is driven).

level

Trigger level: high or low. Required for pulse; optional for active (defaults to low if omitted); not used for none.

triggerDuration

Pulse duration, e.g. 100ms or a plain integer number of milliseconds (pulse only; default: 100ms).

At most one trigger: entry may be given under with:.

Supported format values:

format

Description

ANY

Any barcode payload; the result is the raw scanned text.

MAC_ADDRESS

Requires the scanned payload to be a 48-bit MAC address in XX:XX:XX:XX:XX:XX form (17 characters, hex octets separated by colons); fails otherwise. On success, also records the value as the DUT’s BLE MAC address in the report.

(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