Barcode Xpress Mobile for iOS
 All Classes Functions Variables Properties Pages
BXInterface Class Reference

Interface that manages access to the camera, executes callbacks, and executes Barcode Xpress library functions to perform recognition operations on imagery gathered from the camera. More...

#import <BarcodeXpressIOS.h>

Inheritance diagram for BXInterface:

Instance Methods

(id) - init
 Initialize. More...
 
(id) - initWithLicense:
 Initialize with a license (required). More...
 
(void) - StartRecognition
 Initializes the video camera interface, and starts the process of gathering images from the video camera and sending them to the Barcode Xpress library for recognition.
 
(void) - StopRecognition
 Stop the process of gathering images from the video camera and sending them to the Barcode Xpress library for recognition. More...
 
(void) - PauseRecognition
 Pause recognition by no longer sending images to the Barcode Xpress recognition library. More...
 
(void) - ResumeRecognition
 Resume sending images to the Barcode Xpress recognition library. More...
 
(void) - SetCameraCallback::
 Set the callback which will be executed each time an image is captured from the video camera. More...
 
(void) - SetRecognitionCallback::
 Set the callback which will be executed each time the Barcode Xpress recognition library has found a barcode in an image, or has encountered an error. More...
 
(void) - SetProcessingCallback::
 Set the callback which will be executed each time a thread begins to process an image captured from the video camera. More...
 
(enum Status) - RecognizeImage:result:
 Look for a barcode in a UIImage and decode it. More...
 
(enum Status) - RecognizeImage:width:height:bpp:stride:result:
 Look for a barcode in an image and, if found, return the decoded value. More...
 
(const char *) - ReportVersion
 Report the version of the recognition library. More...
 
(long) - SetBarcodeTypes:
 Set the barcode types that can be recognized in an image. More...
 
(CGSize) - GetCameraResolution
 Return the camera resolution being used, in pixels. More...
 
(void) - ClearNumProcessedFrames
 Clears the counter that keeps track of the number of frames sent for processing since the last time a barcode was found, or since the object was instantiated, whichever is most recent.
 
(long) - GetNumProcessedFrames
 Gets a count of the number of frames sent for processing since the last time a barcode was found, or since the object was instantiated, whichever is most recent. More...
 
(AVCaptureSession *) - GetCaptureSession
 Return a reference to the video capture session. More...
 

Class Methods

(UIImage *) + binarizeUIImage:
 Perform thresholding on an image and return a version of it that has been reduced to 1 bit per pixel. More...
 
(const char *) + BarcodeTypeToString:
 Get a character string that corresponds to the name of the enumerated barcode type. More...
 

Detailed Description

Interface that manages access to the camera, executes callbacks, and executes Barcode Xpress library functions to perform recognition operations on imagery gathered from the camera.

Defines the iOS interface used by the Software Development Kit for Barcode Xpress.

This interface manages the camera, obtaining images from it and processing them with the Accusoft Barcode Xpress recognition library. The recognition results are made available via callbacks. Other callbacks provide copies of the images as soon as they are captured, and also before they are dispatched to a processing thread. These callbacks allow your application to easily interact with the capture-recognize-report cycle.

Method Documentation

+ (const char *) BarcodeTypeToString: (enum BarcodeTypes)  barcodeType

Get a character string that corresponds to the name of the enumerated barcode type.

Parameters
barcodeTypeA value of type enum BarcodeTypes (see top of this file for definition of the enum values).
Returns
A character string containing the name of the barcode type.
+ (UIImage *) binarizeUIImage: (UIImage*)  inImage

Perform thresholding on an image and return a version of it that has been reduced to 1 bit per pixel.

Parameters
inImageA UIImage that will used as the source to create another UIImage that is black/white with a 1 bit per pixel depth.
Returns
A thresholded black/white version of the input image.
- (CGSize) GetCameraResolution

Return the camera resolution being used, in pixels.

This may differ from the camera's actual resolution.

Returns
A CGSize struct containing the width and height of the resolution.
- (AVCaptureSession *) GetCaptureSession

Return a reference to the video capture session.

Returns
A reference to the video capture session, or nil if the session has not yet been initiated by calling StartRecognition.
- (long) GetNumProcessedFrames

Gets a count of the number of frames sent for processing since the last time a barcode was found, or since the object was instantiated, whichever is most recent.

