+ // Manually turn on all formats, even those not yet considered production quality.
+ private static Hashtable<DecodeHintType, Object> buildHints(boolean tryHarder,
+ boolean pureBarcode,
+ boolean productsOnly) {
+ Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(3);
+ Vector<BarcodeFormat> vector = new Vector<BarcodeFormat>(8);
+ vector.addElement(BarcodeFormat.UPC_A);
+ vector.addElement(BarcodeFormat.UPC_E);
+ vector.addElement(BarcodeFormat.EAN_13);
+ vector.addElement(BarcodeFormat.EAN_8);
+ vector.addElement(BarcodeFormat.RSS14);
+ if (!productsOnly) {
+ vector.addElement(BarcodeFormat.CODE_39);
+ vector.addElement(BarcodeFormat.CODE_93);
+ vector.addElement(BarcodeFormat.CODE_128);
+ vector.addElement(BarcodeFormat.ITF);
+ vector.addElement(BarcodeFormat.QR_CODE);
+ vector.addElement(BarcodeFormat.DATAMATRIX);
+ vector.addElement(BarcodeFormat.PDF417);
+ }
+ hints.put(DecodeHintType.POSSIBLE_FORMATS, vector);
+ if (tryHarder) {
+ hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
+ }
+ if (pureBarcode) {
+ hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
+ }
+ return hints;
+ }
+