Barcode Xpress Mobile for iOS
|
The BarcodeXpressIOS exposes a full objective-c API and the BXInterface defined in it provides the core functionality for programs that want to perform barcode recognition on video images. The following steps illustrate the approach to take to integrate the BXInterface into another app:
// Create and initialize a BXLicense.
// Note that the newlines (\n) at the end of each line of the license key are required.
// Note that the values for parameters key1, key2, key3 and key4 are currently unused.
BXLicense* license = [[BXLicense alloc]
initWithData:@"A/2R0LQRQeRHHaen+bqwcggdbB7kDTDCCzU/P3GtiXQlnr0byBOCQW+5FPoBG/O4\n"
"2hVmCcxrZr4zBuUmFgsw64jJFhKsRtUqjdvWzqyJY2guYfZNhswtgziXZZm6n/rb\n"
"gv9pKn9pLFWmXk579SjZw7ZFDD3wWJM1XzyeW5VbAuw=\n"
mainBundle:[NSBundle mainBundle]
key1:1 key2:2 key3:3 key4:4 ];
// Initialize the interface to the decoding library.
barcodeXpress = [[BXInterface alloc] initWithLicense:license];
[license release];
// Define the callbacks that allow program control to be altered at key points.
[barcodeXpress SetCameraCallback :self :@selector(onCameraUpdate:)];
[barcodeXpress SetRecognitionCallback :self :@selector(onBarcodeRecognition:)];
[barcodeXpress SetProcessingCallback :self :@selector(onProcessingBarcode:)];
// Create a layer that will display preview imagery from the camera.
AVCaptureVideoPreviewLayer *previewLayer = [[AVCaptureVideoPreviewLayer alloc] init];
// Define the types of barcodes to decode.
// See BarcodeXpressIOS.h for definitions of barcode types.
[barcodeXpress SetBarcodeTypes : AllBarcodeTypes];
// Configure the camera and start processing video frames.
[barcodeXpress StartRecognition :previewLayer];