Question

I have an app that should be able to scan a lot of QR Codes in few minutes. So it has to be reactive. I use ZBarSDK and I am satisfied with it.

When data are received by the delegate with processScannedData:(NSString *)scannedData, I present a message that has to be manually dismissed. To be fast, I lock the focus at this distance by interacting with the AVCaptureDevice assuming that next QR Codes will be presented at the same distance.

This system works pretty well except in one situation : When I present my message after a scan, I don't stop the camera to avoid losing the focus I have just locked to. If you present the next QR Code below before dismissing the message, my processScannedData:(NSString *)scannedData delegate method will catch it and ignore the data as expected. The only problem is that if you dismiss the message at that point (keeping the camera above the QR Code), data won't be received but the delegate method has already been fired, you will be forced to look for a few seconds at another point and then come back to your QR Code.

So here is my question : is it possible to tell ZBar that I don't want him to fire the delegate method until I explicitly tell him to do so ? Is it possible to stop processing data without stopping the camera ?

Thank you for your help

Was it helpful?

Solution

I initially thought that the ZBarSDK configuration couldn't be modified while the camera was working, but it actually can.

One can then simply use :

- (void)disableQRCodeDetection
{
    // disabling all symbols detection for performance reasons
    [self.scanner setSymbology: 0
                        config: ZBAR_CFG_ENABLE
                            to: 0];
}

- (void)enableQRCodeDetection
{
    // We enable QR Code detection
    [self.scanner setSymbology: ZBAR_QRCODE
                        config: ZBAR_CFG_ENABLE
                            to: 1];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top