Wiki.js

Function: checkScannerSoftwareVersion

Takes the Stored Information on the ScannerSerialNumber and returns the Software Version, uses the helper function getScannerSoftwareVersionBySerialNumber

checkScannerSoftwareVersion()

Purpose

Determines the software version generation of the currently connected scanner and stores the result in the application state.

The function uses the scanner serial number as the primary source of information. For scanners belonging to the combined R5|R6|R8 hardware family, the Wi-Fi firmware version is used to further distinguish the exact scanner generation.


Location

src/app/services/genericStages/generic-stages.service.ts

Signature

checkScannerSoftwareVersion(
  pipelineConfig: PipelineStageConfig
): OperatorFunction<StatusObject, Observable<any>>

Parameters

Parameter Type Description
pipelineConfig PipelineStageConfig Current pipeline stage configuration containing state, stage configuration, event targets, and helper methods.

Returns

OperatorFunction<StatusObject, Observable<any>>

RxJS operator which determines the scanner software version and stores it in the configured result location.


Required Configuration

The stage configuration must provide:

Property Description
resKey State key where the detected software version will be stored
resGroup State group where the result should be written

Example:

{
  "resKey": "SCANNER_SOFTWARE_VERSION",
  "resGroup": "persistentValues"
}

Workflow

Read SCANNER_SERIAL
        ↓
Determine version via serial number
        ↓
Is result "R5|R6|R8"?
        ↓
       Yes
        ↓
Read wifi_firmware
        ↓
Determine exact version via firmware
        ↓
Store result in state
        ↓
Execute onSuccess

State Dependencies

Reads

state.persistentValues.SCANNER_SERIAL
state.persistentValues.SCANNER_STATUS.wifi_firmware

Writes

state[resGroup][resKey]

Helper Functions Used

getScannerSoftwareVersionBySerialNumber()

Determines the scanner software generation based on the scanner serial number.

Example outputs:

R4
R5
R5|R6|R8
Unknown

getScannerSoftwareVersionByWifiFirmware()

Used only when the serial number identifies the scanner as belonging to the shared R5|R6|R8 family.

The Wi-Fi firmware version is then used to determine the exact hardware/software generation.


Success Behaviour

On successful execution:

  1. The scanner software version is determined.
  2. The result is written to the configured state location.
  3. The configured onSuccess event target is executed.
pipelineConfig.executeStage(
  pipelineConfig.stageConfig.eventTargets?.onSuccess,
  'onSuccess',
  pipelineConfig.stage
);

Failure Behaviour

If either resKey or resGroup is missing:

  1. No version detection is performed.
  2. The configured onFail event target is executed.
  3. The stage returns successfully without modifying the state.
pipelineConfig.executeStage(
  pipelineConfig.stageConfig.eventTargets?.onFail,
  'onFail',
  pipelineConfig.stage
);

Example Result

persistentValues: {
  SCANNER_SOFTWARE_VERSION: "R8"
}

Notes