Class BarcodeFormat
java.lang.Object
com.codename1.ai.vision.BarcodeFormat
The normalized symbology names Barcode.getFormat() reports, as
constants instead of literals. Every backend maps its own vendor identifier
onto one of these before the result reaches application code, and reports
UNKNOWN for a symbology outside this set.
scanner.process(VisionImage.encoded(jpeg)).ready(codes -> {
for (Barcode code : codes) {
if (BarcodeFormat.matches(code, BarcodeFormat.QR_CODE)) {
Log.p("QR: " + code.getValue());
} else if (BarcodeFormat.matches(code, BarcodeFormat.EAN_13,
BarcodeFormat.UPC_A)) {
lookUpProduct(code.getValue());
}
}
});
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAztec two-dimensional code, common on transit tickets.static final StringCodabar linear code, used by libraries and blood banks.static final StringCode 128 linear code, the usual choice for shipping labels.static final StringCode 39 linear code.static final StringCode 93 linear code.static final StringData Matrix two-dimensional code, common on small parts.static final StringEAN-13 retail product code.static final StringEAN-8 retail product code.static final StringInterleaved 2 of 5 linear code.static final StringPDF417 stacked code, used by driving licences and boarding passes.static final StringQR code.static final StringReported when the backend decoded a code whose symbology has no portable name here.static final StringUPC-A retail product code.static final StringUPC-E retail product code. -
Method Summary
-
Field Details
-
AZTEC
-
CODABAR
Codabar linear code, used by libraries and blood banks.- See Also:
-
CODE_39
-
CODE_93
-
CODE_128
Code 128 linear code, the usual choice for shipping labels.- See Also:
-
DATA_MATRIX
Data Matrix two-dimensional code, common on small parts.- See Also:
-
EAN_8
-
EAN_13
-
ITF
-
PDF417
PDF417 stacked code, used by driving licences and boarding passes.- See Also:
-
QR_CODE
-
UPC_A
-
UPC_E
-
UNKNOWN
Reported when the backend decoded a code whose symbology has no portable name here.- See Also:
-
-
Method Details
-
matches
Tests a decoded barcode against a set of accepted formats. An empty ornullformat list accepts every symbology, which is what a general-purpose scanner wants.- Parameters:
barcode- observation to test, ornullformats- accepted format constants- Returns:
truewhen the barcode's format is one offormats
-