4

In my application, Zbar is decoding perfectly. But the problem is Zbar can decode both QR code and bar code. So after decoding, how do I get the type of Encoding Style?

halfer
  • 19,824
  • 17
  • 99
  • 186
Amitabha
  • 1,664
  • 1
  • 12
  • 30

2 Answers2

4

There are return codes for type in ZBarSymbol. You will be looking for ZBAR_QRCODE for QR codes

ZBarSymbol documentation

Something like this should help you to get the symbol out:

- (void) readerView: (ZBarReaderView*) view didReadSymbols: (ZBarSymbolSet*) syms  fromImage: (UIImage*) img 
{
    //do something useful with results and display resultText in resultViewController
    for(ZBarSymbol *sym in syms) 
    {
        imageResult3.image = img; 
        resultText.text = sym.typeName;
        resultText.text =  [ resultText.text stringByAppendingString:@" - " ];
        resultText.text =  [ resultText.text stringByAppendingString:sym.data ]; 

    }
}
Adam Richardson
  • 2,518
  • 1
  • 27
  • 31
  • Thanks Man.. :-) Now could you tell me how do I get last modification date of that image .. ??? All code tried but no luck .. – Amitabha Sep 03 '13 at 09:22
0

What i did was,

- (void) imagePickerController: (UIImagePickerController*) reader  didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage];
    ZBarImage *zImage = [[ZBarImage alloc] initWithCGImage:image.CGImage];
    ZBarImageScanner *scanner = [[ZBarImageScanner alloc] init];
    [scanner setSymbology: ZBAR_I25
                        config: ZBAR_CFG_ENABLE
                        to: 0];
    [scanner scanImage:zImage];
    ZBarSymbolSet *set = [scanner results];

    ZBarSymbol *symbol = nil;
    for (symbol in set)
        break;
    codeType.text = symbol.typeName
}
Amitabha
  • 1,664
  • 1
  • 12
  • 30