Simultaneous Barcode Scanning

Enabling Simultaneous Barcode Scanning

The additional barcode scanning will be available for every module.

It is an addition to your implementation of the anyline modules and not a module 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 module view:

Add the AnylineNativeBarcodeDelegate

Add the AnylineNativeBarcodeDelegate to your ViewController. For example add it to an AnylineEnergyModule.

AnylineNativeBarcodeDelegate
@interface ALAnalogMeterScanViewController ()<AnylineEnergyModuleDelegate, 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 AnylineModuleViewController.

Add the Delegate
//set delegate for nativeBarcodeScanning => simultaneus barcode scanning
[self.anylineEnergyView.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.anylineEnergyView.captureDeviceManager removeBarcodeDelegate:self];