Java Code Examples for com.google.zxing.BarcodeFormat#CODE_93

The following examples show how to use com.google.zxing.BarcodeFormat#CODE_93 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZXingDecoder.java    From react-native-barcode with MIT License 5 votes vote down vote up
private static int symbolToFormat(BarcodeFormat symbol) {
    if (BarcodeFormat.AZTEC == symbol) {
        return 225;
    } else if (BarcodeFormat.CODABAR == symbol) {
        return 38;
    } else if (BarcodeFormat.CODE_128 == symbol) {
        return 128;
    } else if (BarcodeFormat.CODE_39 == symbol) {
        return 39;
    } else if (BarcodeFormat.CODE_93 == symbol) {
        return 93;
    } else if (BarcodeFormat.DATA_MATRIX == symbol) {
        return 200;
    } else if (BarcodeFormat.EAN_13 == symbol) {
        return 13;
    } else if (BarcodeFormat.EAN_8 == symbol) {
        return 8;
    } else if (BarcodeFormat.ITF == symbol) {
        return 25;
    } else if (BarcodeFormat.MAXICODE == symbol) {
        return 94;
    } else if (BarcodeFormat.PDF_417 == symbol) {
        return 57;
    } else if (BarcodeFormat.QR_CODE == symbol) {
        return 64;
    } else if (BarcodeFormat.RSS_14 == symbol) {
        return 34;
    } else if (BarcodeFormat.RSS_EXPANDED == symbol) {
        return 35;
    } else if (BarcodeFormat.UPC_A == symbol) {
        return 12;
    } else if (BarcodeFormat.UPC_E == symbol) {
        return 9;
    } else if (BarcodeFormat.UPC_EAN_EXTENSION == symbol) {
        return 15;
    }
    return -1;
}
 
Example 2
Source File: ZXingDecoder.java    From react-native-barcode with MIT License 5 votes vote down vote up
private static BarcodeFormat formatToSymbol(int format) {
    if (225 == format) {
        return BarcodeFormat.AZTEC;
    } else if (38 == format) {
        return BarcodeFormat.CODABAR;
    } else if (128 == format) {
        return BarcodeFormat.CODE_128;
    } else if (39 == format) {
        return BarcodeFormat.CODE_39;
    } else if (93 == format) {
        return BarcodeFormat.CODE_93;
    } else if (200 == format) {
        return BarcodeFormat.DATA_MATRIX;
    } else if (13 == format) {
        return BarcodeFormat.EAN_13;
    } else if (8 == format) {
        return BarcodeFormat.EAN_8;
    } else if (25 == format) {
        return BarcodeFormat.ITF;
    } else if (94 == format) {
        return BarcodeFormat.MAXICODE;
    } else if (57 == format) {
        return BarcodeFormat.PDF_417;
    } else if (64 == format) {
        return BarcodeFormat.QR_CODE;
    } else if (34 == format) {
        return BarcodeFormat.RSS_14;
    } else if (35 == format) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if (12 == format) {
        return BarcodeFormat.UPC_A;
    } else if (9 == format) {
        return BarcodeFormat.UPC_E;
    } else if (15 == format) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    }
    return null;
}
 
