From 6a09746399486b3a50b065ea2ea51394e6770ae3 Mon Sep 17 00:00:00 2001 From: BD <51322242+dalferth@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:11:11 +0100 Subject: [PATCH] added code39 extended mode decode hint --- src/core/DecodeHintType.ts | 6 ++++++ src/core/oned/MultiFormatOneDReader.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/DecodeHintType.ts b/src/core/DecodeHintType.ts index e07470fe..40145127 100644 --- a/src/core/DecodeHintType.ts +++ b/src/core/DecodeHintType.ts @@ -66,6 +66,12 @@ enum DecodeHintType { */ ASSUME_CODE_39_CHECK_DIGIT/*(Void.class)*/, + /** + * Enable extended mode for Code 39 codes. Doesn't matter what it maps to; + * use {@link Boolean#TRUE}. + */ + ENABLE_CODE_39_EXTENDED_MODE/*(Void.class)*/, + /** * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed. * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to; diff --git a/src/core/oned/MultiFormatOneDReader.ts b/src/core/oned/MultiFormatOneDReader.ts index 1aa4371d..7ce03af0 100644 --- a/src/core/oned/MultiFormatOneDReader.ts +++ b/src/core/oned/MultiFormatOneDReader.ts @@ -43,6 +43,7 @@ export default class MultiFormatOneDReader extends OneDReader { super(); const possibleFormats = !hints ? null : hints.get(DecodeHintType.POSSIBLE_FORMATS); const useCode39CheckDigit = hints && hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) !== undefined; + const useCode39ExtendedMode = hints && hints.get(DecodeHintType.ENABLE_CODE_39_EXTENDED_MODE) !== undefined; if (possibleFormats) { if (possibleFormats.includes(BarcodeFormat.EAN_13) || @@ -52,7 +53,7 @@ export default class MultiFormatOneDReader extends OneDReader { this.readers.push(new MultiFormatUPCEANReader(hints)); } if (possibleFormats.includes(BarcodeFormat.CODE_39)) { - this.readers.push(new Code39Reader(useCode39CheckDigit)); + this.readers.push(new Code39Reader(useCode39CheckDigit, useCode39ExtendedMode)); } if (possibleFormats.includes(BarcodeFormat.CODE_93)) { this.readers.push(new Code93Reader());