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

The following examples show how to use com.google.zxing.BarcodeFormat#RSS_14 . 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: RSS14Reader.java    From ScreenCapture with MIT License 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      buffer.toString(),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 4
Source File: RSS14Reader.java    From Tesseract-OCR-Scanner with Apache License 2.0 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      buffer.toString(),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 5
Source File: RSS14Reader.java    From QrCodeScanner with GNU General Public License v3.0 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      buffer.toString(),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 6
Source File: RSS14Reader.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      String.valueOf(buffer.toString()),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 7
Source File: RSS14Reader.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      String.valueOf(buffer.toString()),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 8
Source File: RSS14Reader.java    From weex with Apache License 2.0 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      String.valueOf(buffer.toString()),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 9
Source File: RSS14Reader.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      String.valueOf(buffer.toString()),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 10
Source File: RSS14Reader.java    From reacteu-app with MIT License 5 votes vote down vote up
private static Result constructResult(Pair leftPair, Pair rightPair) {
  long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
  String text = String.valueOf(symbolValue);

  StringBuilder buffer = new StringBuilder(14);
  for (int i = 13 - text.length(); i > 0; i--) {
    buffer.append('0');
  }
  buffer.append(text);

  int checkDigit = 0;
  for (int i = 0; i < 13; i++) {
    int digit = buffer.charAt(i) - '0';
    checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;
  }
  checkDigit = 10 - (checkDigit % 10);
  if (checkDigit == 10) {
    checkDigit = 0;
  }
  buffer.append(checkDigit);

  ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
  ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
  return new Result(
      String.valueOf(buffer.toString()),
      null,
      new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
      BarcodeFormat.RSS_14);
}
 
Example 11
Source File: RSS14Reader.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private static Result a(a a1, a a2)
{
    String s = String.valueOf(0x453af5L * (long)a1.getValue() + (long)a2.getValue());
    StringBuilder stringbuilder = new StringBuilder(14);
    for (int j = 13 - s.length(); j > 0; j--)
    {
        stringbuilder.append('0');
    }

    stringbuilder.append(s);
    int k = 0;
    int l = 0;
    for (; k < 13; k++)
    {
        int j1 = -48 + stringbuilder.charAt(k);
        if ((k & 1) == 0)
        {
            j1 *= 3;
        }
        l += j1;
    }

    int i1 = 10 - l % 10;
    if (i1 == 10)
    {
        i1 = 0;
    }
    stringbuilder.append(i1);
    ResultPoint aresultpoint[] = a1.a().getResultPoints();
    ResultPoint aresultpoint1[] = a2.a().getResultPoints();
    String s1 = String.valueOf(stringbuilder.toString());
    ResultPoint aresultpoint2[] = new ResultPoint[4];
    aresultpoint2[0] = aresultpoint[0];
    aresultpoint2[1] = aresultpoint[1];
    aresultpoint2[2] = aresultpoint1[0];
    aresultpoint2[3] = aresultpoint1[1];
    return new Result(s1, null, aresultpoint2, BarcodeFormat.RSS_14);
}
 
Example 12
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;
    }
}