VLDOCRController

@interface VLDOCRController : NSObject

VLDOCRController is the primary interface for getting records from a peripheral via OCR. The live results and final record are given to the VLDOCRController’s delegate object (VLDOCRControllerDelegate).

VLDOCRController is initialized with a VLDOCRPeripheral object. A VLDOCRPeripheral object can be obtained by calling [VLDOCRPeripheral supportedPeripherals].

When an instance of VLDOCRController is initialized it will immediately turn on the camera for the current device. The camera preview can be accessed with the previewLayer property. VLDOCRController needs to be configured with the configureForPreviewLayerSize: method. You need to call this method when VLDOCRController is initialized and pass in the size of the preview layer (generally the full size of the screen). This will allow the library to set the overlayFrame property to the correct size. overlayFrame should then be used to set the frame of the overlayImage from the peripheral. This is required so that the user is able to position the camera so that the peripheral is in the proper place to be processed for OCR. Note: you will need to call configureForPreviewLayerSize: if the size of the preview layer changes, it is recommended to call this method from the viewDidLayoutSubviews callback in your view controller.

  • The object that acts as the delegate of the OCR controller.

    Must conform to VLDOCRControllerDelegate protocol.

    Declaration

    Objective-C

    @property (nonatomic, weak, readwrite, nullable) id<VLDOCRControllerDelegate>
        delegate;

    Swift

    weak var delegate: VLDOCRControllerDelegate? { get set }
  • A CALayer showing the live camera preview.

    This should be displayed to the user with the peripheral’s overlayImage displayed on top so that the user can correctly position the peripheral’s screen within the camera. Note: The view containing this CALayer should not contain any subviews. The overlayImage should be a sibling view.

    Declaration

    Objective-C

    @property (nonatomic, strong, readwrite, nullable)
        AVCaptureVideoPreviewLayer *previewLayer;

    Swift

    var previewLayer: AVCaptureVideoPreviewLayer? { get set }
  • A CGRect with the frame coordinates for the overlay image.

    Until configureForPreviewLayerSize: is called, this will contain the value CGRectZero. Be sure to use this value every time configureForPreviewLayerSize: is called.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite) CGRect overlayFrame;

    Swift

    var overlayFrame: CGRect { get set }
  • Initialize a VLDOCRController for the specified peripheral.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithOCRPeripheral:
        (VLDOCRPeripheral *_Nullable)peripheral;

    Swift

    init?(ocrPeripheral peripheral: VLDOCRPeripheral?)

    Parameters

    peripheral

    the VLDOCRPeripheral to perform OCR on.

  • Initialize a VLDOCRController for the specified peripheral and glucose unit.

    Note: If the peripheral is not of type Glucose Meter an exception will be thrown.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithOCRPeripheral:
                                  (VLDOCRPeripheral *_Nullable)peripheral
                                        glucoseUnit:(id)unit;

    Swift

    init?(ocrPeripheral peripheral: VLDOCRPeripheral?, glucoseUnit unit: Any!)

    Parameters

    peripheral

    the VLDOCRPeripheral to perform OCR on.

    unit

    the VLDGlucoseUnit to use as the unit.

  • Initialize a VLDOCRController for the specified peripheral and temperature unit.

    Note: If the peripheral is not of type Thermometer an exception will be thrown.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithOCRPeripheral:
                                  (VLDOCRPeripheral *_Nullable)peripheral
                                    temperatureUnit:(id)unit;

    Swift

    init?(ocrPeripheral peripheral: VLDOCRPeripheral?, temperatureUnit unit: Any!)

    Parameters

    peripheral

    the VLDOCRPeripheral to perform OCR on.

    unit

    the VLDTemperatureUnit to use as the unit.

  • Configures VLDOCRController for the size of the camera preview layer. This allows VLDOCRController to map the coordinate space of the camera to the coordinate space of the application interface and correctly process the portion of the image containing the peripheral screen and size the overlayFrame property.

    You need to call this method when VLDOCRController is initialized and pass in the size of the preview layer (generally the full size of the screen). This will allow the library to set the overlayFrame property to the correct size. Note: you will need to call configureForPreviewLayerSize: if the size of the preview layer changes, it is recommended to call this method from the viewDidLayoutSubviews callback in your view controller.

    Declaration

    Objective-C

    - (void)configureForPreviewLayerSize:(CGSize)size;

    Swift

    func configure(forPreviewLayerSize size: CGSize)

    Parameters

    size

    the size of the previewLayer in your view.