Added Code 39 check digit hint
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Wed, 4 Nov 2009 22:00:27 +0000 (22:00 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Wed, 4 Nov 2009 22:00:27 +0000 (22:00 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1098 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/src/com/google/zxing/DecodeHintType.java
core/src/com/google/zxing/oned/MultiFormatOneDReader.java

index 4b51e23..21a4de0 100644 (file)
@@ -57,6 +57,11 @@ public final class DecodeHintType {
    */
   public static final DecodeHintType ALLOWED_LENGTHS = new DecodeHintType();
 
+  /**
+   * Assume Code 39 codes employ a check digit. Maps to {@link Boolean}.
+   */
+  public static final DecodeHintType ASSUME_CODE_39_CHECK_DIGIT = new DecodeHintType();
+
   private DecodeHintType() {
   }
 
index ea0d197..c22437b 100644 (file)
@@ -35,6 +35,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader {
 
   public MultiFormatOneDReader(Hashtable hints) {
     Vector possibleFormats = hints == null ? null : (Vector) hints.get(DecodeHintType.POSSIBLE_FORMATS);
+    boolean useCode39CheckDigit = hints != null && hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
     readers = new Vector();
     if (possibleFormats != null) {
       if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
@@ -44,7 +45,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader {
         readers.addElement(new MultiFormatUPCEANReader(hints));
       }
       if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
-        readers.addElement(new Code39Reader());
+        readers.addElement(new Code39Reader(useCode39CheckDigit));
       }
       if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
         readers.addElement(new Code128Reader());