Simultaneous Barcode Scanning

Enabling Simultaneous Barcode Scanning

The additional barcode scanning will be available for every plugin.

It is an addition to your implementation of the anyline plugins and not a plugin on it’s own.

In order to enable and use the simultaneous barcode scanning you have to add the following three steps to your Anyline scanView:

Add the AnylineNativeBarcodeDelegate

Add the AnylineNativeBarcodeDelegate to your ViewController. For example add it to Anyline MeterPlugins.

AnylineNativeBarcodeDelegate
@interface ALAutoAnalogDigitalMeterScanViewController ()<ALMeterScanPluginDelegate, AnylineNativeBarcodeDelegate>

Implement the Delegate Methods

The next step is to implement the delegate methods for the AnylineNativeBarcodeDelegate.

Delegate Methods
#pragma mark - AnylineNativeBarcodeDelegate methods
/*
    An additional delegate which will add all found, and unique, barcodes to a Dictionary simultaneously.
*/
- (void)anylineCaptureDeviceManager:(ALCaptureDeviceManager *)captureDeviceManager
               didFindBarcodeResult:(NSString *)scanResult
                               type:(NSString *)barcodeType {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (![self.barcodeResults objectForKey:scanResult]) {
            [self.barcodeResults setObject:barcodeType forKey:scanResult];
        }

    });
}

Add the Delegate

The final step is to set the delegate for the Anyline captureDeviceManager of your Anyline ScanView.

Add the Delegate
//set delegate for nativeBarcodeScanning => simultaneous barcode scanning
[self.scanView.captureDeviceManager addBarcodeDelegate:self];

Disabling Simultaneous Barcode Scanning

The simultaneous barcode scanning is disabled by default, so you just need to disable it, if you have enabled it and decide to stop it.

Disable Scanning
//to stop the barcodeScanning just remove the delegate
[self.scanView.captureDeviceManager removeBarcodeDelegate:self];