Example 3
Source File: Code93Writer.java    From ScreenCapture with MIT License 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 4
Source File: Code93Writer.java    From Tesseract-OCR-Scanner with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 5
Source File: Code93Writer.java    From QrCodeScanner with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 6
Source File: Code93Writer.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 7
Source File: Code93Writer.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 8
Source File: Code93Writer.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_93) {
    throw new IllegalArgumentException("Can only encode CODE_93, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
Example 9
Source File: RCTCameraViewFinder.java    From react-native-camera-face-detector with MIT License 4 votes vote down vote up
/**
 * Parse barcodes as BarcodeFormat constants.
 *
 * Supports all iOS codes except [code39mod43, itf14]
 *
 * Additionally supports [codabar, maxicode, rss14, rssexpanded, upca, upceanextension]
 */
private BarcodeFormat parseBarCodeString(String c) {
    if ("aztec".equals(c)) {
        return BarcodeFormat.AZTEC;
    } else if ("ean13".equals(c)) {
        return BarcodeFormat.EAN_13;
    } else if ("ean8".equals(c)) {
        return BarcodeFormat.EAN_8;
    } else if ("qr".equals(c)) {
        return BarcodeFormat.QR_CODE;
    } else if ("pdf417".equals(c)) {
        return BarcodeFormat.PDF_417;
    } else if ("upce".equals(c)) {
        return BarcodeFormat.UPC_E;
    } else if ("datamatrix".equals(c)) {
        return BarcodeFormat.DATA_MATRIX;
    } else if ("code39".equals(c)) {
        return BarcodeFormat.CODE_39;
    } else if ("code93".equals(c)) {
        return BarcodeFormat.CODE_93;
    } else if ("interleaved2of5".equals(c)) {
        return BarcodeFormat.ITF;
    } else if ("codabar".equals(c)) {
        return BarcodeFormat.CODABAR;
    } else if ("code128".equals(c)) {
        return BarcodeFormat.CODE_128;
    } else if ("maxicode".equals(c)) {
        return BarcodeFormat.MAXICODE;
    } else if ("rss14".equals(c)) {
        return BarcodeFormat.RSS_14;
    } else if ("rssexpanded".equals(c)) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if ("upca".equals(c)) {
        return BarcodeFormat.UPC_A;
    } else if ("upceanextension".equals(c)) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    } else {
        android.util.Log.v("RCTCamera", "Unsupported code.. [" + c + "]");
        return null;
    }
}
 
Example 10
Source File: Code93Reader.java    From reacteu-app with MIT License 4 votes vote down vote up
@Override
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
    throws NotFoundException, ChecksumException, FormatException {

  int[] start = findAsteriskPattern(row);
  // Read off white space    
  int nextStart = row.getNextSet(start[1]);
  int end = row.getSize();

  StringBuilder result = new StringBuilder(20);
  int[] counters = new int[6];
  char decodedChar;
  int lastStart;
  do {
    recordPattern(row, nextStart, counters);
    int pattern = toPattern(counters);
    if (pattern < 0) {
      throw NotFoundException.getNotFoundInstance();
    }
    decodedChar = patternToChar(pattern);
    result.append(decodedChar);
    lastStart = nextStart;
    for (int counter : counters) {
      nextStart += counter;
    }
    // Read off white space
    nextStart = row.getNextSet(nextStart);
  } while (decodedChar != '*');
  result.deleteCharAt(result.length() - 1); // remove asterisk

  // Should be at least one more black module
  if (nextStart == end || !row.get(nextStart)) {
    throw NotFoundException.getNotFoundInstance();
  }

  if (result.length() < 2) {
    // false positive -- need at least 2 checksum digits
    throw NotFoundException.getNotFoundInstance();
  }

  checkChecksums(result);
  // Remove checksum digits
  result.setLength(result.length() - 2);

  String resultString = decodeExtended(result);

  float left = (float) (start[1] + start[0]) / 2.0f;
  float right = (float) (nextStart + lastStart) / 2.0f;
  return new Result(
      resultString,
      null,
      new ResultPoint[]{
          new ResultPoint(left, (float) rowNumber),
          new ResultPoint(right, (float) rowNumber)},
      BarcodeFormat.CODE_93);

}
 
Example 11
Source File: Code93Reader.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public Result decodeRow(int i, BitArray bitarray, Map map)
{
    int ai[] = a(bitarray);
    int j = bitarray.getNextSet(ai[1]);
    int k = bitarray.getSize();
    StringBuilder stringbuilder = new StringBuilder(20);
    int ai1[] = new int[6];
    do
    {
        recordPattern(bitarray, j, ai1);
        int l = a(ai1);
        if (l < 0)
        {
            throw NotFoundException.getNotFoundInstance();
        }
        char c1 = a(l);
        stringbuilder.append(c1);
        int i1 = ai1.length;
        int j1 = 0;
        int k1 = j;
        for (; j1 < i1; j1++)
        {
            k1 += ai1[j1];
        }

        int l1 = bitarray.getNextSet(k1);
        if (c1 == '*')
        {
            stringbuilder.deleteCharAt(-1 + stringbuilder.length());
            if (l1 == k || !bitarray.get(l1))
            {
                throw NotFoundException.getNotFoundInstance();
            }
            if (stringbuilder.length() < 2)
            {
                throw NotFoundException.getNotFoundInstance();
            } else
            {
                b(stringbuilder);
                stringbuilder.setLength(-2 + stringbuilder.length());
                String s = a(stringbuilder);
                float f = (float)(ai[1] + ai[0]) / 2.0F;
                float f1 = (float)(j + l1) / 2.0F;
                ResultPoint aresultpoint[] = new ResultPoint[2];
                aresultpoint[0] = new ResultPoint(f, i);
                aresultpoint[1] = new ResultPoint(f1, i);
                return new Result(s, null, aresultpoint, BarcodeFormat.CODE_93);
            }
        }
        j = l1;
    } while (true);
}