1) create a BOOL (with property) named 'recognize' in the ZXCapture object
2) observe the 'recognize property in - (void) captureOutput.... (see below)
by bracketing the execution of the decode process in ZXCapture:: captureOutput
if(YES == [self recognize]) // this conditional was added to the code
{
if (nil != captureDelegate)
{
ZXDecodeHints* hints = [[[ZXDecodeHints alloc] init] autorelease];
ZXBinaryBitmap* bitmap = [[[ZXBinaryBitmap alloc] initWithBinarizer:binarizer] autorelease];
@try
{
ZXQRCodeReader* reader = [[[ZXQRCodeReader alloc] init] autorelease];
// NSLog(@"started decode");
ZXResult* result = [reader decode:bitmap hints:hints];
// NSLog(@"finished decode");
[captureDelegate captureResult:self result:result];
}
@catch (ZXReaderException* rex)
{
if (![rex.reason isEqualToString:@"Could not find three finder patterns"])
{
// NSLog(@"failed to decode, caught ReaderException '%@'", rex.reason);
}
}
@catch (ZXIllegalArgumentException* iex)
{
// NSLog(@"failed to decode, caught IllegalArgumentException '%@'", iex.reason);
}
@catch (id ue)
{
NSLog(@"Caught unknown exception: %@", ue);
}
}
}
4) Start the ZXingEngine - then enable 'recognize' by a call into the ZXCapture object when it makes sense