STCameraManager

@interface STCameraManager : NSObject

The STCameraManager is a single point of the ScanTrust Processing and it does all the heavy lifting, setting up the camera and the preview, running the image processing on the incoming camera frames and reporting various outcomes

  • Returns the shared camera manager instance

    Declaration

    Objective-C

    + (STCameraManager *)sharedInstance;

    Swift

    class func sharedInstance() -> STCameraManager!

    Return Value

    The shared camera manager instance

  • Starts the underlying camera object, its preview and starts the ScanTrust frame processing.

    Declaration

    Objective-C

    - (void)startScanning;

    Swift

    func startScanning()
  • Stops the preview and stops the ScanTrust frame processing.

    Declaration

    Objective-C

    - (void)pauseScanning;

    Swift

    func pauseScanning()
  • Restarts the ScanTrust frame processing. Should be used when the frame processing has been paused. Note: this will not have an impact on the camera or its preview, but will restart the response flow.

    Declaration

    Objective-C

    - (void)restartProcessing;

    Swift

    func restartProcessing()
  • Pauses the ScanTrust frame processing. This will pause the frame processing but camera and it’s preview view will not be stopped.

    Declaration

    Objective-C

    - (void)pauseProcessing;

    Swift

    func pauseProcessing()
  • Turns the torch on or off depending on the value of turnOn .

    Declaration

    Objective-C

    - (void)setCameraTorchModeOnOff:(BOOL)turnOn;

    Swift

    func setCameraTorchModeOnOff(_ turnOn: Bool)

    Parameters

    turnOn

    A boolean value to turn on or off camera torch

  • Setup the camera with given preview and prepares ScanTrust frame processing

    Declaration

    Objective-C

    - (void)setUpCameraSessionWithPreview:(STPreviewView *)previewView
                                    error:(NSError *)error;

    Swift

    func setUpCameraSessionWithPreview(_ previewView: STPreviewView!, error: Error!)

    Parameters

    previewView

    The object of STPreviewView

    error

    If the camera fails to setup/prepare, upon return contains an instance of NSError that describes the problem.

  • To Authenticate a code scan from ScanTrust Processing

    Declaration

    Objective-C

    - (void)authenticateScan:(STAuthRequest *)request
                  completion:(void (^)(STAuthResponse *, NSError *))completionBlock;

    Swift

    func authenticateScan(_ request: STAuthRequest!, completion completionBlock: ((STAuthResponse?, Error?) -> Void)!)

    Parameters

    request

    The STAuthRequest instance representing the scanned code

    completionBlock

    A block object to be executed when the network request finished sucessfully. This block has return values of STAuthResponse instance and instance of NSError, if network request fails