VLDOCRController Class Reference

Inherits from NSObject
Declared in VLDOCRController.h

Overview

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.

  delegate

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

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

Discussion

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

Must conform to VLDOCRControllerDelegate protocol.

Declared In

VLDOCRController.h

  previewLayer

A CALayer showing the live camera preview.

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

Discussion

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.

Declared In

VLDOCRController.h

  overlayFrame

A CGRect with the frame coordinates for the overlay image.

@property (nonatomic, assign) CGRect overlayFrame

Discussion

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.

Declared In

VLDOCRController.h

– initWithOCRPeripheral:

Initialize a VLDOCRController for the specified peripheral.

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

Parameters

peripheral

the VLDOCRPeripheral to perform OCR on.

Discussion

Initialize a VLDOCRController for the specified peripheral.

Declared In

VLDOCRController.h

– initWithOCRPeripheral:glucoseUnit:

Initialize a VLDOCRController for the specified peripheral and glucose unit.

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

Parameters

peripheral

the VLDOCRPeripheral to perform OCR on.

unit

the VLDGlucoseUnit to use as the unit.

Discussion

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.

Declared In

VLDOCRController.h

– configureForPreviewLayerSize:

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.

- (void)configureForPreviewLayerSize:(CGSize)size

Parameters

size

the size of the previewLayer in your view.

Discussion

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.

Declared In

VLDOCRController.h