Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added code39 extended mode decode hint #591

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/core/DecodeHintType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/core/oned/MultiFormatOneDReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class MultiFormatOneDReader extends OneDReader {
super();
const possibleFormats = !hints ? null : <BarcodeFormat[]>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) ||
Expand All @@ -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());
Expand Down