How to get scanned barcode type using zxing library?

How can I get barcode type using zxing library? The delegate method returns only the barcode in the text.

+4
source share
1 answer

Delegate callback

- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)twoDResult { 

The read property in Decoder.mm is a list of FormatReaders.

 @interface FormatReader : NSObject { zxing::Reader *reader_; } 

The reader_ variable in FormatReader will be a subclass of C ++ zxing :: Reader, e.g. QRCodeReader. Checking this class name will help determine what kind of symbology you get. Beware of some of them, MultiFormat readers, who bring other readers together, so you may need to conduct a circumspect inspection.

See How to get a class name? on how to get class name in C ++.

If you end up making useful changes, be sure to submit the patch to zxing. Good luck

0
source

Source: https://habr.com/ru/post/1338832/


All Articles