BRCameraViewController
Base camera controller class. Subclass to build your own UI on top of the fullscreen camera view.
Declaration
@interface BRCameraViewController : UIViewController
class BRCameraViewController : UIViewController
Quick Reference
Properties
| Property | Description |
|---|---|
scanningRegion | Set this property to scan only a certain region of the returned image. |
isTorchOn | Indicates whether the torch is currently active. |
isPaused | Indicates whether scanning is paused. |
isEdgeDetectionRunning | Indicates whether edge detection is running. |
manualCaptureSession | Set to YES to prevent the parent from starting/stopping the AVCaptureSession. |
blinkReceiptId | Unique identifier for the current receipt scan session. |
Methods
| Method | Description |
|---|---|
userSnappedPhotoOnReady: | Notifies the camera controller the user attempted to snap a picture. |
userFinishedScan | Notifies the controller that scanning is complete. |
getPreliminaryResults: | Invokes the same processing pipeline as end-of-scan. |
userCancelledScan | Notifies the controller the user cancelled scanning. |
userConfirmedFrame: | Marks a frame as user-confirmed for remote saving and local storage. |
setTorch: | Toggles the torch on or off. |
pauseScanning | Pauses frame capture and scanning. |
resumeScanning | Resumes frame capture and scanning after a pause. |
confirmCorrectRetailer: | After wrong-retailer detection, call this with the corrected retailer ID. |
Overridable Methods
| Method | Description |
|---|---|
userDistanceChanged: | Called when the user's distance from the receipt changes. |
didGetFrameStats: | Called per frame with statistics including content width and edges. |
didDetectWrongRetailer:withConfidence: | Called when the SDK detects the scanned receipt belongs to a different retailer. |
didGetFrameResults: | Called per frame with cumulative metadata results as they are parsed. |
receiptValidityEstimate: | Called per frame with a running estimate of receipt validity. |
didGetLightingCondition: | Called with lighting condition updates when manual torch control is enabled. |
didGetHorizontalEdges:andBottomEdge: | Called when horizontal edges are detected on the current frame. |
Properties
scanningRegion
@property (nonatomic) CGRect scanningRegion;
var scanningRegion: CGRect { get set }
Set this property of your subclass to scan only a certain region of the returned image from the camera. Parameters are specified as percentages of the view size.
Default: (0.0, 0.0, 1.0, 1.0) (full frame)
isTorchOn (read-only)
@property (nonatomic, readonly) BOOL isTorchOn;
var isTorchOn: Bool { get }
Indicates whether the torch is currently active.
isPaused (read-only)
@property (nonatomic, readonly) BOOL isPaused;
var isPaused: Bool { get }
Indicates whether scanning is paused.
isEdgeDetectionRunning (read-only)
@property (nonatomic, readonly) BOOL isEdgeDetectionRunning;
var isEdgeDetectionRunning: Bool { get }
Indicates whether edge detection is running.
manualCaptureSession
@property (nonatomic) BOOL manualCaptureSession;
var manualCaptureSession: Bool { get set }
Set to YES to prevent the parent view controller from starting and stopping the AVCaptureSession. Use this when you manage the capture session lifecycle yourself.
Default: NO
blinkReceiptId (read-only)
@property (nonatomic, strong, readonly) NSString *blinkReceiptId;
var blinkReceiptId: String! { get }
Unique identifier for the current receipt scan session.
Methods
userSnappedPhotoOnReady:
- (void)userSnappedPhotoOnReady:(void (^)(UIImage *, BRFrameAttributes *))readyBlock;
func userSnappedPhoto(onReady readyBlock: ((UIImage?, BRFrameAttributes?) -> Void)!)
Notifies the camera controller the user attempted to snap a picture. The ready block is invoked once a suitable frame is obtained.
userFinishedScan
- (void)userFinishedScan;
func userFinishedScan()
Notifies the controller that scanning is complete. Triggers cleanup and fires the delegate callback with final results.
getPreliminaryResults:
- (void)getPreliminaryResults:(BOOL (^)(BRScanResults *))callback;
func getPreliminaryResults(_ callback: ((BRScanResults?) -> Bool)!)
Invokes the same processing pipeline as end-of-scan. The callback returns YES if the results are satisfactory, NO to continue scanning.
userCancelledScan
- (void)userCancelledScan;
func userCancelledScan()
Notifies the controller the user cancelled scanning. Performs cleanup and fires the cancelled delegate callback.
userConfirmedFrame:
- (void)userConfirmedFrame:(UIImage *)frameImg;
func userConfirmedFrame(_ frameImg: UIImage!)
Marks a frame as user-confirmed for remote saving and local storage per the active BRScanOptions.
setTorch:
- (void)setTorch:(BOOL)torchOn;
func setTorch(_ torchOn: Bool)
Toggles the torch on or off.
pauseScanning
- (void)pauseScanning;
func pauseScanning()
Pauses frame capture and scanning. Frames already in the processing pipeline are still handled.
resumeScanning
- (void)resumeScanning;
func resumeScanning()
Resumes frame capture and scanning after a pause.
confirmCorrectRetailer:
- (void)confirmCorrectRetailer:(WFRetailerId)retailerId;
func confirmCorrectRetailer(_ retailerId: WFRetailerId)
After wrong-retailer detection, call this with the corrected retailer ID to allow scanning to continue.
Overridable Methods
Override these in your subclass to receive scan-time callbacks.
userDistanceChanged:
- (void)userDistanceChanged:(BRDistanceStatus)newStatus;
func userDistanceChanged(_ newStatus: BRDistanceStatus)
Called when the user's distance from the receipt changes (too far vs. acceptable).
didGetFrameStats:
- (void)didGetFrameStats:(NSDictionary *)frameStats;
func didGetFrameStats(_ frameStats: [AnyHashable : Any]!)
Called per frame with statistics including content width, edges rect, and receipt detection.
didDetectWrongRetailer:withConfidence:
- (void)didDetectWrongRetailer:(WFRetailerId)correctRetailer withConfidence:(BRWrongRetailerConfidence)confidence;
func didDetectWrongRetailer(_ correctRetailer: WFRetailerId, with confidence: BRWrongRetailerConfidence)
Called when the SDK detects the scanned receipt belongs to a different retailer than specified.
didGetFrameResults:
- (void)didGetFrameResults:(BRScanResults *)frameResults;
func didGetFrameResults(_ frameResults: BRScanResults!)
Called per frame with cumulative metadata results as they are parsed.
receiptValidityEstimate:
- (void)receiptValidityEstimate:(BOOL)validReceipt;
func receiptValidityEstimate(_ validReceipt: Bool)
Called per frame with a running estimate of whether the frame appears to be a valid receipt.
didGetLightingCondition:
- (void)didGetLightingCondition:(BRLightingCondition)lightingCondition;
func didGet(_ lightingCondition: BRLightingCondition)
Called with lighting condition updates when manual torch control is enabled.
didGetHorizontalEdges:andBottomEdge:
- (void)didGetHorizontalEdges:(BOOL)topEdge andBottomEdge:(BOOL)bottomEdge;
func didGetHorizontalEdges(_ topEdge: Bool, andBottomEdge bottomEdge: Bool)
Called when horizontal edges are detected on the current frame.