Returns
The number of frames sent for processing since the last time a barcode was found, or since the object was instantiated, whichever is most recent.
- (id) init

Initialize.

Calls -initwithLicense.

Returns
Instance of this class.
- (id) initWithLicense: (BXLicense*)  inLicense

Initialize with a license (required).

Parameters
inLicenseA BXLicense created with information from a valid Accusoft license.
Returns
Instance of this class.
- (void) PauseRecognition

Pause recognition by no longer sending images to the Barcode Xpress recognition library.

The camera interface is not released.

- (enum Status) RecognizeImage: (UIImage*)  image
result: (BXResult **)  result 

Look for a barcode in a UIImage and decode it.

This is not as efficient as using the RecognizeImage method which takes in byte data as parameters, since the byte data must first be extracted from the UIImage before passing it to the Barcode Xpress recognition library. The types of barcodes that can be decoded will have been set earlier with a call to SetBarcodeTypes.

Parameters
imageThe image to searched.
resultThe address of a pointer to a BXResult object. The pointer will be changed to point to an autoreleased BXResult object which contains the result of the recognition for the image if a barcode is found.
Returns
The status value returned by the Barcode Xpress library for recognition of the image. Anything other than StatusOK means the value of the result parameter will be unchanged. Anything other than StatusOK or StatusNoBarcodesFound is an error condition.
- (enum Status) RecognizeImage: (void*)  image
width: (size_t)  width
height: (size_t)  height
bpp: (size_t)  bpp
stride: (size_t)  stride
result: (BXResult**)  result 

Look for a barcode in an image and, if found, return the decoded value.

The types of barcodes that can be decoded will have been set earlier with a call to SetBarcodeTypes.

Parameters
imageThe image to searched, in grayscale format with 8 bits per pixel.
widthThe image width in pixels (not including any padding).
heightThe image height in pixels.
bppThe pixel depth, in bits per pixel.
strideThe number of bytes per row in the image, including any padding.
resultThe address of a pointer to a BXResult object. The pointer will be changed to point to an autoreleased BXResult object which contains the result of the recognition for the image if a barcode is found.
Returns
The status value returned by the Barcode Xpress library for recognition of the image. Anything other than StatusOK means the value of the result parameter will be unchanged. Anything other than StatusOK or StatusNoBarcodesFound is an error condition.
- (const char *) ReportVersion

Report the version of the recognition library.

Returns
Pointer to a character string with the version in it, similar to "1.2.3"
- (void) ResumeRecognition

Resume sending images to the Barcode Xpress recognition library.

See -PauseRecognition.

- (long) SetBarcodeTypes: (long)  types

Set the barcode types that can be recognized in an image.

Parameters
typesThe set of types constructed via bitwise OR from constants defined in BarcodeConstants.h
Returns
Zero unless the set contains invalid/unlicensed barcode types, in which case the set of disallowed types is returned.
- (void) (id)  sender
: (SEL)  callback 

Set the callback which will be executed each time an image is captured from the video camera.

The callback method returns void and takes a single parameter, which is the ID of a BXThreadData object. The BXThreadData object contains raw YUV420p (planar YUV) data copied from the video pixel buffer, as well as information about the image, such as width and height.

Parameters
senderID of the object with the callback method to be invoked.
callbackSelector of the callback method.
- (void) (id)  sender
: (SEL)  callback 

Set the callback which will be executed each time a thread begins to process an image captured from the video camera.

The callback method returns void and takes a single parameter, which is the ID of a BXThreadData object. The BXThreadData object contains raw YUV420p (planar YUV) data copied from the video pixel buffer, as well as information about the image, such as width and height.

Parameters
senderID of the object with the callback method to be invoked.
callbackSelector of the callback method.
- (void) (id)  sender
: (SEL)  callback 

Set the callback which will be executed each time the Barcode Xpress recognition library has found a barcode in an image, or has encountered an error.

The callback is not executed when no errors are encountered AND no barcodes were found in the image.

The callback method returns void and takes a single parameter, which is the ID of an NSDictionary object. The NSDictionary will contain two keys, "image" and "result". "image" is a UIImage*, and "result" is a BXResult*.

Parameters
senderID of the object with the callback method to be invoked.
callbackSelector of the callback method.
- (void) StopRecognition

Stop the process of gathering images from the video camera and sending them to the Barcode Xpress library for recognition.

Releases the video camera interface.