You are on page 1of 96

Document Reader

Low Level API Programming Manual

Document: 97-0183-14
Version: 1.0.12
Date: 30 August 2017
Low Level API Programming Manual

Contents Page
1 INTRODUCTION ......................................................................................................................................... 6
1.1 IMPORTANT NOTICES ................................................................................................................. 6
1.2 OFFICE LOCATIONS ..................................................................................................................... 7
1.3 REVISION HISTORY ..................................................................................................................... 7
2 DOCUMENT READER LOW LEVEL API .............................................................................................. 9
2.1 REFERENCES ................................................................................................................................. 9
3 OVERVIEW ................................................................................................................................................ 10
3.1 PARALLELISM ............................................................................................................................. 10
3.2 COMMON PARAMETERS........................................................................................................... 10
3.3 SAMPLE PROCESS FLOW .......................................................................................................... 12
4 CAMERA APIS .......................................................................................................................................... 13
4.1 MMMREADER_CAMERAINITIALISE ...................................................................................... 13
4.2 MMMREADER_CAMERASHUTDOWN .................................................................................... 13
4.3 MMMREADER_ISCAMERAINITIALISED ................................................................................ 13
4.4 MMMREADER_CAMERASUSPEND ......................................................................................... 14
4.5 MMMREADER_CAMERARESUME........................................................................................... 14
4.6 MMMREADER_ISCAMERASUSPENDED ................................................................................ 14
4.7 MMMREADER_ISCAMERAACTIVE......................................................................................... 14
4.8 MMMREADER_CAMERACANCELQUEUE ............................................................................. 15
4.9 MMMREADER_CAMERADETECTDOCUMENT ..................................................................... 15
4.10 MMMREADER_CAMERADETECTDOCUMENTEX ................................................................ 16
4.11 MMMREADER_CAMERADETECTDOCUMENTTWOSIDED ................................................ 18
4.12 MMMREADER_CAMERADETECTDOCUMENTTWOSIDEDEX ........................................... 19
4.13 MMMREADER_LOCATEDOCUMENT...................................................................................... 21
4.14 MMMREADER_LOCATEDOCUMENTEX ................................................................................ 22
4.15 MMMREADER_LOCATEDOCUMENTTWOSIDED ................................................................. 23
4.16 MMMREADER_LOCATEDOCUMENTTWOSIDEDEX............................................................ 23
4.17 MMMREADER_CAMERATAKESNAPSHOT............................................................................ 24
4.18 MMMREADER_ENABLEUV ...................................................................................................... 26
4.19 MMMREADER_GETUVENABLEDTIME .................................................................................. 26
4.20 MMMREADER_GETUVWARMUPTIME................................................................................... 26
4.21 MMMREADER_CAMERACHECKDETECTBOXES ................................................................. 27
4.22 MMMREADER_GETDETECTDOCUMENTSTATE .................................................................. 27
5 IMAGE PROCESSING APIS .................................................................................................................... 28
5.1 MMMREADER_IMAGEPROCESSINGINITIALISE .................................................................. 28
5.2 MMMREADER_IMAGEPROCESSINGSHUTDOWN ................................................................ 28
5.3 MMMREADER_ISIMAGEPROCESSINGINITIALISED ........................................................... 28
5.4 MMMREADER_ISIMAGEPROCESSINGACTIVE .................................................................... 29
5.5 MMMREADER_IMAGEPROCESSINGCANCELQUEUE ......................................................... 29
5.6 MMMREADER_IMAGEPOSTPROCESSIMAGE ....................................................................... 29
5.7 MMMREADER_IMAGEPOSTPROCESSIMAGETWOSIDED .................................................. 31
5.8 MMMREADER_IMAGEREADCODELINE ................................................................................ 33
5.9 MMMREADER_IMAGEREADCODELINETWOSIDED ........................................................... 33
5.10 MMMREADER_IMAGECROPTOCODELINE ........................................................................... 34
5.11 MMMREADER_IMAGECROPTOPHOTO .................................................................................. 34
5.12 MMMREADER_IMAGECONVERTFORMAT ........................................................................... 35
5.13 MMMREADER_IMAGEPERFORMSECURITYCHECK ........................................................... 35
5.14 MMMREADER_VALIDATECHECKDIGITS ............................................................................. 35
5.15 MMMREADER_VALIDATEEXTENDEDCHECKDIGITS ........................................................ 36
5.16 MMMREADER_COLLECTQAMEASUREMENTS .................................................................... 37
5.17 MMMREADER_DOCUMENTPROCESSINGCOMPLETE ........................................................ 37

Page 2 of 96
Low Level API Programming Manual

6 IMAGE PROCESSING – PLUGINS ........................................................................................................ 38


6.1 MMMREADER_IMAGEPLUGINLOAD ..................................................................................... 38
6.2 MMMREADER_IMAGEPLUGINUNLOAD ............................................................................... 38
6.3 MMMREADER_IMAGEPLUGINDECODE ................................................................................ 39
6.4 MMMREADER_IMAGEPLUGINGETIMAGESETTINGS......................................................... 39
6.5 MMMREADER_IMAGEPLUGINGETREQUIREDIMAGES ..................................................... 40
7 RFID APIS ................................................................................................................................................... 41
7.1 MMMREADER_RFINITIALISE .................................................................................................. 41
7.2 MMMREADER_RFSHUTDOWN ................................................................................................ 42
7.3 MMMREADER_ISRFINITIALISED ............................................................................................ 42
7.4 MMMREADER_RFUPDATESETTINGS .................................................................................... 42
7.5 MMMREADER_RFSUSPEND ..................................................................................................... 42
7.6 MMMREADER_RFRESUME ....................................................................................................... 43
7.7 MMMREADER_ISRFSUSPENDED ............................................................................................ 43
7.8 MMMREADER_ISRFACTIVE ..................................................................................................... 43
7.9 MMMREADER_RFIDCANCELQUEUE ..................................................................................... 43
7.10 MMMREADER_LL_RFABORT................................................................................................... 44
7.11 MMMREADER_LL_ISRFABORTED .......................................................................................... 44
7.12 MMMREADER_RFGETREADERCOUNT.................................................................................. 44
7.13 MMMREADER_RFGETREADERINFO ...................................................................................... 44
7.14 MMMREADER_RFOPEN ............................................................................................................ 45
7.15 MMMREADER_RFOPENEX ....................................................................................................... 46
7.16 MMMREADER_RFSELECTAPPLICATION .............................................................................. 47
7.17 MMMREADER_RFWAITFOROPEN .......................................................................................... 48
7.18 MMMREADER_RFWAITFOROPENEX ..................................................................................... 49
7.19 MMMREADER_RFWAITFORREMOVAL ................................................................................. 50
7.20 MMMREADER_RFPOWEROFF .................................................................................................. 51
7.21 MMMREADER_RFGETFILE ....................................................................................................... 52
7.22 MMMREADER_RFVALIDATEDATAGROUP .......................................................................... 52
7.23 MMMREADER_RFDECODEDATAGROUP .............................................................................. 52
7.24 MMMREADER_RFVALIDATESIGNATURE ............................................................................ 53
7.25 MMMREADER_RFVALIDATESIGNATUREEX ....................................................................... 54
7.26 MMMREADER_RFVALIDATESIGNEDATTRIBUTES ............................................................ 54
7.27 MMMREADER_RFVALIDATESIGNEDATTRIBUTESEX....................................................... 54
7.28 MMMREADER_RFGETAIRBAUDRATE................................................................................... 55
7.29 MMMREADER_RFGETBACSTATUS ........................................................................................ 55
7.30 MMMREADER_RFGETCHIPID .................................................................................................. 56
7.31 MMMREADER_RFRESETPASSPORT ....................................................................................... 56
7.32 MMMREADER_RFSENDAPDU .................................................................................................. 57
7.33 MMMREADER_RFCHECKACTIVEAUTHENTICATION ........................................................ 57
7.34 MMMREADER_RFVALIDATEDOCSIGNERCERT .................................................................. 58
7.35 MMMREADER_RFVALIDATEDOCSIGNERCERTEX............................................................. 58
7.36 MMMREADER_RFSETCERTIFICATECALLBACK ................................................................. 58
7.37 MMMREADER_RFSETSIGNREQUESTCALLBACK ............................................................... 59
7.38 MMMREADER_RFGETCHIPAUTHENTICATIONSTATUS .................................................... 60
7.39 MMMREADER_RFGETTERMINALAUTHENTICATIONSTATUS......................................... 60
7.40 MMMREADER_RFUPDATESETTINGS .................................................................................... 62
7.41 MMMREADER_RFSETQUEUEFINISHEDNOTIFICATION .................................................... 62
7.42 MMMREADER_RFGETCHIPAPDUTIME.................................................................................. 62
7.43 MMMREADER_RFGETCHIPBYTESREAD ............................................................................... 63
7.44 MMMREADER_CROSSCHECKEFCOMEFSOD ....................................................................... 63
8 UHF APIS .................................................................................................................................................... 64
8.1 MMMREADER_UHFINITIALISE ............................................................................................... 64
8.2 MMMREADER_UHFSHUTDOWN ............................................................................................. 64

Page 3 of 96
Low Level API Programming Manual

8.3 MMMREADER_ISUHFINITIALISED ......................................................................................... 64


8.4 MMMREADER_UHFCANCELQUEUE ...................................................................................... 65
8.5 MMMREADER_ISUHFACTIVE.................................................................................................. 65
8.6 MMMREADER_UHFGETMEMORYBANKDATA .................................................................... 65
8.7 MMMREADER_UHFGETEPC ..................................................................................................... 66
8.8 MMMREADER_UHFGETTAGID ................................................................................................ 66
9 SIGNALLING INTERFACE ..................................................................................................................... 68
9.1 MMMREADER_SIGNALINITIALISE......................................................................................... 68
9.2 MMMREADER_SIGNALSHUTDOWN ...................................................................................... 68
9.3 MMMREADER_SIGNALEVENT ................................................................................................ 68
9.4 MMMREADER_LEDEVENT ....................................................................................................... 69
9.5 MMMREADER_SOUNDEVENT ................................................................................................. 69
10 PARSING APIS .......................................................................................................................................... 70
10.1 MMMREADER_PARSEINITIALISE ........................................................................................... 70
10.2 MMMREADER_PARSESHUTDOWN......................................................................................... 70
10.3 MMMREADER_ISPARSINGINITIALISED ................................................................................ 70
10.4 MMMREADER_PARSECODELINE ........................................................................................... 70
10.5 MMMREADER_PARSEAAMVA ................................................................................................ 71
10.6 MMMREADER_CHECKFORAAMVA........................................................................................ 72
11 ERROR HANDLING APIS ....................................................................................................................... 73
11.1 MMMREADER_SETERRORHANDLER .................................................................................... 73
11.2 MMMREADER_LL_GETLASTERROR ...................................................................................... 73
11.3 MMMREADER_LL_GETERRORMESSAGE ............................................................................. 74
11.4 MMMREADER_INITIALISELOGGING ..................................................................................... 74
11.5 MMMREADER_SHUTDOWNLOGGING ................................................................................... 75
11.6 MMMREADER_LL_LOGMESSAGE .......................................................................................... 75
11.7 MMMREADER_LL_LOGFORMATTED .................................................................................... 75
11.8 MMMREADER_SETLOGGINGOPTIONS .................................................................................. 76
12 MISCELLANEOUS APIS.......................................................................................................................... 77
12.1 MMMREADER_LL_LOADSETTINGS ....................................................................................... 77
12.2 MMMREADER_LL_LOADSETTINGSFROMINIFILE .............................................................. 77
12.3 MMMREADER_LL_SAVESETTINGS ........................................................................................ 77
12.4 MMMREADER_LL_INITIALISESETTINGS.............................................................................. 78
12.5 MMMREADER_DESTROYCACHEDDATA .............................................................................. 78
12.6 MMMREADER_DESTROYCACHEDOBJECT .......................................................................... 79
12.7 MMMREADER_LL_GETFILEVERSION.................................................................................... 79
12.8 MMMREADER_LL_GETMMMREADERVERSIONS ............................................................... 80
12.9 MMMREADER_LL_GETSERIALNUMBER .............................................................................. 80
12.10 MMMREADER_LL_GETCAMERASERIALNUMBER ............................................................. 80
12.11 MMMREADER_LL_GETAPIVERSION...................................................................................... 81
12.12 MMMREADER_LL_GETLASTCOMPILE .................................................................................. 81
12.13 MMMREADER_LL_GETMODULEINFO ................................................................................... 82
12.14 MMMREADER_LL_GETCONNECTEDSCANNERS ................................................................ 82
12.15 MMMREADER_LL_SELECTSCANNER .................................................................................... 82
12.16 MMMREADER_GETHARDWARECONFIG .............................................................................. 83
12.17 MMMREADER_REBOOT ............................................................................................................ 83
12.18 MMMREADER_CAMERAUPDATESETTINGS ........................................................................ 84
13 EXTENDED SETTINGS APIS ................................................................................................................. 85
13.1 MMMREADER_LL_SETROOTINIFILE ..................................................................................... 85
13.2 MMMREADER_LL_GETREADERDIR ...................................................................................... 85
13.3 MMMREADER_LL_GETEXEDIR............................................................................................... 85
13.4 MMMREADER_LL_GETBINDIR ............................................................................................... 86

Page 4 of 96
Low Level API Programming Manual

13.5 MMMREADER_LL_GETCONFIGDIR ....................................................................................... 86


13.6 MMMREADER_LL_GETPLUGINDIR ........................................................................................ 86
13.7 MMMREADER_LL_GETDATADIR ........................................................................................... 86
13.8 MMMREADER_LL_LOADCAMERAIMAGESETTINGS ......................................................... 87
13.9 MMMREADER_LL_LOADCAMERAIMAGESETTINGSTWOSIDED .................................... 87
13.10 MMMREADER_LL_LOADSIGNALSETTINGS ........................................................................ 87
13.11 MMMREADER_LL_LOADRFSETTINGS .................................................................................. 88
13.12 MMMREADER_LL_LOADDEBUGSETTINGS ......................................................................... 89
13.13 MMMREADER_LL_LOADDATATOSENDSETTINGS ............................................................ 89
13.14 MMMREADER_LL_LOADLOGGINGSETTINGS ..................................................................... 89
13.15 MMMREADER_LL_INITIALISECAMERAIMAGESETTINGS................................................ 90
13.16 MMMREADER_LL_INITIALISESIGNALSETTINGS ............................................................... 90
13.17 MMMREADER_LL_INITIALISERFSETTINGS ......................................................................... 90
13.18 MMMREADER_LL_INITIALISEDEBUGSETTINGS ................................................................ 91
13.19 MMMREADER_LL_INITIALISEDATATOSENDSETTINGS ................................................... 91
13.20 MMMREADER_LL_INITIALISELOGGINGSETTINGS............................................................ 91
13.21 MMMREADER_LL_SAVECAMERAIMAGESETTINGS .......................................................... 92
13.22 MMMREADER_LL_SAVESIGNALSETTINGS ......................................................................... 92
13.23 MMMREADER_LL_SAVERFSETTINGS ................................................................................... 92
13.24 MMMREADER_LL_SAVEDEBUGSETTINGS .......................................................................... 93
13.25 MMMREADER_LL_SAVEDATATOSENDSETTINGS ............................................................. 93
13.26 MMMREADER_LL_SAVELOGGINGSETTINGS...................................................................... 93
APPENDIX A LOW LEVEL API QUICK REFERENCE ....................................................................... 94
Camera .......................................................................................................................................................... 94
RFID ............................................................................................................................................................. 94
Image Processing .......................................................................................................................................... 94
Image Processing – Plugins .......................................................................................................................... 95
Signalling Interface ....................................................................................................................................... 95
UHF .............................................................................................................................................................. 95
Parser ............................................................................................................................................................ 95
Miscellaneous ............................................................................................................................................... 95
Error Handling .............................................................................................................................................. 95

Page 5 of 96
Low Level API Programming Manual

1 Introduction

1.1 Important Notices


By using the Gemalto Document Reader product range (the “Product”), you (the “User”), agree to be bound by
the following terms and conditions.

Because use of the Product varies widely and is beyond the control of Gemalto the user is responsible for
determining whether the Gemalto Product is fit for a particular purpose and suitable for user’s application.
Warranties, remedies and limitations may vary by product and jurisdiction.

Gemalto offers a range of security products to protect against article and/or document identity counterfeit,
alteration, diversion, duplication, simulation and substitution. However no security products can guarantee
absolute protection against attempts to successfully accomplish these illegal activities.

Technical Information: The technical information, recommendations and other statements contained in this
document are based upon tests or experience that Gemalto believes are reliable, but the accuracy or
completeness of such information is not guaranteed.

Warranty, Limited Remedy and Limited Liability:


THE FOLLOWING IS MADE IN LIEU OF ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING THE
IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Gemalto
warrants that its Product will meet Gemalto’s written specifications at the time of shipment. Gemalto’s obligation
and your exclusive remedy shall be, at Gemalto’s option, to replace or repair the Gemalto Product or refund the
purchase price of the Gemalto Product. IN NO EVENT WILL GEMALTO BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO LOSS OF
PROFITS, IN ANY WAY RELATED TO THE PRODUCTS REGARDLESS OF THE LEGAL THEORY
ASSERTED

© Gemalto 2017. All rights reserved.

Scotch Brite is a trademark of 3M. Used under license in Canada.

Windows is a registered trademark or trademark of Microsoft Corporation in the United States and/or other
countries. Kensington is a registered trademark of ACCO Brands.

No part of this publication may be reproduced, transcribed, stored in a retrieval system or transmitted in any
form whatsoever, without the prior written consent of Gemalto.

U.S. Pat Nos. 6,019,287 and 6,611,612

Gemalto reserves the right to make changes to its Products at any time and without notice.

Page 6 of 96
Low Level API Programming Manual

1.2 Office Locations

The Americas Europe, Middle East and Africa


1545 Carling Avenue, Suite 700 6 rue de la Verrerie
Ottawa, Ontario CS 20001
Canada K1Z 8P9 92197 Meudon
France
Telephone: +1 800 581 2631
technical.service@gemalto.com Telephone: +33 1 55 01 50 00

Asia, Pacific and Australia


12 Ayer Rajah Crescent
139941 Singapore
Singapore

Telephone: +65 6317 3333

1.3 Revision History

Version Date Description

V1.00 March 2009 Original

V1.01 August 2009 RF API additions

V1.02 December 2009 RF and Setting API additions

V1.03 February 2010 Logging additions

V1.04 November 2010 Update to new 3M Format

V1.05 April 2011 RF and Image Processing API additions

V1.0.6 June 2012 Updated to match latest SDK

V1.0.7 July 2012 Updated to incorporate the changes for the AT9000 MK 2

V1.0.8 November 2013 Updated for CR5400 Double-Sided reader

Page 7 of 96
Low Level API Programming Manual

V1.0.9 March 2014 Added CameraDetectDocument and


CameraLocateDocument Ex methods.

V1.0.10 May 2015 Updated Office/Support information. Added


aDarkObjectFound parameter to Locate/DetectDocumentEx
methods. Added MMMReader_GetDetectDocumentState
method.

V1.0.11 Jan 2017 Update some methonds.

V1.0.12 August 2017 Convert to Gemalto naming.

Page 8 of 96
Low Level API Programming Manual

2 Document Reader Low Level API


The Document Reader SDK provides two interfaces to interact with a page reader; the High Level API and the
Low Level API. This document explains how to use the Low Level API for finer control over a page reader. To
understand how the High Level API works, please refer to the Document Reader Programmer’s Guide.

2.1 References

Description Part No.


Document Reader Programmer’s Guide 97-0183-10
Quality Assurance High Level API Programming Manual 97-0183-41

Page 9 of 96
Low Level API Programming Manual

3 Overview
The Document Reader Low Level API provides a much finer level of control compared to the High Level API,
allowing the reader to be used in ways that are not typical to the majority of customers. However, with this
higher level of control comes additional complexity - an application developed using the Low Level API will
require significantly more complex code to be written.

Many of the Low Level API functions are logically split into 3 principal areas:

• Camera

• Image Processing

• RFID

3.1 Parallelism

Any API within each of the logical areas can be used in parallel with any API from a different area. This allows
the RFID and Camera devices to run in parallel with any processing, and as neither is generally CPU bound,
this allows applications to get efficient use of CPU time.

For this reason, any API which takes a significant amount of time can be executed with a “non-blocking” flag. If
more than one API from within the same logical area is executed in non-blocking mode, they will be queued,
and executed in the order the APIs are called.

3.2 Common Parameters

In general, all non-blocking APIs take both a callback and a Windows event handle. The callback will be called
upon successful completion of the operation, although it will not be called in an error condition (although the
error callback will be called). The Windows event is optional, but will be signalled upon completion of the
operation (including the callback), regardless of whether an error occurred or not.

When data is supplied to the callbacks, it is allocated on the heap and so will last beyond the scope of the
callback, and references may be kept by the calling application. However, the Low Level API retains ownership
of the memory, and it should be destroyed on demand via either the MMMReader_DestroyCachedObject()
function or the MMMReader_DestroyCachedData() function.

Page 10 of 96
Low Level API Programming Manual

Most non-blocking APIs take aParam and aSequenceNum parameters, which are client application specific
parameters and are passed to the callback to identify the callback in the case of multiple calls being queued at
the same time.

The aBlocking parameter supplied to non-blocking calls allows them to be executed in a blocking way – the
command will still be executed on a separate thread and in sequence with any previous calls that are pending,
however the calling thread will wait for the completion of the command before continuing.

Care should be taken not to require action from the calling thread in the callback
to avoid a deadlock situation (e.g. Windows message processing if called from
the GUI thread).

Most APIs take one or more settings structures. These are generally initialised based upon the INI files via the
MMMReader_LL_LoadSettings() function, however developers may choose to override these settings where
desired.

Note that care should be taken when overriding the settings, as some are
calibrated to the particular scanner by Gemalto before shipping, and so may not
use the same value for all scanners.

Within the Low Level API, all images are transferred as GDI+ Bitmap objects. This allows them to be easily
processed and converted to any desired image formats without requiring any third party libraries beyond those
supplied by Microsoft with Windows 2000 and later. Applications need not use GDI+ to perform OCR as the
GDI+ objects may be simply passed between the APIs, however to convert the image to a JPEG or other format
will require the use of the GDI+ libraries. If the application is developed in a platform without direct access to
GDI+, it is possible to use the “flat” GDI+ API to access GDI+ without the use of classes.

Page 11 of 96
Low Level API Programming Manual

3.3 Sample Process Flow

Since there are many possible ways of using the Low Level API, a definitive process flow cannot be shown;
however the diagram below shows one possible way that the Low Level API may be used.

MMMReader_CameraInitialise

MMMReader_DetectDo

DetectDocumentCallback

MMMReader_CameraTakeSnapshot (IR)

TakeSnapshotCallbackIR
Client application main loop

MMMReader_CameraTakeSnapshot (VIS) MMMReader_ImagePostProcess

PostProcessCallback
TakeSnapshotCallbackVis

MMMReader_ImageCropToCodeline
MMMReader_ImagePostProcess

MMMReader_ImageReadCodeline
PostProcessCallback

ReadCodelineCallback
MMMReader_ImagePluginDecode

MMMReader_CameraShutdown MMMReader_ImageCropToPhoto MMMReader_ValidateCheckDigits

Page 12 of 96
Low Level API Programming Manual

4 Camera APIs

4.1 MMMReader_CameraInitialise

Prototype:
MMMReaderErrorCode MMMReader_CameraInitialise(
CameraSettings* aSettings,
char* aReaderDir,
bool aStartSuspended
);

Description:

This API initialises the camera, and allocates resources required to use the camera, LEDs, and illumination
hardware.

The aReaderDir parameter should point to the directory which contains the reference images – typically stored
in the puReaderDir member of the MMMReaderSettings structrue. The aSettings structure should be
initialised with settings which define the scanner settings.

If the aStartSuspended flag is set, then the device is left in the “suspended” state, allowing another application
to use the camera. If the camera is in use by another application, the camera will automatically be set to the
suspended state.

4.2 MMMReader_CameraShutdown

Prototype:
MMMReaderErrorCode MMMReader_CameraShutdown();

Description:

This API is the reverse operation of the MMMReader_CameraInitialise() function, and will disable all
illumination, and cleanly shut down the camera devices. Therefore, it should always be called before closing the
application to restore the camera to a consistent state before closing.

4.3 MMMReader_IsCameraInitialised

Prototype:
bool MMMReader_IsCameraInitialised();

Description:

This API indicates whether the camera has been initialised or not.

Page 13 of 96
Low Level API Programming Manual

4.4 MMMReader_CameraSuspend

Prototype:
MMMReaderErrorCode MMMReader_CameraSuspend();

Description:

This API releases the camera device for use in another application. While the camera is suspended, it is not
possible to access any API which requires access to the camera.

4.5 MMMReader_CameraResume

Prototype:
MMMReaderErrorCode MMMReader_CameraResume(
CameraSettings* aSettings
);

Description:

This API reconnects to the camera after it has been suspended by either calling
MMMReader_CameraSuspend(), or via the MMMReader_CameraInitialise() function with the
aStartSuspended flag set. The camera device must not be in use by another application for this API to succeed.

4.6 MMMReader_IsCameraSuspended

Prototype:
bool MMMReader_IsCameraSuspended();

Description:

This API indicates whether the camera is currently in a suspended state.

4.7 MMMReader_IsCameraActive

Prototype:
bool MMMReader_IsCameraActive();

Description:

This API indicates whether any operation is currently active in the camera module. It will return true if any non-
blocking API is currently executing or is queued, and will return false in all other cases.

Page 14 of 96
Low Level API Programming Manual

4.8 MMMReader_CameraCancelQueue

Prototype:
MMMReaderErrorCode MMMReader_CameraCancelQueue();

Description:

This will cancel any pending camera operations that have been queued by calling non-blocking calls within the
camera module.

Note that operations that are currently in progress may complete, or not be
aborted immediately.

This API will return as soon as it has indicated that the operations are to be cancelled, not when any currently in
progress operations are complete – therefore, if the client needs to wait for completion, the
MMMReader_IsCameraActive() API can be used to check for completion.

4.9 MMMReader_CameraDetectDocument

Prototype:
MMMReaderErrorCode MMMReader_CameraDetectDocument(
bool aBlocking,
bool aUseUV,
bool aQA,
Box* aDocPosition,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
MMMReaderEventCallback aDocFoundCallback,
MMMReaderEventCallback aDocRemovedCallback,
MMMReaderValidateDocPositionCallback aValidateDocumentPositionCallback,
void* aParam,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
IMGSET* aImgSettings,
int aFlashIllum
);

Description:

This API will enable document detection until a new document has been located. If there is already a
document on the window, it will not be detected as a new document if it is the same as in a previous call to
MMMReader_CameraDetectDocument() or MMMReader_LocateDocument(). When this document is
removed, the aDocRemovedCallback will be called, to indicate that the document has been removed from the
window.

Page 15 of 96
Low Level API Programming Manual

If supplied, aValidateDocumentPositionCallback will be called when a moving or stationary document has been
located, to allow the application to override the document detection. This callback is supplied simply with the
raw image data of the image that is used for the document detection. Applications may use this in conjunction
with the MMMReader_CameraCheckDetectBoxes() function to check specific boxes to determine if they are
covered.

When a new non-moving document has been detected, the aDocFoundCallback will be called. Once this
callback has completed, the aDocPosition box will be updated with the location of the document.

A number of settings structures are passed into the document detection routine. These include settings which
control how the document is detected (such as boxes to check for the position of the document), and settings
relating to the camera. Additionally a flag indicates whether the UV light is used for the document detection or
whether only the IR illumination should be used.

The aFlashIllum parameter can be used to cause the lights to flash during document detection, allowing readers
where the visible lights are visible during scanning to attract attention to the scanner to indicate that it is waiting
for a document. The numeric value of this setting is a light value, similar to that taken in
MMMReader_TakeSnapshot(). Typically, this is left at the value 0 to prevent unwanted flashing.

Note that document detection is performed by taking images with the camera, and
performing processing on those images. Therefore, this API can consume CPU
and USB resources

4.10 MMMReader_CameraDetectDocumentEx

Prototype:
MMMReaderErrorCode MMMReader_CameraDetectDocumentEx(
bool aBlocking,
bool aUseUV,
bool aQA,
Box* aDocPosition,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
MMMReaderEventCallback aDocFoundCallback,
MMMReaderEventCallback aDocRemovedCallback,
MMMReaderValidateDocPositionCallback aValidateDocumentPositionCallback,
void* aParam,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
IMGSET* aImgSettings,
int aFlashIllum,
Gdiplus::Bitmap **image,
bool locateDocPos,
bool *aDarkObjectFound
);

Description:

Page 16 of 96
Low Level API Programming Manual

This API will enable document detection until a new document has been located. If there is already a
document on the window, it will not be detected as a new document if it is the same as in a previous call to
MMMReader_CameraDetectDocument() or MMMReader_LocateDocument(). When this document is
removed, the aDocRemovedCallback will be called, to indicate that the document has been removed from the
window.

This Ex version has additional parameters image and locateDocPos. See param comments for details
in MMMReaderLowLevelAPI.h. The below two (2) parameters are added.

param[out] image A pointer to the address of a Bitmap to be populated with the image used for location.
The caller is responsible for deleting. Can be used with DocDetectSettings.useIRForDetect = TRUE as it is the
standard IR image to immediately post process instead of taking another IR capture. useIRForDetect Only for
readers that support hardware ambient removal, including AT9000 MK2 and CR5400.

param[in] locateDosPos Indicates whether to take a snapshot and locate the document. Can be used with
DocDetectSettings.useFirstImageCapturedForLocate = TRUE to bypass taking a snapshot here to locate and
the first post processed image call will locate the document instead. For readers such as the CR5400 that
use ActiveReader firmware detection to save time, not for ActiveVideo detection as the snapshot is already
taken. Only use if taking and processing an IR image first.

param[out] aDarkObjectFound A pointer to a boolean flag which will be true if a dark object is found (cell
phone).

Page 17 of 96
Low Level API Programming Manual

If supplied, aValidateDocumentPositionCallback will be called when a moving or stationary document has been
located, to allow the application to override the document detection. This callback is supplied simply with the
raw image data of the image that is used for the document detection. Applications may use this in conjunction
with the MMMReader_CameraCheckDetectBoxes() function to check specific boxes to determine if they are
covered.

When a new non-moving document has been detected, the aDocFoundCallback will be called. Once this
callback has completed, the aDocPosition box will be updated with the location of the document.

A number of settings structures are passed into the document detection routine. These include settings which
control how the document is detected (such as boxes to check for the position of the document), and settings
relating to the camera. Additionally a flag indicates whether the UV light is used for the document detection or
whether only the IR illumination should be used.

The aFlashIllum parameter can be used to cause the lights to flash during document detection, allowing readers
where the visible lights are visible during scanning to attract attention to the scanner to indicate that it is waiting
for a document. The numeric value of this setting is a light value, similar to that taken in
MMMReader_TakeSnapshot(). Typically, this is left at the value 0 to prevent unwanted flashing.

Note that document detection is performed by taking images with the camera, and
performing processing on those images. Therefore, this API can consume CPU
and USB resources
4.11 MMMReader_CameraDetectDocumentTwoSided

Prototype:
MMMReaderErrorCode MMMReader_CameraDetectDocumentTwoSided(
bool aBlocking,
bool aUseUV,
bool aQA,
Box* aDocPosition,
Box* aDocPositionSide2,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
MMMReaderEventCallback aDocFoundCallback,
MMMReaderEventCallback aDocRemovedCallback,
MMMReaderValidateDocPositionCallback aValidateDocumentPositionCallback,
void* aParam,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2,
IMGSET* aImgSettings,
int aFlashIllum
);

Description:

Page 18 of 96
Low Level API Programming Manual

This API will enable document detection until a new document has been located. If there is already a
document on the window, it will not be detected as a new document if it is the same as in a previous call to
MMMReader_CameraDetectDocument() or MMMReader_LocateDocument(). When this document is
removed, the aDocRemovedCallback will be called, to indicate that the document has been removed from the
window.

If supplied, aValidateDocumentPositionCallback will be called when a moving or stationary document has been
located, to allow the application to override the document detection. This callback is supplied simply with the
raw image data of the image that is used for the document detection. Applications may use this in conjunction
with the MMMReader_CameraCheckDetectBoxes() function to check specific boxes to determine if they are
covered.

When a new non-moving document has been detected, the aDocFoundCallback will be called. Once this
callback has completed, the aDocPosition box will be updated with the location of the document.

A number of settings structures are passed into the document detection routine. These include settings which
control how the document is detected (such as boxes to check for the position of the document), and settings
relating to the camera. Additionally a flag indicates whether the UV light is used for the document detection or
whether only the IR illumination should be used.

The aFlashIllum parameter can be used to cause the lights to flash during document detection, allowing readers
where the visible lights are visible during scanning to attract attention to the scanner to indicate that it is waiting
for a document. The numeric value of this setting is a light value, similar to that taken in
MMMReader_TakeSnapshot(). Typically, this is left at the value 0 to prevent unwanted flashing.

Note that document detection is performed by taking images with the camera, and
performing processing on those images. Therefore, this API can consume CPU
and USB resources

4.12 MMMReader_CameraDetectDocumentTwoSidedEx

Prototype:
MMMReaderErrorCode MMMReader_CameraDetectDocumentTwoSidedEx(
bool aBlocking,
bool aUseUV,
bool aQA,
Box* aDocPosition,
Box* aDocPositionSide2,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
MMMReaderEventCallback aDocFoundCallback,
MMMReaderEventCallback aDocRemovedCallback,
MMMReaderValidateDocPositionCallback aValidateDocumentPositionCallback,
void* aParam,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2,
IMGSET* aImgSettings,

Page 19 of 96
Low Level API Programming Manual

int aFlashIllum,
Gdiplus::Bitmap **image,
bool locateDocPos,
bool *aDarkObjectFound
);

Description:

This API will enable document detection until a new document has been located. If there is already a
document on the window, it will not be detected as a new document if it is the same as in a previous call to
MMMReader_CameraDetectDocument() or MMMReader_LocateDocument(). When this document is
removed, the aDocRemovedCallback will be called, to indicate that the document has been removed from the
window.

This Ex version has additional parameters image and locateDocPos. See param comments for details
in MMMReaderLowLevelAPI.h. The below two (2) parameters are added.

param[out] image A pointer to the address of a Bitmap to be populated with the image used for location.
The caller is responsible for deleting. Can be used with DocDetectSettings.useIRForDetect = TRUE as it is the
standard IR image to immediately post process instead of taking another IR capture. useIRForDetect Only for
readers that support hardware ambient removal, including AT9000 MK2 and CR5400.

param[in] locateDosPos Indicates whether to take a snapshot and locate the document. Can be used with
DocDetectSettings.useFirstImageCapturedForLocate = TRUE to bypass taking a snapshot here to locate and
the first post processed image call will locate the document instead. For readers such as the CR5400 that
use ActiveReader firmware detection to save time, not for ActiveVideo detection as the snapshot is already
taken. Only use if taking and processing an IR image first.

param[out] aDarkObjectFound A pointer to a boolean flag which will be true if a dark object is found (cell
phone).

If supplied, aValidateDocumentPositionCallback will be called when a moving or stationary document has been
located, to allow the application to override the document detection. This callback is supplied simply with the
raw image data of the image that is used for the document detection. Applications may use this in conjunction
with the MMMReader_CameraCheckDetectBoxes() function to check specific boxes to determine if they are
covered.

When a new non-moving document has been detected, the aDocFoundCallback will be called. Once this
callback has completed, the aDocPosition box will be updated with the location of the document.

A number of settings structures are passed into the document detection routine. These include settings which
control how the document is detected (such as boxes to check for the position of the document), and settings
relating to the camera. Additionally a flag indicates whether the UV light is used for the document detection or
whether only the IR illumination should be used.

The aFlashIllum parameter can be used to cause the lights to flash during document detection, allowing readers
where the visible lights are visible during scanning to attract attention to the scanner to indicate that it is waiting

Page 20 of 96
Low Level API Programming Manual

for a document. The numeric value of this setting is a light value, similar to that taken in
MMMReader_TakeSnapshot(). Typically, this is left at the value 0 to prevent unwanted flashing.

Note that document detection is performed by taking images with the camera, and
performing processing on those images. Therefore, this API can consume CPU
and USB resources

4.13 MMMReader_LocateDocument
Prototype:
MMMReaderErrorCode MMMReader_LocateDocument(
bool aUseUV,
bool aQA,
Box* aDocPosition,
bool* aDocFound,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
bool aBlocking,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
ImgSettings* aImgSettings
);

Description:
This API performs a single check for a document, and determines if a document is present and if so at which
position. It updates the aDocPosition Box in much the same way as MMMReader_DetectDocument(), and
uses the same settings to control how the presence of the document is detected.

Note that no callback is supplied – the boolean pointed to by aDocFound is simply


updated to indicate whether the document is found. This API is often called with
aBlocking set to true, as typically the reason for calling this is to obtain the value
of aDocFound and aDocPosition.

Page 21 of 96
Low Level API Programming Manual

4.14 MMMReader_LocateDocumentEx
Prototype:
MMMReaderErrorCode MMMReader_LocateDocumentEx(
bool aUseUV,
bool aQA,
Box* aDocPosition,
bool* aDocFound,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
bool aBlocking,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
ImgSettings* aImgSettings,
Gdiplus::Bitmap **image,
bool locateDocPos,
bool *aDarkObjectFound
);

Description:
This API performs a single check for a document, and determines if a document is present and if so at which
position. It updates the aDocPosition Box in much the same way as MMMReader_DetectDocument(), and
uses the same settings to control how the presence of the document is detected.

This Ex version has additional parameters image and locateDocPos. See param comments for details
in MMMReaderLowLevelAPI.h. The below two (2) parameters are added.

param[out] image A pointer to the address of a Bitmap to be populated with the image used for location.
The caller is responsible for deleting. Can be used with DocDetectSettings.useIRForDetect = TRUE as it is the
standard IR image to immediately post process instead of taking another IR capture. useIRForDetect Only for
readers that support hardware ambient removal, including AT9000 MK2 and CR5400.

param[in] locateDosPos Indicates whether to take a snapshot and locate the document. Can be used with
DocDetectSettings.useFirstImageCapturedForLocate = TRUE to bypass taking a snapshot here to locate and
the first post processed image call will locate the document instead. For readers such as the CR5400 that
use ActiveReader firmware detection to save time, not for ActiveVideo detection as the snapshot is already
taken. Only use if taking and processing an IR image first.

param[out] aDarkObjectFound A pointer to a boolean flag which will be true if a dark object is found (cell
phone).

Note that no callback is supplied – the boolean pointed to by aDocFound is simply


updated to indicate whether the document is found. This API is often called with
aBlocking set to true, as typically the reason for calling this is to obtain the value
of aDocFound and aDocPosition.

Page 22 of 96
Low Level API Programming Manual

4.15 MMMReader_LocateDocumentTwoSided
Prototype:
MMMReaderErrorCode MMMReader_LocateDocumentTwoSided(
bool aUseUV,
bool aQA,
Box* aDocPosition,
Box* aDocPositionSide2,
bool* aDocFound,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
bool aBlocking,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2,
ImgSettings* aImgSettings
);

Description:
This API performs a single check for a document, and determines if a document is present and if so at which
position. It updates the aDocPosition Box in much the same way as MMMReader_DetectDocument(), and
uses the same settings to control how the presence of the document is detected.

Note that no callback is supplied – the boolean pointed to by aDocFound is simply


updated to indicate whether the document is found. This API is often called with
aBlocking set to true, as typically the reason for calling this is to obtain the value
of aDocFound and aDocPosition.

4.16 MMMReader_LocateDocumentTwoSidedEx
Prototype:
MMMReaderErrorCode MMMReader_LocateDocumentTwoSidedEx(
bool aUseUV,
bool aQA,
Box* aDocPosition,
Box* aDocPositionSide2,
bool* aDocFound,
CameraSettings* aCamSettings,
OCRUserSet* aOCRUserSettings,
DocDetectSettings* aDocDetectSettings,
bool aBlocking,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2,
ImgSettings* aImgSettings,
Gdiplus::Bitmap **image,
bool locateDocPos,
bool *aDarkObjectFound
);

Description:

Page 23 of 96
Low Level API Programming Manual

This API performs a single check for a document, and determines if a document is present and if so at which
position. It updates the aDocPosition Box in much the same way as MMMReader_DetectDocument(), and
uses the same settings to control how the presence of the document is detected.

This Ex version has additional parameters image and locateDocPos. See param comments for details
in MMMReaderLowLevelAPI.h. The below two (2) parameters are added.

param[out] image A pointer to the address of a Bitmap to be populated with the image used for location.
The caller is responsible for deleting. Can be used with DocDetectSettings.useIRForDetect = TRUE as it is the
standard IR image to immediately post process instead of taking another IR capture. useIRForDetect Only for
readers that support hardware ambient removal, including AT9000 MK2 and CR5400.

param[in] locateDosPos Indicates whether to take a snapshot and locate the document. Can be used with
DocDetectSettings.useFirstImageCapturedForLocate = TRUE to bypass taking a snapshot here to locate and
the first post processed image call will locate the document instead. For readers such as the CR5400 that
use ActiveReader firmware detection to save time, not for ActiveVideo detection as the snapshot is already
taken. Only use if taking and processing an IR image first.

param[out] aDarkObjectFound A pointer to a boolean flag which will be true if a dark object is found (cell
phone).

Note that no callback is supplied – the boolean pointed to by aDocFound is simply


updated to indicate whether the document is found. This API is often called with
aBlocking set to true, as typically the reason for calling this is to obtain the value
of aDocFound and aDocPosition.
4.17 MMMReader_CameraTakeSnapshot

Prototype:
MMMReaderErrorCode MMMReader_CameraTakeSnapshot(
bool aBlocking,
int aLight,
int aLightingBanks,
BrightnessSettings* aBrightnessSettings,
CameraSettings* aSettings,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function takes a single image with the camera, and supplies the image as a GDI+ Bitmap to the callback.

The image is taken with the supplied light (which should be specified using the LIGHT_* constants), and with
the exposure and gain settings as specified in the BrightnessSettings structure. Typically these values will be

Page 24 of 96
Low Level API Programming Manual

as read from the configuration files as these vary from camera to camera, however in some applications it may
be desirable to adjust the settings to get optimal images.

On readers that have UV tubes (such as the RTE8000, but not the AT9000), if the aLight parameter is
LIGHT_UV and the UV light has not yet been enabled, the image will not be captured until the UV warmup time
has been reached. This warmup time is specified within the CameraSettings structure.

aLightBanks indicates the lighting banks that should be used on RTE8000 / RTE8000 HS readers that support
light bank switching. Typically this should be LIGHT_BANKS_ALL, however when attempting to suppress or
highlight Optically Variable Devices (OVDs), using a different combination of light banks may be appropriate.
This value is a bitmask indicating whether the left / right / front / bank light banks should be illuminated.

On readers that support Anti-Glare technology such as the AT9000 MK 2, the puUseAntiGlare member of the
BrightnessSettings structure can be used to indicate that it should use the Anti-Glare feature to suppress
reflections on the document.

The puAmbientRemoval member of the BrightnessSettings structure can be used to indicate whether ambient
subtraction should be performed on the image. This value should be set to a value from the
MMMReaderAmbientRemovalMethod enum. Note that the values in this enum relating to hardware ambient
subtraction will only operate correctly on readers (such as the AT9000 MK 2) that support hardware ambient
subtraction.
Note that the data returned from the camera is not generally in a format that is
directly usable for most purposes. Generally the image must be passed through
MMMReader_ImagePostProcessImage() prior to using the image. This is split
into two separate APIs to allow the camera to continue taking images while the
post processing is performed.

Page 25 of 96
Low Level API Programming Manual

4.18 MMMReader_EnableUV

Prototype:
MMMReaderErrorCode MMMReader_EnableUV(
bool aBlocking,
bool aEnabled,
HANDLE aEvent
);

Description:

This API enables the UV light. Since the images currently being taken are affected by the illumination, this will
be added to the queue and the illumination changed after all previously queued operations are complete.
However, there is no output from this API, so no callback is required.

This call should be used to turn on the UV tubes before capturing on scanners that have UV tubes. On
scanners that use UV LEDs, this API does not actually turn on the UV lights, as they do not need to be left on to
warm up.

4.19 MMMReader_GetUVEnabledTime

Prototype:
int MMMReader_GetUVEnabledTime();

Description:

This API returns the time, in milliseconds, since the UV light was turned on. This may have either been via an
MMMReader_EnableUV() API, or via the MMMReader_DetectDocument() APIs.

4.20 MMMReader_GetUVWarmupTime

Prototype:
MMMReaderErrorCode MMMReader_GetUVWarmupTime(
CameraSettings* aSettings,
int* aWarmupTime
);

Description:

This API will update the integer pointed to by aWarmupTime with the amount of time, in milliseconds, until the
UV lamp will be warmed up, based upon the warmup time that has been specified in CameraSettings structure
– typically as read from the INI files.

Page 26 of 96
Low Level API Programming Manual

4.21 MMMReader_CameraCheckDetectBoxes

Prototype:
MMMReaderErrorCode MMMReader_CameraCheckDetectBoxes(
CameraSettings* aCamSettings,
DOCDETECTSETTINGS* aDocDetSettings,
unsigned char* aImgData,
int aBoxCount,
Box aBoxes[],
bool aResults[]
);

Description:

This API checks a number of boxes within the document data supplied in aImgData to and sets the aResults
array to indicate whether the box has an average value greater than the doc-detect threshold.

The aBoxes array should contain the number of boxes referenced by aBoxCount, and the array aResults should
be large enough to store this many results. Each of the boxes must have a width and height greater than zero.
Additionally the caller should ensure that the positions of the boxes do not exceed the dimensions of the
camera resolution.

Typically this API is only used if the position validation callback is being used, and you may choose to call it
from within the callback, to provide feedback to the user of the position of the document during document
detection - see MMMReader_CameraDetectDocument().

4.22 MMMReader_GetDetectDocumentState

Prototype:
int MMMReader_GetDetectDocumentState();

Description:

This API returns the document detect state. (MOVEDOC=-2, NODOC=-1, SAMEDOC=0, NEWDOC=1)

Page 27 of 96
Low Level API Programming Manual

5 Image Processing APIs

5.1 MMMReader_ImageProcessingInitialise

Prototype:
MMMReaderErrorCode MMMReader_ImageProcessingInitialise(
CameraSettings* aCamSettings,
char* aReaderDir
);

Description:

This API initialises the image processing module, and allocates resources required for the processing. A
number of the APIs depend upon the resolution and settings of the camera, which is why aCamSettings must
be supplied. The aReaderDir is used to locate the reference images which are used by
MMMReader_PostProcessImage().

5.2 MMMReader_ImageProcessingShutdown

Prototype:
MMMReaderErrorCode MMMReader_ImageProcessingShutdown();

Description:

This API is the reverse operation of MMMReader_ImageProcessingInitialise(), and will cleanly shut down the
image processing module, and any resources allocated.

5.3 MMMReader_IsImageProcessingInitialised

Prototype:
bool MMMReader_IsImageProcessingInitialised();

Description:

This API indicates whether the image processing module has been initialised or not.

Page 28 of 96
Low Level API Programming Manual

5.4 MMMReader_IsImageProcessingActive
Prototype:
bool MMMReader_IsImageProcessingActive();

Description:
This API indicates whether any operation is currently active in the image processing module. It will return true if
any non-blocking API is currently executing or is queued, and will return false in all other cases.

5.5 MMMReader_ImageProcessingCancelQueue
Prototype:
MMMReaderErrorCode MMMReader_ImageProcessingCancelQueue();

Description:
This will cancel any pending image processing operations that have been queued by calling non-blocking calls
within the image processing module.
Note that operations that are currently in progress may complete, or not be
aborted immediately.
This API will return as soon as it has indicated that the operations are to be cancelled, not when any currently in
progress operations are complete – therefore, if the client needs to wait for completion, the
MMMReader_IsImageProcessingActive() API can be used to check for completion.

5.6 MMMReader_ImagePostProcessImage
Prototype:
MMMReaderErrorCode MMMReader_ImagePostProcessImage(
bool aBlocking,
Gdiplus::Bitmap* aInputImage,
int aLight,
int aLightingBanks,
bool aColour,
int aOperations,
int aDMQuality,
int aCorrectionMatrix,
float aGammaValue,
CameraSettings* aSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
Box* aDocPosition,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
DOCPOS* aDocPosSettings
);

Page 29 of 96
Low Level API Programming Manual

Description:

This API takes an image as captured via MMMReader_CameraTakeSnapshot(), and can apply a number of
operations to the image to improve the image.

These operations are specified via the aOperations value, which is a bitmask of the various
PostProcessingOptions values defined in MMMReaderDataTypes.h. These available options are:

PP_DEMOSAIC Demosaics the image from the bayer pattern into normal RGB / greyscale
values
PP_NORMALISE Applies a calibration image to normalise the brightness across the whole image.
The parameters aLight and aLightBanks are used to identify which calibration
image should be used, so these should match the parameters supplied to the
MMMReader_CameraTakeSnapshot() API.
PP_SMALL Reduces the image to quarter size (deprecated)
PP_CROP Crops the image to the region specified in the aDocPosition parameter, which
typically is obtained from the MMMReader_CameraDetectDocument() or
MMMReader_LocateDocument() APIs
PP_ROTATE Rotates the image by the angle specified in the aDocPosition parameter, which
typically is obtained from the MMMReader_CameraDetectDocument() or
MMMReader_LocateDocument() APIs
PP_DEBARREL Applies a debarrel transformation on the image on scanners where debarrelling
is required.
PP_RELOCATEDOCUMENT Attempts to relocate the document based upon the supplied image. Because
document location is normally performed on an IRDetect image, it is
recommended this flag is not used except on IRDetect images.
PP_SHARPEN Applies a sharpen filter to the image.
PP_FULLGREY Applies a histogram stretch to the image to get a full range of greyscale values.
It is recommend this parameter is not used if colour correctness is important.
PP_GAMMA Applies gamma correction to the image.
PP_CONTRAST Applies contrast enhancing image processing.
PP_COLOURHUE Adjusts the colours in the image. It is recommended this is not used if colour
correctness is important (deprecated)
PP_EDGE_ENHANCE Applies an edge enhance filter to the image.
PP_TRUE_COLOUR Alters the behaviour of the image processing when using PP_GAMMA and
aColourMatrix to give a more true rendition of the colours in the image. The
aGammaValue parameter is used, and typically should be set to the value
stored in the BrightnessSettings appropriate for the image being processed.

Additionally, if aColourMatrix is set to a non-zero value, colour correction is performed. The correct colour matrix
for the reader is automatically selected based on the type of reader connected. To obtain the best colour
images, you should set the PP_GAMMA and PP_TRUE_COLOUR flags, and supply a non-zero aColourMatrix
parameter, and should not use the PP_COLOURHUE or PP_FULLGREY flags.

Page 30 of 96
Low Level API Programming Manual

Once the post processing has completed, the data callback will be supplied a GDI+ bitmap of the processed
image.

Note that although this API is an ImageProcessing API, it requires that the Camera
module has been initialised to perform the de-mosaicing functionality on some
readers.

5.7 MMMReader_ImagePostProcessImageTwoSided
Prototype:
MMMReaderErrorCode MMMReader_ImagePostProcessImageTwoSided(
bool aBlocking,
Gdiplus::Bitmap* aInputImage,
int aLight,
int aLightingBanks,
bool aColour,
int aOperations,
int aDMQuality,
int aCorrectionMatrix,
float aGammaValue,
CameraSettings* aSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
Box* aDocPosition,
Box* aDocPositionSide2,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2
);

Page 31 of 96
Low Level API Programming Manual

Description:

This API takes an image as captured via MMMReader_CameraTakeSnapshot(), and can apply a number of
operations to the image to improve the image. This method can process the CR5400 two-sided image
aInputImage and then split the input into two separate output images.

These operations are specified via the aOperations value, which is a bitmask of the various
PostProcessingOptions values defined in MMMReaderDataTypes.h. These available options are:

PP_DEMOSAIC Demosaics the image from the bayer pattern into normal RGB / greyscale
values
PP_NORMALISE Applies a calibration image to normalise the brightness across the whole image.
The parameters aLight and aLightBanks are used to identify which calibration
image should be used, so these should match the parameters supplied to the
MMMReader_CameraTakeSnapshot() API.
PP_SMALL Reduces the image to quarter size (deprecated)
PP_CROP Crops the image to the region specified in the aDocPosition parameter, which
typically is obtained from the MMMReader_CameraDetectDocument() or
MMMReader_LocateDocument() APIs
PP_ROTATE Rotates the image by the angle specified in the aDocPosition parameter, which
typically is obtained from the MMMReader_CameraDetectDocument() or
MMMReader_LocateDocument() APIs
PP_DEBARREL Applies a debarrel transformation on the image on scanners where debarrelling
is required.
PP_RELOCATEDOCUMENT Attempts to relocate the document based upon the supplied image. Because
document location is normally performed on an IRDetect image, it is
recommended this flag is not used except on IRDetect images.
PP_SHARPEN Applies a sharpen filter to the image.
PP_FULLGREY Applies a histogram stretch to the image to get a full range of greyscale values.
It is recommend this parameter is not used if colour correctness is important.
PP_GAMMA Applies gamma correction to the image.
PP_CONTRAST Applies contrast enhancing image processing.
PP_COLOURHUE Adjusts the colours in the image. It is recommended this is not used if colour
correctness is important (deprecated)
PP_EDGE_ENHANCE Applies an edge enhance filter to the image.
PP_TRUE_COLOUR Alters the behaviour of the image processing when using PP_GAMMA and
aColourMatrix to give a more true rendition of the colours in the image. The
aGammaValue parameter is used, and typically should be set to the value
stored in the BrightnessSettings appropriate for the image being processed.
PP_SPLITANDCROP Enables processing of two images from a double-sided aInputImage for readers
such as the CR5400. The area boxes for each side are taken from the
aDocPosition and aDocPositionSide2 paramaters.

Additionally, if aColourMatrix is set to a non-zero value, colour correction is performed. The correct colour matrix
for the reader is automatically selected based on the type of reader connected. To obtain the best colour

Page 32 of 96
Low Level API Programming Manual

images, you should set the PP_GAMMA and PP_TRUE_COLOUR flags, and supply a non-zero aColourMatrix
parameter, and should not use the PP_COLOURHUE or PP_FULLGREY flags.

Once the post processing has completed, the data callback will be supplied a GDI+ bitmap of the processed
image.

Note that although this API is an ImageProcessing API, it requires that the Camera
module has been initialised to perform the de-mosaicing functionality on some
readers.

5.8 MMMReader_ImageReadCodeline

Prototype:
MMMReaderErrorCode MMMReader_ImageReadCodeline(
bool aBlocking,
Gdiplus::Bitmap* aInputImage,
bool aVisibleLight,
OCRSET* aOCRSettings,
OCRUSERSET* aOCRUserSettings,
Box* aDocPosition,
bool* aTooLight,
bool* aDocUpsideDown,
int* aThresholdUsed,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
IMGSET* aImgSettings,
DOCPOS* aDocPosSettings,
int* aDirtPosn
);

Description:

This API performs an OCR upon the image supplied in aInputImage, reading the codeline from travel
documents. The data callback is supplied with a character buffer containing the codeline as it has been read.
The aTooLight, aDocUpsideDown and aThresholdUsed values are all updated to reflect properties of the
document after the OCR has been performed.

The various settings structures control how the OCR is performed. Generally these would be as read from the
configuration files, although the OCRUserSettings structure contains settings which commonly are changed,
such as the characters used to represent OCR errors.

5.9 MMMReader_ImageReadCodelineTwoSided

Prototype:
MMMReaderErrorCode MMMReader_ImageReadCodelineTwoSided(
bool aBlocking,
Gdiplus::Bitmap* aInputImage,
bool aVisibleLight,

Page 33 of 96
Low Level API Programming Manual

OCRSET* aOCRSettings,
OCRUSERSET* aOCRUserSettings,
Box* aDocPosition,
bool* aTooLight,
bool* aDocUpsideDown,
int* aThresholdUsed,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
IMGSET* aImgSettings,
DOCPOS* aDocPosSettings,
int* aDirtPosn,
Gdiplus::Bitmap* aInputRearImage,
bool* prMrzOnRearSide
);

Description:

This API performs an OCR upon the image supplied in aInputImage and aInputRearImage, reading the codeline
from travel documents. The data callback is supplied with a character buffer containing the codeline as it has
been read. The aTooLight, aDocUpsideDown and aThresholdUsed values are all updated to reflect properties
of the document after the OCR has been performed.

The prMrzOnRearSide Boolean is set if the codeline is found on the rear image.

The various settings structures control how the OCR is performed. Generally these would be as read from the
configuration files, although the OCRUserSettings structure contains settings which commonly are changed,
such as the characters used to represent OCR errors.

5.10 MMMReader_ImageCropToCodeline

Prototype:
MMMReaderErrorCode MMMReader_ImageCropToCodeline(
Gdiplus::Bitmap* aInputImage,
Gdiplus::Bitmap** aOutputImage
);

Description:

This crops the given input image to just the codeline portion, and returns a GDI+ bitmap in the aOutputImage
parameter. The input image is assumed to be an image that has been cropped to the document based on
MMMReader_PostProcessImage().

5.11 MMMReader_ImageCropToPhoto

Prototype:
MMMReaderErrorCode MMMReader_ImageCropToPhoto(
Gdiplus::Bitmap* aInputImage,
Gdiplus::Bitmap** aOutputImage,

Page 34 of 96
Low Level API Programming Manual

PHOTOSET* aSettings
);

Description:

This crops the input image of a passport to just the photo, and returns the cropped image in the aOutputImage
pointer. The aSettings structure is used to store the position from where the photo should be extracted, and
typically will be as read from the configuration files.

5.12 MMMReader_ImageConvertFormat

Prototype:
MMMReaderErrorCode MMMReader_ImageConvertFormat(
MMMReaderImageFormats aDestinationFormat,
unsigned char* aInBuffer,
int aInBufferLen,
char* aOutBuffer,
int* aOutBufferLen
);

Description:

This API can be used to convert images between different types. The aInBuffer can contain a buffer that
contains an image as a JPEG, JPEG2000, PNG, TIF, or BMP. The aDestinationFormat parameter indicates the
destination format that will be written to aOutBuffer. The length of aOutBuffer should be indicated by the
supplied length, and if this is not large enough it will be updated with the required size.

5.13 MMMReader_ImagePerformSecurityCheck

Prototype:
MMMReaderErrorCode MMMReader_ImagePerformSecurityCheck(
Gdiplus::Bitmap* aBitmap,
char* aCodeline,
int* aResult
);

Description:

This API performs a security check, and indicates whether the image passes or fails. The aBitmap parameter
should be a UV image of the document, and the aCodeline parameter should be the codeline that has been
read from the document.

Upon completion, aResult will be updated to reflect whether the check passed or failed, with bit 0 indicating that
the codeline check failed if set, and bit 1 indicating that the UV check failed.

5.14 MMMReader_ValidateCheckDigits

Prototype:

Page 35 of 96
Low Level API Programming Manual

MMMReaderErrorCode MMMReader_ValidateCheckDigits(
char* aCodeline,
int* aResult
);

Description:

This API checks the numerous check digits within an ID card or passport codeline, and confirms that they all
validate correctly via the aResult value. A positive value indicates that the checksum passed, while -1 indicates
that the checksum errored.

Some documents generate a value less than -1 to indicate a warning – where the document is known not to
conform to ICAO checksum rules. Finally, if the codeline is not of a recognised format, aResult will be set to 0,
indicating that the check digits have not been checked.

5.15 MMMReader_ValidateExtendedCheckDigits

Prototype:
MMMReaderErrorCode MMMReader_ValidateExtendedCheckDigits(
char* aCodeline, [in]
int* aResultString, [out]
int* aResultStringLen [in/out]
);

Description:

This API checks the numerous check digits within an ICAO codeline, and returns detailed results via the
aResultString value. When calling this function, the length of the data buffer aResultString should be stored in
aResultStringLen. An array of 26 elements is required to handle all possible ICAO check digit data. The length
of the data written to the aResultString will be stored in aResultStringLen. If aResultString isn’t big enough to
hold all the data ERROR_STRING_BUFFER_TOO_SMALL will be returned.

The following data will be stored in aResultString:


Index Description
0 Overall result.
'U' = Checksums not checked
'F' = Checksums error
'N' = Checksums warning
'P' = Checksums OK
The following 5 elements repeat over the length of the rest of the buffer
1 Check Digit Type ID.
'B' = DOB_ID
'E' = EXPIRY_ID
'D' = DOCNUM_ID
'O' = OPTIONAL_ID
'T' = OVERALL_ID
2 Codeline number check digit is located on (1, 2, or 3)

Page 36 of 96
Low Level API Programming Manual

3 Character position on codeline of the check digit (1 based index)


4 Expected check digit value
5 Value of check digit read

5.16 MMMReader_CollectQAMeasurements

Prototype:
MMMReaderErrorCode MMMReader_CollectQAMeasurements(
bool aBlocking,
Gdiplus::Bitmap* aInputImage,
OCRSET* aOCRSettings,
OCRUSERSET* aOCRUserSettings,
Box* aDocPosition,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
IMGSET* aImgSettings
);

Description:

This API performs an OCR in “QA mode”, and also collects data about the codeline for QA purposes. The
callback is supplied with a QACodelineMeasurements structure which stores the results of the read. The
members of this structure are described in the table below:

puTop Distance from the bottom of the document to the top of the line
puBottom Distance from the bottom of the document to the bottom of the line
puLeft Distance from the left edge of the document to the left edge of the line
puRight Distance from the right edge of the document to the right edge of the line
puSkew Angle of rotation
puWidth Width of the line
puOCRResults Array of characters on the line
puOCRScores Confidence scores for each character
puAverageStrokeWidth Average stroke width across all characters on the line
puBadCharCount Number of unrecognised characters
puBrokenCharCount Number of broken characters

This API is generally not intended for use by customer applications. Customers wishing to use QA functionality
should generally use the specific QA API, which uses this API to collect the data (refer to the Quality Assurance
High Level API Programming Manual for details).

5.17 MMMReader_DocumentProcessingComplete

Prototype:
void MMMReader_DocumentProcessingComplete();

Description:

Page 37 of 96
Low Level API Programming Manual

This API should be called when all document processing is complete to allow the SDK to perform any post
actions, such as ejecting the document on the CR5400.

6 Image Processing – Plugins

6.1 MMMReader_ImagePluginLoad

Prototype:
MMMReaderErrorCode MMMReader_ImagePluginLoad(
char* aFilename,
char* aINIFileDir,
HANDLE* aDecoderHandle,
char* aMSDPATH
);

Description:

This function will load and initialise the given plugin. A number of plugins are supplied with the SDK, and are
DLLs prefixed with RTDECODE, for example RTDECODE_PDF417.dll.

The aFilename should be the fully qualified path of the plugin to be loaded. aINIFileDir should contain the path
to the configuration file for the plugin, which generally is stored in the directory puPluginsDir in the settings
structure, with the same name as the plugin but with # at the beginning, and a .ini extension. The aMSDPath
parameter would typically be the puReaderDir value from the settings structure, and identify where per-scanner
settings are to be stored.

aDecoderHandle is updated to provide a handle to the plugin which is used by further APIs to refer to this
plugin.

6.2 MMMReader_ImagePluginUnLoad

Prototype:
MMMReaderErrorCode MMMReader_ImagePluginUnLoad(
HANDLE aDecoderHandle
);

Description:

This unloads the plugin associated with the given handle. After this call, the aDecoderHandle will be invalid, and
should not be supplied to further calls.

Page 38 of 96
Low Level API Programming Manual

6.3 MMMReader_ImagePluginDecode

Prototype:
MMMReaderErrorCode MMMReader_ImagePluginDecode(
bool aBlocking,
HANDLE aDecoderHandle,
Gdiplus::Bitmap* aInputImage,
char* aDecoderInfoName,
MMMReaderDataCallback aCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent,
MMMReaderSkipPluginCallback aSkipCallback
);

Description:

This API uses a RTDECODE plugin to decode the image supplied in aInputImage. The aDecoderHandle should
be the handle of a plugin previously loaded via MMMReader_ImagePluginLoad(). aDecoderInfoName should
either be an empty string, or the name of a specific “decoder info name” if the plugin supports multiple different
types (e.g. the different types of 1D barcodes), and only one specific type is to be decoded.

The callback function will be called with any data decoded, being supplied an MMMReaderPluginData
structure which contains the data.

Note that if the image contains multiple features (e.g. 2 barcodes), or multiple
parts to the features, the callback will be called each time, with the
MMMReaderPluginData structure indicating the total number of this part + feature,
and the total number of features located.

The aSkipCallback function can optionally be supplied. If supplied, this callback will be fired immediately before
decoding actually starts to allow the application to abort this decode – for example, this might be useful for an
application to skip all further decodes once one decode has successfully returned data.

6.4 MMMReader_ImagePluginGetImageSettings

Prototype:
MMMReaderErrorCode MMMReader_ImagePluginGetImageSettings(
HANDLE aDecoderHandle,
MMMReaderImageSettings* aImageSettings,
int aIndex
);

Page 39 of 96
Low Level API Programming Manual

Description:

This API allows the plugin defined by aDecoderHandle to define images in terms of camera settings, and post
processing operations. For example, the barcode plugins do not require the image to be cropped or rotated prior
to processing, however it should be de-mosaiced, and normalised.

To obtain all of the image definitions within a plugin, this API should be called repeatedly with increasing values
of aIndex, until an error is returned.

6.5 MMMReader_ImagePluginGetRequiredImages

Prototype:
MMMReaderErrorCode MMMReader_ImagePluginGetRequiredImages(
HANDLE aDecoderHandle,
char* aDecoderInfoName,
char* aImageNames,
int aLen
);

Description:

This function allows the plugin with handle aDecoderHandle to specify the image types that are required for
processing. The image types are referred to by the name of the image, either one of the standard images –
IMAGE_IR, IMAGE_VIS, IMAGE_UV, IMAGE_COAX, or IMAGE_COAXIR, or an image that has been defined
via MMMReader_ImagePluginGetImageSettings().

The image types are defined as a comma separated list, in the buffer at aImageNames – aLen should be
initialised to the size of this buffer.

Page 40 of 96
Low Level API Programming Manual

7 RFID APIs

7.1 MMMReader_RFInitialise

Prototype:
MMMReaderErrorCode MMMReader_RFInitialise(
RFIDSettings* aTheSettings,
MMMReaderBACCallback aBACStringCallback,
MMMReaderDataCallback aRFProgressCallback,
bool aMRZDataRequiredFieldsOnly,
bool aStartSuspended,
void* aParam
);

Description:

This function initialises the RFID module, and allocates any resources that are required. The
aMRZDataRequiredFieldsOnly indicates whether all BAC keys are the full codeline, or just the 3 required fields
concatenated together.

The aTheSettings structure must be initialised with suitable settings to control the RF reading behaviour.

Version 3.0.11 onwards of the SDK uses the RFIDSettings struct as a parameter,
but previous versions passed in an MMMReaderSettings struct. To compile older
code, you can use the member MMMReaderSettings::puRFIDSettings as the value
for aTheSettings.

The aBACStringCallback is optional, however if supplied will be called when a BAC key is required. If it is not
supplied, the BAC key must be supplied in the MMMReader_RFOpen() call. If this callback is called, it is
supplied with the last BAC key that was attempted – the buffer should be updated to the “corrected” BAC key, to
re-attempt opening the chip. If the chip has been removed from the field, the boolean flag in the callback should
be set to indicate that communications with the chip should be re-established.

The aRFProgressCallback is optional, and will be called when data is being received from the chip to allow
progress through the operation to be reported. Applications must take care not to perform significant processing
in this callback, to avoid slowing communications.

The aStartSuspended flag can be used to initialise the RFID device in a suspended state. This allows the
module to be initialised while another application is using the RFID device. The device may later be connected
to using the MMMReader_RFResume() API.

The aParam value will be passed to the certificate or signer request callbacks.

Page 41 of 96
Low Level API Programming Manual

7.2 MMMReader_RFShutdown

Prototype:
MMMReaderErrorCode MMMReader_RFShutdown();

Description:

This API is the reverse of MMMReader_RFInitialise(), and releases any resources that were allocated during
the initialise.

7.3 MMMReader_IsRFInitialised

Prototype:
bool MMMReader_IsRFInitialised();

Description:

This function returns whether or not MMMReader_RFInitialise() has been successfully called.

7.4 MMMReader_RFUpdateSettings

Prototype:
MMMReaderErrorCode MMMReader_RFUpdateSettings(
RFProcessSettings* aRFSettings
);

Description:

This function updates any changed settings in aRFSettings, which may cause the certificate store to be
reloaded.

7.5 MMMReader_RFSuspend

Prototype:
MMMReaderErrorCode MMMReader_RFSuspend();

Description:

This API will disconnect from the RFID device, allowing it to be used by other applications. Once this has been
done, most RFID APIs may not be used until the corresponding MMMReader_RFResume() API is called.

Page 42 of 96
Low Level API Programming Manual

7.6 MMMReader_RFResume

Prototype:
MMMReaderErrorCode MMMReader_RFResume();

Description:

This API will reconnect to the RFID device after it has been suspended by either MMMReader_RFSuspend() or
MMMReader_RFInitialise(). This API will error if the RFID device is currently in use by another application.

7.7 MMMReader_IsRFSuspended

Prototype:
bool MMMReader_IsRFSuspended();

Description:
This API returns a boolean which indicates whether the RFID device is currently in a suspended state.

7.8 MMMReader_IsRFActive
Prototype:
bool MMMReader_IsRFActive();

Description:
This indicates that an RFID operation is currently in progress or not.

7.9 MMMReader_RFIDCancelQueue
Prototype:
MMMReaderErrorCode MMMReader_RFIDCancelQueue();

Description:
This will cancel any pending RFID operations that have been queued by calling non-blocking calls within the
RFID module.
Note that operations that are currently in progress may complete, or not be
aborted immediately.
This API will return as soon as it has indicated that the operations are to be cancelled, not when any currently in
progress operations are complete – therefore, if the client needs to wait for completion, the
MMMReader_IsRFActive() API can be used to check for completion.

Page 43 of 96
Low Level API Programming Manual

7.10 MMMReader_LL_RFAbort
Prototype:
MMMReaderErrorCode MMMReader_LL_RFAbort();

Description:
This will abort any pending RFID operations that have been queued by calling non-blocking calls within the
RFID module. The difference between this API and MMMReader_RFIDCancelQueue() is that when all current
operations are aborted, no further RF requests may be carried out until MMMReader_RFOpen() is called again
to start again.
Note that operations that are currently in progress may complete, or not be
aborted immediately.
This API will return as soon as it has indicated that the operations are to be cancelled, not when any currently in
progress operations are complete – therefore, if the client needs to wait for completion, the
MMMReader_IsRFActive() API can be used to check for completion.

7.11 MMMReader_LL_IsRFAborted
Prototype:
bool MMMReader_LL_IsRFAborted();

Description:
This indicates that an RFID operation was aborted. Once MMMReader_RFOpen() is called again, this will
return false until MMMReader_LL_RFAbort() is called.

7.12 MMMReader_RFGetReaderCount
Prototype:
int MMMReader_RFGetReaderCount();

Description:
This returns the number of smart card readers available to the SDK.

7.13 MMMReader_RFGetReaderInfo
Prototype:
MMMReaderErrorCode MMMReader_RFGetReaderInfo(
bool aBlocking,
int aReaderIndex,
MMMReaderDataCallback aDataCallback,
void* aCallbackParam,
int aSequenceNum,
HANDLE aEvent
);

Page 44 of 96
Low Level API Programming Manual

Description:
This returns details about a specific smart card device, such as the name and whether it is contact or
contactless. The smart card reader to get information about is specified by the index aReaderIndex. Note that
this is a zero-based index, so the first reader is accessed via index 0.

Details will be returned via the aDataCallback function. The pointer returned by this callback will be a pointer
that must be cast to a SmartCardReaderInfo struct.

7.14 MMMReader_RFOpen
Prototype:
MMMReaderErrorCode MMMReader_RFOpen(
bool aBlocking,
char* aBACString,
ANTENNA_MODE aAntennaMode,
int aMaxAPDUAttempts,
int aDefaultChipBaudRate,
bool aSelectLDSApplication,
MMMReaderEventCallback aChipOpenedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex
);

Description:

This API will open an RFID chip. If the BAC key is known at this point, it can be supplied via aBACString – if not,
the callback in MMMReader_RFInitialise() must be supplied to allow access to BAC chips.

The aAntennaMode determines the antenna switching mode when searching for an RF chip, using the front
antenna (non-data page) and the rear antenna (data page).

The aMaxAPDUAttempts is the maximum number of times any single APDU will be attempted on an APDU
error. This must be at least 2 as the establishment of BAC is triggered by an APDU error.

The aDefaultChipBaudRate is the first (and highest) over-air baud rate that the reader will use to communicate
to the chip. If the chip does not support this baud rate, a lower one will be used until a suitable baud rate is
chosen by the chip.

aSelectLDSApplication should be true in most e-Passport reading applications; it means that the SDK will
automatically select the ICAO LDS Application after selecting the chip.

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFOpen() with calls to MMMReader_RFPowerOff().

Page 45 of 96
Low Level API Programming Manual

The aChipOpenedCallback will be called when either a chip has been successfully opened, or when it is
determined that there is no chip present.

Note that it will not be called if there is a chip present, but an error occurs during
opening (in which case the error callback will be called, with the appropriate error
code).

aReaderIndex can be used to open a chip from a specific smart card reader. This is a zero-based index, so the
first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or there is only
one smart card device available, pass in 0.

7.15 MMMReader_RFOpenEx
Prototype:
MMMReaderErrorCode MMMReader_RFOpenEx(
bool aBlocking,
char* aBACString,
ANTENNA_MODE aAntennaMode,
int aMaxAPDUAttempts,
int aDefaultChipBaudRate,
bool aSelectLDSApplication,
MMMReaderEventCallback aChipOpenedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex,
PASSPORT_APPLICATION aApplication
);

Description:

This API will open an RFID chip. If the BAC key is known at this point, it can be supplied via aBACString – if not,
the callback in MMMReader_RFInitialise() must be supplied to allow access to BAC chips.

The aAntennaMode determines the antenna switching mode when searching for an RF chip, using the front
antenna (non-data page) and the rear antenna (data page).

The aMaxAPDUAttempts is the maximum number of times any single APDU will be attempted on an APDU
error. This must be at least 2 as the establishment of BAC is triggered by an APDU error.

The aDefaultChipBaudRate is the first (and highest) over-air baud rate that the reader will use to communicate
to the chip. If the chip does not support this baud rate, a lower one will be used until a suitable baud rate is
chosen by the chip.

aSelectLDSApplication should be true in most e-Passport reading applications; it means that the SDK will
automatically select the ICAO LDS Application after selecting the chip.

Page 46 of 96
Low Level API Programming Manual

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFOpen() with calls to MMMReader_RFPowerOff().

The aChipOpenedCallback will be called when either a chip has been successfully opened, or when it is
determined that there is no chip present.

Note that it will not be called if there is a chip present, but an error occurs during
opening (in which case the error callback will be called, with the appropriate error
code).

aReaderIndex can be used to open a chip from a specific smart card reader. This is a zero-based index, so the
first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or there is only
one smart card device available, pass in 0.

aApplication is used to specify the PASSPORT_APPLICATION, such as ePassport/eID, to select when


aSelectLDSApplication is true.

7.16 MMMReader_RFSelectApplication
Prototype:
MMMReaderErrorCode MMMReader_RFSelectApplication(
bool aBlocking,
MMMReaderEventCallback aApplicationSelectedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex,
PASSPORT_APPLICATION aApplication
);

Description:

This API is used to select an RF chip application of an already opened RF chip. This is used if the chip
supports multiple applications and you need to read more than one application.

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFOpen() with calls to MMMReader_RFPowerOff().

The aApplicationSelectedCallback will be called when and if the application is successfully selected.

Note that it will not be called if there is a chip present, but an error occurs during
opening (in which case the error callback will be called, with the appropriate error
code).

aReaderIndex can be used to open a chip from a specific smart card reader. This is a zero-based index, so the
first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or there is only
one smart card device available, pass in 0.

Page 47 of 96
Low Level API Programming Manual

aApplication is used to specify the PASSPORT_APPLICATION, such as ePassport/eID, to select when


aSelectLDSApplication is true.

7.17 MMMReader_RFWaitForOpen
Prototype:
MMMReaderErrorCode MMMReader_RFWaitForOpen(
bool aBlocking,
char* aBACString,
ANTENNA_MODE aAntennaMode,
int aMaxAPDUAttempts,
int aDefaultChipBaudRate,
bool aSelectLDSApplication,
int aTimeoutMillisecs,
MMMReaderEventCallback aChipOpenedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex
);

Description:

This API will open an RFID chip. If the BAC key is known at this point, it can be supplied via aBACString – if not,
the callback in MMMReader_RFInitialise() must be supplied to allow access to BAC chips.

The difference between this API and MMMReader_RFOpen() is that this will keep retrying to open the chip until
it has either been opened, or if the aTimeoutMillisecs timeout has been reached. The timeout is measured in
milliseconds. This can be used as a form of “document detection” using only the RFID antenna.

The aAntennaMode determines the antenna switching mode when searching for an RF chip, using the front
antenna (non-data page) and the rear antenna (data page).

The aMaxAPDUAttempts is the maximum number of times any single APDU will be attempted on an APDU
error. This must be at least 2 as the establishment of BAC is triggered by an APDU error.

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFWaitForOpen() with calls to MMMReader_RFPowerOff().

Page 48 of 96
Low Level API Programming Manual

The aDefaultChipBaudRate is the first (and highest) over-air baud rate that the reader will use to communicate
to the chip. If the chip does not support this baud rate, a lower one will be used until a suitable baud rate is
chosen by the chip.

aSelectLDSApplication should be true in most e-Passport reading applications; it means that the SDK will
automatically select the ICAO LDS Application after selecting the chip.

The aChipOpenedCallback will be called when either a chip has been successfully opened, or when it is
determined that there is no chip present.

Note that it will not be called if there is a chip present, but an error occurs during
opening (in which case the error callback will be called, with the appropriate error
code).

aReaderIndex can be used to open a chip from a specific smart card reader. This is a zero-based index, so the
first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or there is only
one smart card device available, pass in 0.

7.18 MMMReader_RFWaitForOpenEx
Prototype:
MMMReaderErrorCode MMMReader_RFWaitForOpenEx(
bool aBlocking,
char* aBACString,
ANTENNA_MODE aAntennaMode,
int aMaxAPDUAttempts,
int aDefaultChipBaudRate,
bool aSelectLDSApplication,
int aTimeoutMillisecs,
MMMReaderEventCallback aChipOpenedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex,
PASSPORT_APPLICATION aApplication
);

Description:

This API will open an RFID chip. If the BAC key is known at this point, it can be supplied via aBACString – if not,
the callback in MMMReader_RFInitialise() must be supplied to allow access to BAC chips.

The difference between this API and MMMReader_RFOpen() is that this will keep retrying to open the chip until
it has either been opened, or if the aTimeoutMillisecs timeout has been reached. The timeout is measured in
milliseconds. This can be used as a form of “document detection” using only the RFID antenna.

Page 49 of 96
Low Level API Programming Manual

The aAntennaMode determines the antenna switching mode when searching for an RF chip, using the front
antenna (non-data page) and the rear antenna (data page).

The aMaxAPDUAttempts is the maximum number of times any single APDU will be attempted on an APDU
error. This must be at least 2 as the establishment of BAC is triggered by an APDU error.

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFWaitForOpen() with calls to MMMReader_RFPowerOff().

The aDefaultChipBaudRate is the first (and highest) over-air baud rate that the reader will use to communicate
to the chip. If the chip does not support this baud rate, a lower one will be used until a suitable baud rate is
chosen by the chip.

aSelectLDSApplication should be true in most e-Passport reading applications; it means that the SDK will
automatically select the ICAO LDS Application after selecting the chip.

The aChipOpenedCallback will be called when either a chip has been successfully opened, or when it is
determined that there is no chip present.

Note that it will not be called if there is a chip present, but an error occurs during
opening (in which case the error callback will be called, with the appropriate error
code).

aReaderIndex can be used to open a chip from a specific smart card reader. This is a zero-based index, so the
first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or there is only
one smart card device available, pass in 0.

aApplication is used to specify the PASSPORT_APPLICATION, such as ePassport/eID, to select when


aSelectLDSApplication is true.

7.19 MMMReader_RFWaitForRemoval
Prototype:
MMMReaderErrorCode MMMReader_RFWaitForRemoval(
bool aBlocking,
int aTimeoutMillisecs,
MMMReaderEventCallback aChipRemovedCallback,
void* aParam,
HANDLE aEvent,
int aReaderIndex
);

Description:

This API will wait for a certain amount of time for no smart card chips to be present, i.e. removed from the smart
card device. The maximum time to wait for is provided by aTimeoutMillisecs in milliseconds.

Page 50 of 96
Low Level API Programming Manual

The aChipRemovedCallback will be called when either a chip has been successfully removed (with the event
code RF_CHIP_REMOVAL_SUCCESS), or when this API times out (with the event code
RF_CHIP_REMOVAL_TIMEOUT).

aReaderIndex can be used to wait for removal of a chip from a specific smart card reader. This is a zero-based
index, so the first smart card device is at index 0. If the Page Reader does not use smart card devices for RF or
there is only one smart card device available, pass in 0.

On readers that support RFID reading while only powered by USB (such as the AT9000 MK 2), it is important to
pair calls to MMMReader_RFWaitForRemoval() with calls to MMMReader_RFPowerOff().

7.20 MMMReader_RFPowerOff
Prototype:
MMMReaderErrorCode MMMReader_RFPowerOff(
bool aBlocking,
MMMReaderEventCallback aAntennaPoweredOffCallback,
void* aParam,
HANDLE aEvent
);

Description:

This API will power off the RF antenna, and can be used to reduce the power overhead after a read has
completed. This is particularly important on readers (such as the AT9000 MK 2) that support RFID reading on
USB power.

When under USB power, the camera module may not be used after a call to MMMReader_RFOpen() (or
MMMReader_RFWaitForOpen()) until MMMReader_RFPowerOff() is called. If an attempt to use the camera
is made, it will be queued up, but will not be completed until the RFID power has been removed. Conversely,
the RFID calls will also be prevented from executing if the camera is currently in use, and will not be started until
all camera activity has stopped.

To detect that a reader is under USB power, you can use the puIsUSBPowered member of the
MMMReaderHardwareConfig structure, which can be obtained via the MMMReader_GetHardwareConfig()
API.

This API can also be used to completely reset the state of any chip that is in field, if the scanner has support for
completely powering off the antenna. In some cases, this could recover from errors that occur relating to the
chip state.

Page 51 of 96
Low Level API Programming Manual

7.21 MMMReader_RFGetFile

Prototype:
MMMReaderErrorCode MMMReader_RFGetFile(
bool aBlocking,
MMMReader_RFItem aItem,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function will retrieve the raw data file for the given item from the RFID chip. The data callback will be called,
and supplied with the raw data. This can be used to retrieve any of DG1 to DG16, and EF.COM and EF.SOD.

7.22 MMMReader_RFValidateDataGroup

Prototype:
MMMReaderErrorCode MMMReader_RFValidateDataGroup(
bool aBlocking,
MMMReader_RFItem aItem,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This API will validate the data within the data groups. If the requested data group has not already been retrieved
from the chip, it will be retrieved prior to validation. The data callback will be called with a 4-byte integer value
indicating the success or failure to validate as a value within the MMMReaderValidationCode enumeration.
Only the data groups may be validated (RFID_DG1 to RFID_DG16).

7.23 MMMReader_RFDecodeDataGroup

Prototype:
MMMReaderErrorCode MMMReader_RFDecodeDataGroup(
bool aBlocking,
MMMReader_RFItem aItem,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

Page 52 of 96
Low Level API Programming Manual

This API will perform a data group specific decode for the given data group. If that data group has not yet been
retrieved, it will be retrieved as part of this call.

For RFID_DG1, this will extract the codeline from the data group, and return this codeline data.

Note that unlike the data returned by MMMReader_ImageReadCodeline(), this will


not contain return characters at the end of each “line” within the data.

For RFID_DG2, this will return the JPEG image contained within the data.

Note that this image may also be a JPEG2000 image.

For RFID_DG3, this will return a DG3Fingerprints structure.

7.24 MMMReader_RFValidateSignature

Prototype:
MMMReaderErrorCode MMMReader_RFValidateSignature(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This API will retrieve and then validate the signature. The data callback will be called with a 4-byte integer value
indicating the success or failure to validate the signature. This will be a value within the
MMMReaderValidationCode enumeration.

Page 53 of 96
Low Level API Programming Manual

7.25 MMMReader_RFValidateSignatureEx

Prototype:
MMMReaderErrorCode MMMReader_RFValidateSignatureEx(
bool aBlocking,
MMMReaderRFItem aSecurityObjectFile,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This API will retrieve and then validate the signature from the specified security object file. The data callback will
be called with a 4-byte integer value indicating the success or failure to validate the signature. This will be a
value within the MMMReaderValidationCode enumeration.

aSecurityObjectFile Specify which security object data file on the RFID chip to use
for validation. See #MMMReaderRFItem for available files. #RFID_EF_SOD, #RFID_EF_CARD_SECURITY
and #RFID_EF_CHIP_SECURITY are acceptable values.

7.26 MMMReader_RFValidateSignedAttributes

Prototype:
MMMReaderErrorCode MMMReader_RFValidateSignedAttributes(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function will validate the signed attributes on the RFID chip. The aDataCallback will be called with a 4-byte
integer value indicating the success or failure to validate the signed attributes. This will be a value within the
MMMReaderValidationCode enumeration.

7.27 MMMReader_RFValidateSignedAttributesEx

Prototype:
MMMReaderErrorCode MMMReader_RFValidateSignedAttributesEx(
bool aBlocking,
MMMReaderRFItem aSecurityObjectFile,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Page 54 of 96
Low Level API Programming Manual

Description:

This function will validate the signed attributes on the RFID chip. The aDataCallback will be called with a 4-byte
integer value indicating the success or failure to validate the signed attributes. This will be a value within the
MMMReaderValidationCode enumeration.

aSecurityObjectFile Specify which security object data file on the RFID chip to use
for validation. See #MMMReaderRFItem for available files. #RFID_EF_SOD, #RFID_EF_CARD_SECURITY
and #RFID_EF_CHIP_SECURITY are acceptable values.

7.28 MMMReader_RFGetAirBaudRate

Prototype:
MMMReaderErrorCode MMMReader_RFGetAirBaudRate(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This returns the air baud rate that is currently in use with the RFID chip. The speed is returned as an ASCII
string to the data callback.

7.29 MMMReader_RFGetBACStatus

Prototype:
MMMReaderErrorCode MMMReader_RFGetBACStatus(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Page 55 of 96
Low Level API Programming Manual

Description:

This API indicates whether BAC is currently active, inactive, or not yet required. This is returned via the callback
supplying a TRISTATE enumeration value. A value of 1 (TS_SUCCESS) indicates that BAC is active. A value
of -1 (TS_FAILURE) indicates that BAC has been attempted, but failed. A value of 0 (TS_NOT_PERFORMED)
indicates that BAC is not active.

Note that when using a Basic Access Control chip, BAC will not be established
until the first data item is requested. Therefore, calling this immediately after a
call to MMMReader_RFOpen() will indicate TS_NOT_PERFORMED, even if the chip
is a BAC chip.

7.30 MMMReader_RFGetChipId

Prototype:
MMMReaderErrorCode MMMReader_RFGetChipId(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This returns the chip ID, as a null terminated ASCII string in the buffer pointed to by aChipId. The length of this
buffer should be supplied in aChipIdLen – if the buffer is not big enough, this will be updated to contain the
length of the buffer required.

7.31 MMMReader_RFResetPassport

Prototype:
MMMReaderErrorCode MMMReader_RFResetPassport();

Description:

This API will reset the RFID chip, clearing all data that has been cached, and force the chip to be re-opened if
further data is required.

Page 56 of 96
Low Level API Programming Manual

7.32 MMMReader_RFSendAPDU

Prototype:
MMMReaderErrorCode MMMReader_RFSendAPDU(
bool aBlocking,
unsigned char* aAPDU,
int aAPDULen,
unsigned char* aResponseBuffer,
int* aResponseBufferLen,
HANDLE aEvent
);

Description:

This API can be used to send an APDU directly, rather than using the MMMReader_GetData() and related
APIs. Generally we would recommend applications did not use this API, unless there are specific needs to
send raw APDU data to the chip. In these cases, care should be taken to avoid mixing this call with other APIs
that send APDUs.

The APDU data is supplied in aAPDU, and the length of this buffer in aAPDULen. A buffer is should be
allocated for the response, and the length stored in aResponseBufferLen.

7.33 MMMReader_RFCheckActiveAuthentication

Prototype:
MMMReaderErrorCode MMMReader_RFCheckActiveAuthentication(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This API verifies that the RFID chip passes the Active Authentication validation. This is returned via the data
callback supplying a TRISTATE enumeration value. A value of 1 (TS_SUCCESS) indicates that Active
Authentication was successful. A value of -1 (TS_FAILURE) indicates that Active Authentication has been
attempted, but failed. A value of 0 (TS_NOT_PERFORMED) indicates that Active Authentication is not
supported by the chip.

Note that in cases such as DG15 not present, an error callback will be triggered indicating datagroup not found,
but a TS_NOT_PERFORMED will be still be returned.

Page 57 of 96
Low Level API Programming Manual

7.34 MMMReader_RFValidateDocSignerCert

Prototype:
MMMReaderErrorCode MMMReader_RFValidateDocSignerCert(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function will validate the document signer certificates for the RFID chip. The aDataCallback will be called
with a 4-byte integer value indicating the success or failure to validate the certificates. This will be a value within
the MMMReaderValidationCode enumeration.

When the certificates are validated, depending upon the configuration settings, the certificate callback
registered via MMMReader_SetCertificateCallback() may be called to supply the certificates.

7.35 MMMReader_RFValidateDocSignerCertEx

Prototype:
MMMReaderErrorCode MMMReader_RFValidateDocSignerCertEx(
bool aBlocking,
MMMReaderRFItem aOnChipCertFile
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function will validate the document signer certificates for the RFID chip. The aDataCallback will be called
with a 4-byte integer value indicating the success or failure to validate the certificates. This will be a value within
the MMMReaderValidationCode enumeration.

When the certificates are validated, depending upon the configuration settings, the certificate callback
registered via MMMReader_SetCertificateCallback() may be called to supply the certificates.

aOnChipCertFile Specify which data file on the RFID chip to load the DSC from
for validation. See #MMMReaderRFItem for available files. #RFID_EF_SOD, #RFID_EF_CARD_SECURITY
and #RFID_EF_CHIP_SECURITY are acceptable values.

7.36 MMMReader_RFSetCertificateCallback

Page 58 of 96
Low Level API Programming Manual

Prototype:
MMMReaderErrorCode MMMReader_RFSetCertificateCallback(
MMMReaderCertificateCallback aCertCallback
);

Description:

This API allows the caller to assign a callback to be called when a certificate is required. This callback will be
called for a variety of different certificates based upon the settings structures – these settings are typically read
from #RTePassportAPI.ini, although may be set programmatically within the application:
• puRFProcessSettings.puDocSignerCertMode
• puRFProcessSettings.puExternalDSCMode
• puRFProcessSettings.puExternalCSCMode
• puRFProcessSettings.puExternalCVCertsMode
• puRFProcessSettings.puExternalPrivateKeyMode

The aCertType parameter identifies the type of certificate requested, and determines how the certificate
identifier should be interpreted:

For Document Signer Certificates (CT_DOC_SIGNER_CERT):


• aCertIdentifier is SignerIdentifier buffer.

For Country Signer Certificates (CT_COUNTRY_SIGNER_CERT):


• aCertIdentifier is AuthorityKeyIdentifier buffer.

For the various EAC certificates – i.e. CT_IS_CERT, CT_DV_CERT, and CT_CVCA_CERT:
• aCertIdentifier is the CAR from the CV Certificate, or the previous certificate in the chain.
• aCertBuffer should be set to a DER encoded CV Certificate. It may also be Base64 DER encoded.

For the IS Private Key (CT_IS_PRIVATE_KEY):


• aCertIdentifier will contain the CHR field from the IS Certificate.
• aCertBuffer should be set to a DER encoded PKCS8 PrivateKeyInfo. This can also be Base64 DER
encoded.
In all cases, if the buffer supplied is not large enough, the callback should return false and set aCertBufferLen to
the number of bytes required. The callback will then be fired again with a larger buffer allocated.
If a certificate is loaded, the callback should return true, and if no certificate is available, the callback should
return false without modifying the aCertBufferLen.

7.37 MMMReader_RFSetSignRequestCallback
Prototype:
MMMReaderErrorCode MMMReader_RFSetSignRequestCallback(
MMMReaderSignRequestCallback aSignRequestCallback
);

Page 59 of 96
Low Level API Programming Manual

Description:
This function is used to set the callback which is called whenever data needs to be signed for Terminal
Authentication. This is only used if the setting puRFProcessSettings.puExternalPrivateKeyMode is set to
ECM_SIGN_REQUEST.
The sign request callback is given:

• aBufferToSign: a buffer containing the data for the host application to sign.
• aBufferToSignLen: length of the data in bytes contained in aBufferToSign.
• aCertBuffer: a buffer containing a certificate whose public key (and domain parameters) should
correspond to the private key used to generate the signature.
• aCertBufferLen: length of the data in bytes contained in aCertBuffer.
• aCertType: an enum to identify the type of certificate contained in aCertBuffer.
• aSignature: a pre-allocated buffer for the host application to write the signature.
• aSignatureLee: the pre-allocated length of aSignature. The host application must set this to the
actual size in bytes of the signature.

This function is only valid when if the EAC feature has been enabled in the SDK at initialisation – it will return
ERROR_FEATURE_NOT_ENABLED if puEACEnabled is set to false when initialising the RF module.

7.38 MMMReader_RFGetChipAuthenticationStatus

Prototype:
MMMReaderErrorCode MMMReader_RFGetChipAuthenticationStatus(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function indicates whether Chip Authentication has been successfully established. The aDataCallback will
be called with a TRISTATE enumeration value. A value of 1 (TS_SUCCESS) indicates that Chip Authentication
has been successfully established. A value of -1 (TS_FAILURE) indicates that Chip Authentication has been
attempted, but failed. A value of 0 (TS_NOT_PERFORMED) indicates that Chip Authentication is not supported
by the chip.

This function is only valid when if the EAC feature has been enabled in the SDK at initialisation – it will return
ERROR_FEATURE_NOT_ENABLED if puEACEnabled is set to false when initialising the RF module.

7.39 MMMReader_RFGetTerminalAuthenticationStatus

Prototype:
MMMReaderErrorCode MMMReader_RFGetTerminalAuthenticationStatus(

Page 60 of 96
Low Level API Programming Manual

bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function indicates whether Terminal Authentication has been successfully established. The aDataCallback
will be called with a TRISTATE enumeration value. A value of 1 (TS_SUCCESS) indicates that Terminal
Authentication has been successfully established. A value of -1 (TS_FAILURE) indicates that Terminal
Authentication has been attempted, but failed. A value of 0 (TS_NOT_PERFORMED) indicates that Terminal
Authentication has not been attempted.

As Terminal Authentication is only established during reading of protected biometrics (i.e. DG3 and DG4), the
result returned will be different when called before attempting to read these data items. Therefore, it is
recommended this is called after reading the protected data items.

This function is only valid when if the EAC feature has been enabled in the SDK at initialisation – it will return
ERROR_FEATURE_NOT_ENABLED if puEACEnabled is set to false when initialising the RF module.

Page 61 of 96
Low Level API Programming Manual

7.40 MMMReader_RFUpdateSettings

Prototype:
MMMReaderErrorCode MMMReader_RFUpdateSettings(
RFProcessSettings* aRFSettings
);

Description:

This function allows the RFProcessSettings to be changed. For some settings, the structures can simply be
changed prior to calling a function which takes these parameters. However, for other settings some processing
is required. Specifically, if the certificate modes or the certificate path are changed, the certificates must be
reloaded from disk. This will be performed when this API is called.

7.41 MMMReader_RFSetQueueFinishedNotification

Prototype:
MMMReaderErrorCode MMMReader_RFSetQueueFinishedNotification(
MMMReaderNotifyCallback aNotifyCallback,
void* aParam
);

Description:

This API allows a callback to be set which will be called when the RF queue is empty. This allows an application
to queue up multiple RF data item requests, and need not track whether all data items have been returned
individually, but can use this callback to return this information.

This is particularly useful in the case where errors occur when retrieving data items, so that applications need
not track whether an error occurred during the read.

7.42 MMMReader_RFGetChipApduTime

Prototype:
MMMReaderErrorCode MMMReader_RFGetChipApduTime(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE
aEvent
);

Page 62 of 96
Low Level API Programming Manual

Description:

This API returns the total amount of time spent waiting for the APDU response – the timer is started at the
beginning of sending each APDU, and stopped when the APDU response is received.

7.43 MMMReader_RFGetChipBytesRead

Prototype:
MMMReaderErrorCode MMMReader_RFGetChipApduTime(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This API returns the total amount of bytes read from the ePassport.

7.44 MMMReader_CrosscheckEFComEFSod

Prototype:
MMMReaderErrorCode MMMReader_CrosscheckEFComEFSod(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void *aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

This function compares the content of EF.COM with the hashes contained in EF.SOD, and returns the result as
an MMMValidationCode indicating whether they reference an identical set of datagroups. In the case of a
modified EF.SOD that has additional or missing datagroups compared to EF.SOD, this will return a validation
failure.

Page 63 of 96
Low Level API Programming Manual

8 UHF APIs

8.1 MMMReader_UHFInitialise

Prototype:
MMMReaderErrorCode MMMReader_UHFInitialise(
UHFSettings* aTheSettings
);

Description:

Initialises the UHF module and allocates resources required for UHF read operations. TheSettings is pointer to
a UHFSettings structure that contains all the values to initialise the UHFModule with.

The MMMReader_UHFShutdown() API must be called when finished with the UHF
device to free all resources allocated.

8.2 MMMReader_UHFShutdown

Prototype:
MMMReaderErrorCode MMMReader_UHFShutdown();

Description:

Shuts down the UHF module and frees all related resources.

8.3 MMMReader_IsUHFInitialised

Prototype:
MMMReaderErrorCode MMMReader_IsUHFInitialised();

Description:

Determines whether the UHF module has been initialised.

Page 64 of 96
Low Level API Programming Manual

8.4 MMMReader_UHFCancelQueue

Prototype:
MMMReaderErrorCode MMMReader_UHFCancelQueue();

Description:

Cancels any pending UHF operations that have been queued by non-blocking API calls within the UHF module,
and attempts to cancel any currently executing operation.

8.5 MMMReader_IsUHFActive

Prototype:
MMMReaderErrorCode MMMReader_IsUHFActive();

Description:

Determines whether any operation is currently active in the UHF module.

8.6 MMMReader_UHFGetMemoryBankData

Prototype:
MMMReaderErrorCode MMMReader_UHFGetMemoryBankData(
bool aBlocking,
MMMReaderUHFMemoryBank aMemoryBank,
unsigned long aOffset,
unsigned long aByteCount,
MMMReaderDataCallback aDataCallback,
void* aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

Reads the contents of the desired memory bank from a UHF tag that is present in the field of the reader.

This API will only return data if a UHF tag is found in the reader field.

aMemoryBank is the tag memory bank to read the data from.

aOffset is the memory bank offset, in bytes, to start the read from.

aByteCount is the number of bytes to read from the memory bank.

Page 65 of 96
Low Level API Programming Manual

aDataCallback is a user defined MMMReaderDataCallback function which will receive the data that was read
in the form of an unsigned char array.

aParam an optional pointer to some user-defined data. This is passed on to the aDataCallback function
provided.

aSequenceNum is a user-defined value which is passed straight into aDataCallback. This parameter is provided
so that it is possible to have one data callback defined for multiple data items; the defined function can then
filter the aSequenceNum as appropriate.

8.7 MMMReader_UHFGetEPC

Prototype:
MMMReaderErrorCode MMMReader_UHFGetEPC(
bool aBlocking,
MMMReaderDataCallback aDataCallback,
void * aParam,
int aSequenceNum,
HANDLE aEvent
);

Description:

Reads the EPC (Electronic Product Code) section from the EPC memory bank of a UHF tag that is present in
the field of the reader.

This API will only return data if a UHF tag is found in the reader field.

aDataCallback is a user defined MMMReaderDataCallback function which will receive the data that was read
in the form of an unsigned char array.

aParam an optional pointer to some user-defined data. This is passed on to the aDataCallback function
provided.

aSequenceNum is a user-defined value which is passed straight into aDataCallback. This parameter is provided
so that it is possible to have one data callback defined for multiple data items; the defined function can then
filter the aSequenceNum as appropriate.

8.8 MMMReader_UHFGetTagID

Prototype:
MMMReaderErrorCode MMMReader_UHFGetTagID()

Description:

Reads the TagID from a UHF tag that is present in the field of the reader.

Page 66 of 96
Low Level API Programming Manual

This API will only return data if a UHF tag is found in the reader field.

aDataCallback is a user defined MMMReaderDataCallback function which will receive the data that was read
in the form of an MMMReaderUHFTagData struct.

aParam an optional pointer to some user-defined data. This is passed on to the aDataCallback function
provided.

aSequenceNum is a user-defined value which is passed straight into aDataCallback. This parameter is provided
so that it is possible to have one data callback defined for multiple data items; the defined function can then
filter the aSequenceNum as appropriate.

Page 67 of 96
Low Level API Programming Manual

9 Signalling Interface

9.1 MMMReader_SignalInitialise

Prototype:
MMMReaderErrorCode MMMReader_SignalInitialise(
char* aFileLocations,
char* aWavFileLocation
);

Description:

This API initialises the signalling interface, and allocates resources required to use the sound and LED
signalling interfaces.

Note that the LEDs will not be used for signalling until the
MMMReader_CameraInitialise() has been called, although there is no requirement
to initialise the camera prior to calling MMMReader_SignalInitialise().

aFileLocations should be set to where the led.ini can be located, while aWavFileLocation is where the .wav files
can be located. Typically, these are “puReaderDir” and “puConfigDir” respectively.

9.2 MMMReader_SignalShutdown

Prototype:
MMMReaderErrorCode MMMReader_SignalShutdown();

Description:

This function is the reverse of MMMReader_SignalInitialise(), and releases any resources allocated during the
initialise.

9.3 MMMReader_SignalEvent

Prototype:
MMMReaderErrorCode MMMReader_SignalEvent(
SoundSettings* aSoundSettings,
MMMReaderSignal aEvent
);

Description:

This API can be used to signal an event with potentially both a sound and the LED indicators. The
MMMReaderSignal enumeration defines a number of events that can be defined within the scanner
configuration to control which LED and sounds should be used for any given event.

Page 68 of 96
Low Level API Programming Manual

9.4 MMMReader_LedEvent

Prototype:
MMMReaderErrorCode MMMReader_LedEvent(
MMMReaderSignal aEvent
);

Description:

This API can be used to signal an event via the LEDs only, without playing a sound. In all other respects it is the
same as MMMReader_SignalEvent().

9.5 MMMReader_SoundEvent

Prototype:
MMMReaderErrorCode MMMReader_SoundEvent(
SoundSettings* aSoundSettings,
MMMReaderSignal aEvent
);

Description:

This API can be used to signal an event via a sound only, without changing the LED state. In all other respects
it is the same as MMMReader_SignalEvent().

Page 69 of 96
Low Level API Programming Manual

10 Parsing APIs

10.1 MMMReader_ParseInitialise

Prototype:
MMMReaderErrorCode MMMReader_ParseInitialise();

Description:

Initialises the SDK parser module to assist in some data parsing functionality, and allocates all necessary
resources. The MMMReader_ParseShutdown() API must be called after finished using all parsing functions to
release the resources allocated by this call.

The Parser module is required for all MMMReader_Parse*() functions except for
MMMReader_ParseCodeline(), for which it is not necessary to initialise / shutdown the parser module.

10.2 MMMReader_ParseShutdown

Prototype:
MMMReaderErrorCode MMMReader_ParseShutdown();

Description:

Shuts down the Parser module and releases all related resources.

10.3 MMMReader_IsParsingInitialised

Prototype:
bool MMMReader_IsParsingInitialised();

Description:

Indicates whether the SDK Parser module has been initialised, and has resources that must be released by the
MMMReader_ParseShutdown() call.

10.4 MMMReader_ParseCodeline

Prototype:
MMMReaderErrorCode MMMReader_ParseCodeline(
const char* aCodeline,
MMMParseCodelineFlag aFlags,
MMMReaderCodelineData* aCodelineData,
CODELINECONTEXT *posns
);

Page 70 of 96
Low Level API Programming Manual

Description:

Parses the codeline supplied in aCodeline into separate field values, if the codeline is the MRZ from an ICAO
compliant MRTD. The struct pointed to by the aCodelineData parameter is updated to contain the parsed
results from the document.

The codeline may or may not contain \r characters to separate the different lines, allowing this API to be used to
parse the data supplied by MMMReader_ImageReadCodeline() and also DG1 from an ePassport as read by
MMMReader_RFDecodeDataGroup().

The aFlags parameter indicates parameters about how the parsing should take place, as per the
MMMParseCodelineFlag enum – typically this would be set to MPCF_ALL to parse all data.

The posns parameter can be used to parse data out of non-ICAO compliant documents that are not supported
natively by the SDK. Typically this parameter is left to NULL and the SDK will parse the codeline as per the
rules built into the SDK.

10.5 MMMReader_ParseAAMVA

Prototype:
MMMReaderErrorCode MMMReader_ParseAAMVA(
const char* aDataStr,
int aDataLength,
MMMReaderAAMVAData** aDataStructPtr,
MMMReaderAAMVADataSource aDataSource
);

Description:

Parses a data stream read from a North American drivers licence which adheres to the AAMVA standard. The
aDataStr parameter is a null terminated string containing the data to parse, and aDataLength is the length of
this data.

The results of the parsing are created in a new structure, and the pointer at aDataStructPtr is updated to point to
this structure. This structure may be set to a structure that contains empty strings in the case of data that does
not correctly parse as per the AAMVA standard.

Ownership of the output structure is retained by the SDK, and the pointer should be supplied to
MMMReader_DestroyCachedObject() to release the memory once it is no longer required.

The aDataSource parameter indicates whether the data is expected to be in the format read from a PDF417
barcode, or whether it is from the magnetic stripe.

Note that some North American drivers licences contain encrypted data which can
prevent them from being parsed. Additionally, various states have issued
documents which are not 100% conformant to the AAMVA standard, so it is
possible that not all documents will be correctly parsed.

Page 71 of 96
Low Level API Programming Manual

10.6 MMMReader_CheckForAAMVA

Prototype:
MMMReaderErrorCode MMMReader_CheckForAAMVA(
const char* aDataStr,
int aDataLength
);

Description:

Checks a data stream supplied in aDataStr for a North American drivers licence compliant with the AAMVA
standard protocol.

The SDK will attempt to check for specific fefatures to identify if it is recognised data – if it is believed valid then
NO_ERROR_OCCURRED will be returned. ERROR_UNKNOWN_DATA_FORMAT will be returned if the data
is detected as not compliant with the AAMVA standard.

Page 72 of 96
Low Level API Programming Manual

11 Error Handling APIs

11.1 MMMReader_SetErrorHandler

Prototype:
void MMMReader_SetErrorHandler(
MMMReaderErrorCallback aCallback
);

Description:

This function assigns the error handler, which will be called whenever a error is detected within any API. The
aCallback will be called with an error code indicating the error that occurred, and a string containing the error.

Note that the error handler will be called from within the scope of the erroring
thread, and so that thread will not continue until the error has completed, however
other threads may continue during this call. Therefore, callers should ensure that
any re-initialisation logic performed within the error handler is thread-safe.

11.2 MMMReader_LL_GetLastError

Prototype:
MMMReaderErrorCode MMMReader_LL_GetLastError(
MMMReaderErrorCode* aErrorCode,
char* aErrorString,
int* aStrLen
);

Description:

This API returns the last error that occurred, returning the error code to aErrorCode, and the string associated
with the error at aErrorString. The length of the buffer at aErrorString should be supplied in aStrLen – if this is
not large enough, then aStrLen will be updated to contain the length of buffer required.

The error string returned by this API will include any formatted parameters – e.g. the message for
ERROR_LOADING_DLL will return the name of the DLL that has not been loaded.

Page 73 of 96
Low Level API Programming Manual

11.3 MMMReader_LL_GetErrorMessage

Prototype:
MMMReaderErrorCode MMMReader_LL_GetErrorMessage(
MMMReaderErrorCode aErrorCode,
char* aErrorString,
int* aStrLen
);

Description:

This API returns the error message associated with the given error code. The message is written to the buffer at
aErrorString, and the length updated in aStrLen. The size of the buffer supplied in aErrorString should be
stored in aStrLen – if this buffer is not large enough, then aStrLen will be updated to the size of buffer that is
required.

Note that unlike MMMReader_LL_GetLastError(), this API returns the error


message with formatting tokens in the string in the place of parameters, as there
is no context to the error message. Therefore, care should be taken to ensure
these strings are not supplied to a “printf” style function which will expect
additional parameters.

11.4 MMMReader_InitialiseLogging

Prototype:
MMMReaderErrorCode MMMReader_InitialiseLogging(
bool aEnabled,
int aLogLevel,
int aLogMask,
char* aFilename
);

Description:

This API initialises the logging functionality, and opens the log file, depending upon the aEnabled flag. When
logging is enabled, messages will be written to the file specified by aFilename if the logging level of the
message is equal to or lower than the aLogLevel supplied. aLogMask allows certain areas of the logging to be
disabled to reduce the logging to specific areas, although in general we would recommend this is left at -1 to log
all areas.

The log is opened upon calling this API, and is flushed periodically, however not upon every write so as to avoid
harming performance significantly.

Page 74 of 96
Low Level API Programming Manual

11.5 MMMReader_ShutdownLogging

Prototype:
MMMReaderErrorCode MMMReader_ShutdownLogging();

Description:

This closes the log file opened by MMMReader_InitialiseLogging(), ensuring that all data has been written to
the log. Applications using the log must call this prior to terminating to ensure that the log file is complete.

11.6 MMMReader_LL_LogMessage

Prototype:
MMMReaderErrorCode MMMReader_LL_LogMessage(
int aLevel,
int aMask,
char* aLocation,
char* aMessage
);

Description:

This API writes an entry to the log file. The message will only be logged if the current logging level is greater
than or equal to the current aLevel parameter, and will only be logged if a bitwise-and of aMask and the current
log-mask is non-zero.

The aLocation parameter is prefixed onto the aMessage text prior to logging, and is intended to provide
references to the current location. Developers may wish to use the __FILE__ and __FUNCTION__ pre-
processor macros to obtain references to the current source-code location.

11.7 MMMReader_LL_LogFormatted

Prototype:
MMMReaderErrorCode MMMReader_LL_LogFormatted(
int aLevel,
int aMask,
char* aLocation,
char* aFormat,

);

Description:

This API writes an entry to the log file. The message will only be logged if the current logging level is greater
than or equal to the current aLevel parameter, and will only be logged if a bitwise-and of aMask and the current
log-mask is non-zero.

Page 75 of 96
Low Level API Programming Manual

The aLocation parameter is prefixed onto the aFormat text prior to logging, and is intended to provide
references to the current location. Developers may wish to use the __FILE__ and __FUNCTION__ pre-
processor macros to obtain references to the current source-code location.

This API differs from MMMReader_LL_LogMessage in that it acts more like the C function printf(); aFormat
can contain formatting flags and any number of optional parameters can follow after it, where each additional
parameter matches a formatting flag.

11.8 MMMReader_SetLoggingOptions

Prototype:
MMMReaderErrorCode MMMReader_SetLoggingOptions(
LoggingOptions* aLoggingOptions
);

Description:

Set additional options for configuring the log file. MMMReader_InitialiseLogging will set the file name,
maximum log level and log mask. This API can then also set:

• The number of log lines to cache before flushing to the file.


• The logging strategy. This determines the behaviour of the log file and determines what to do under
certain conditions.

Page 76 of 96
Low Level API Programming Manual

12 Miscellaneous APIs

12.1 MMMReader_LL_LoadSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadSettings(
MMMReaderSettings* aTheSettings
);

Description:

This API will load the INI file settings from a page reader MSD device and/or from the SDK configuration folder,
and populate the supplied MMMReaderSettings structure with the values contained within these INI files. If any
INI file is not present, this will return an error, however it will initialise the settings to the default values.

12.2 MMMReader_LL_LoadSettingsFromIniFile

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadSettingsFromIniFile(
MMMReaderSettings* aTheSettings,
char* aMMMReaderIniFilePath);

Description:

This API behaves the same as MMMReader_LL_LoadSettings() API, except that it can locate the INI files via
a specific MMMReader.ini file.

This can be used to load INI files from a specific location, rather than the default location on the page reader
and/or the SDK configuration folder. This would not be recommended for most customers - the
MMMReader_LL_LoadSettings() API is the preferred API for general use.

12.3 MMMReader_LL_SaveSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveSettings(
MMMReaderSettings* aSettings
);

Description:

This function will save the settings stored in the supplied structure back to the page reader MSD device and/or
the SDK configuration folder.

Page 77 of 96
Low Level API Programming Manual

Note that for efficiency, only changes that have been made since the settings were
loaded from the INI files will be saved, so manual edits made to the INI files while
the application is open will not be overridden by this API.

It is recommended to only use this API if the changes are truly intended to be persistent for all applications that
use the reader – if multiple applications use different values, it is recommended that they simply initialise the
preferred settings, but do not save them.

12.4 MMMReader_LL_InitialiseSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseSettings(
MMMReaderSettings* aSettings
);

Description:

This API will initialise the supplied settings structure with the default values.

Note that although the defaults are chosen as “sensible” values, some values
within the INI files are reader calibration specific, and so should be tuned to each
reader specifically. For example, the precise values for the exposure times of
images may vary based upon the illumination provided by the LEDs.

12.5 MMMReader_DestroyCachedData

Prototype:
MMMReaderErrorCode MMMReader_DestroyCachedData();

Description:

This API will free all data that has been allocated and returned to the calling application as data through
callbacks. Objects supplied to the callbacks should not be deleted by the client application, as this can cause
issues if the application is not using the same heap, and will cause an error to occur when this API is later
called.

This API cannot be called when there is any outstanding non-blocking operation, as this could cause issues with
the data being created at that time. This includes calling this API from within the callback function.

Page 78 of 96
Low Level API Programming Manual

After this API has been called, any pointers to objects supplied via the callbacks are no longer valid, and should
not be used.

Typically, this API would be called once a document has been fully processed, before re-entering the document
detection logic.

12.6 MMMReader_DestroyCachedObject

Prototype:
MMMReaderErrorCode MMMReader_DestroyCachedObject(
void* aObject
);

Description:

This API destroys a single object that has been supplied to a callback. This allows an application to free the
memory as soon as possible, rather than waiting until the document has been fully processed before performing
this. Therefore, using this API can provide better memory performance than using
MMMReader_DestroyCachedData().

Unlike MMMReader_DestroyCachedData(), this API may be used at any time – although care should be used
to ensure that the object being destroyed is no longer required.

12.7 MMMReader_LL_GetFileVersion

Prototype:
MMMReaderErrorCode MMMReader_LL_GetFileVersion(
char* aModule,
char* aVersionStr,
int* aVersionLen
);

Description:

This API extracts the file version from the DLL with the name aModule.

Note that this should be just the filename – it will automatically be located in the
same directory as the other SDK DLLs.

Page 79 of 96
Low Level API Programming Manual

12.8 MMMReader_LL_GetMMMReaderVersions

Prototype:
MMMReaderErrorCode MMMReader_LL_GetMMMReaderVersions(
char* aVersionStr,
int* aVersionLen
);

Description:

This API extracts version information from all SDK EXE and DLL files.

Note that the files listed are those within the same directory as the loaded DLLs.
The buffer aVersonStr will be updated to contain this in a format that can be
output to provide information to Gemalto. aVersionLen should be the length of the
buffer. If the buffer is not large enough, it will be updated to reflect the length of
buffer that is required.

12.9 MMMReader_LL_GetSerialNumber

Prototype:
MMMReaderErrorCode MMMReader_LL_GetSerialNumber(
char* aReaderDir,
char* aSerialStr,
int* aSerialLen
);

Description:

This returns the serial number of the reader in the aSerialStr buffer. The length of this buffer should be supplied
in aSerialLen – if the buffer is not large enough, this will be updated to the length of buffer required. aReaderDir
should be the location as identified by MMMReader_LL_LoadSettings().

12.10 MMMReader_LL_GetCameraSerialNumber

Prototype:
MMMReaderErrorCode MMMReader_LL_GetCameraSerialNumber(
int* aSerialNumber
);

Page 80 of 96
Low Level API Programming Manual

Description:

This returns the serial number of the camera device in the aSerialStr buffer. The length of this buffer should be
supplied in aSerialLen – if the buffer is not large enough, this will be updated to the length of buffer required.
aReaderDir should be the location as identified by MMMReader_LL_LoadSettings().

12.11 MMMReader_LL_GetAPIVersion

Prototype:
int MMMReader_LL_GetAPIVersion();

Description:

This returns the API version number of the Low Level API. This API version will not be incremented with every
release, but only with releases that alter the arguments of existing APIs or make other changes that require the
host application to be recompiled. If the version number of the specific release is required, either
MMMReader_LL_GetFileVersion() or MMMReader_LL_GetMMMReaderVersions() should be used.

12.12 MMMReader_LL_GetLastCompile

Prototype:
MMMReaderErrorCode MMMReader_LL_GetLastCompile(
char* aModule,
char* aDate,
int* aDateLength,
char* aTime,
int* aTimeLength
);

Description:

This API queries a number of DLLs and returns the date they were compiled, which provides a more reliable
timestamp than the file timestamp. aModule should be one of “OCRDll.dll”, “ReaderDll.dll”, “SoundDll,dll”,
“SettingsDll.dll”, “LedDll.dll”, “ImgDll.dll”, or “GPIODll.dll”.

The date and time that it was compiled will be returned as ASCII strings in the aDate and aTime buffers. The
length of these buffers should be set in the appropriate length parameter, and if the buffer is not large enough,
these will be updated to reflect the length of the buffer required.

Page 81 of 96
Low Level API Programming Manual

12.13 MMMReader_LL_GetModuleInfo

Prototype:
MMMReaderErrorCode MMMReader_LL_GetModuleInfo(
char* aModule,
char* aQuery,
char* aInfo,
int* aInfoLength
);

Description:

This API can be used to extract info from the VersionInfo resource within the DLL with the name supplied in
aModule.

Note that this should be just the filename – it will automatically be located in the
same directory as the other SDK DLLs.

The aQuery parameter indicates the item of data to be extracted – this may be one of the standard properties –
such as “ProductName”, “ProductVersion” or “CompanyName”.

The buffer at aInfo will be updated to contain the appropriate information. The size of this buffer should be
initialised at aInfoLength. If this buffer is not large enough, this will be updated to the size of buffer required.

12.14 MMMReader_LL_GetConnectedScanners

Prototype:
MMMReaderErrorCode MMMReader_LL_GetConnectedScanners(
char* aSerialNumbers,
int* aSerialNumbersLen,
int* aNumScanners
);

Description:

This API will return the serial numbers of all scanners that are currently connected to the PC. This API should
be used in conjunction with MMMReader_LL_SelectScanner() if there may be multiple readers connected to
the same PC.

12.15 MMMReader_LL_SelectScanner

Prototype:
MMMReaderErrorCode MMMReader_SelectScanner(
char* aSerialNumber
);

Page 82 of 96
Low Level API Programming Manual

Description:

This API should be called prior to calling MMMReader_LL_LoadSettings(), or any of the initialise functions.
This API indicates which Document Reader should be used by this application. This allows the Low Level API to
operate correctly when there are multiple readers connected to the same PC.

Note that special configuration may be required to operate in this manner, and so
customers wishing to use the readers in this way should contact Gemalto. If only
one scanner is connected, this API need not be called.

Also note that this API does not allow you to use multiple readers at the same
time within the same application – although it is possible to run two instances of
the application, each of which controls one reader.

12.16 MMMReader_GetHardwareConfig

Prototype:
MMMReaderHardwareConfig* MMMReader_GetHardwareConfig();

Description:

This API retrieves information about the reader that is currently connected. This should be called after calling
MMMReader_CameraInitialise() successfully to ensure a correctly populated structure.

Note: all of these settings are not set when the SETTINGS_INITIALISED event is received. You may need to
wait for the PLUGINS_INITIALISED event to make sure they are all set, such as puSupportsAntiglare for
example.

12.17 MMMReader_Reboot

Prototype:
MMMReaderErrorCode MMMReader_Reboot();

Description:

This API attempts to restart any document reader that is currently connected and may be in an error condition. It
may be of use to call this API in the case of errors that are not resolved by shutting down and re-initialising the
devices. Before calling this API, call the appropriate shutdown APIs for any modules that have been initialised,
and then call this blocking API, and then attempt to re-initialise the API.

Page 83 of 96
Low Level API Programming Manual

This API will only operate correctly if the user has permissions to enable / disable
devices in device manager. This may mean that the user needs to run the
application with “Administrator” permissions in a default Windows 7 installation.

This API is not currently supported in 64-bit editions of Windows.

12.18 MMMReader_CameraUpdateSettings

Prototype:
MMMReaderErrorCode MMMReader_CameraUpdateSettings(
MMMReaderSettings* aTheSettings);

Decription:

This API is required to update some settings to compensate for a changed image scale factor. The values
stored in the DocDetect and DocumentPositioning structures need to be adjusted for the scale factor. This
function is automatically called by the high level API UpdateSettings function.

Page 84 of 96
Low Level API Programming Manual

13 Extended Settings APIs


The extended Settings APIs can be used to provide more control over individual settings.

13.1 MMMReader_LL_SetRootIniFile

Prototype:
MMMReaderErrorCode MMMReader_LL_SetRootIniFile(
const char* aRootIniFilePath
);

Decription:

This API sets the root Ini file that the SDK uses to determine where all the SDK paths are located. This must be
a full file path.

The Ini file provided must supply the section [DIRECTORIES] with the following keys:
• RTE8000_ROOT – specifies the root directory where the SDK is installed, relative to the working
directory of the currently running process.
• BIN_DIR – specifies the Bin directory of the SDK, relative to the RTE8000_ROOT path.
• CONFIG_DIR – specifies the Config directory of the SDK, relative to the RTE8000_ROOT path.
• PLUGIN_DIR – specifies the Plugin directory of the SDK, relative to the RTE8000_ROOT path.
• DATA_DIR – specified the Data directory of the SDK, relative to the RTE8000_PATH.

13.2 MMMReader_LL_GetReaderDir

Prototype:
const char* MMMReader_LL_GetReaderDir();

Decription:

This API gets the full path to the MSD reader directory. This API only works when a Mass Storage Device
(MSD) is available, otherwise the working directory of the currently running process is returned.

13.3 MMMReader_LL_GetExeDir

Prototype:
const char* MMMReader_LL_GetExeDir();

Decription:

This API gets the full path to the working directory of the currently running process.

Page 85 of 96
Low Level API Programming Manual

13.4 MMMReader_LL_GetBinDir

Prototype:
const char* MMMReader_LL_GetBinDir();

Decription:

This API gets the full path to the Bin directory of the SDK, i.e. where all SDK binaries are located, as defined by
the root Ini file.

13.5 MMMReader_LL_GetConfigDir

Prototype:
const char* MMMReader_LL_GetConfigDir();

Decription:

This API gets the full path to the Config directory of the SDK, i.e. where all SDK configuration files are located,
as defined by the root Ini file.

13.6 MMMReader_LL_GetPluginDir

Prototype:
const char* MMMReader_LL_GetPluginDir();

Decription:

This API gets the full path to the Plugin directory of the SDK, i.e. where all SDK plugins are located, as defined
by the root Ini file.

13.7 MMMReader_LL_GetDataDir

Prototype:
const char* MMMReader_LL_GetDataDir();

Decription:

This API gets the full path to the Data directory of the SDK, i.e. where all SDK data files are located, as defined
by the root Ini file.

Page 86 of 96
Low Level API Programming Manual

13.8 MMMReader_LL_LoadCameraImageSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadCameraImageSettings(
CAMERASET* aCameraSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
DOCPOS* aDocPosSettings,
IMGSET* aImageSettings,
PHOTOSET* aPhotoSettings,
OCRSET* aOcrSettings,
OCRUSERSET* aOcrUserSettings,
DIRTDETECTSET* aDirtDetectSettings
);

Decription:

This API loads the settings required just for the Camera and Image Processing APIs. Pass in pointers to the
setting structures defined above.

13.9 MMMReader_LL_LoadCameraImageSettingsTwoSided

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadCameraImageSettings(
CAMERASET* aCameraSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
DOCPOS* aDocPosSettings,
DOCPOS* aDocPosSettingsSide2,
IMGSET* aImageSettings,
PHOTOSET* aPhotoSettings,
OCRSET* aOcrSettings,
OCRUSERSET* aOcrUserSettings,
DIRTDETECTSET* aDirtDetectSettings
);

Decription:

This API loads the settings required just for the Camera and Image Processing APIs. Pass in pointers to the
setting structures defined above.

13.10 MMMReader_LL_LoadSignalSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadSignalSettings(
SoundSettings* aSoundSettings
);

Decription:

Page 87 of 96
Low Level API Programming Manual

This API loads the settings required just for the Signalling APIs. Pass in pointers to the setting structures
defined above.

13.11 MMMReader_LL_LoadRFSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadRFSettings(
RFIDSettings* aRFSettings
);

Decription:

This API loads the settings required just for the RFID APIs. Pass in pointers to the setting structures defined
above.

Page 88 of 96
Low Level API Programming Manual

13.12 MMMReader_LL_LoadDebugSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadDebugSettings(
IMGDEBUG* aDebugSettings
);

Decription:

This API loads the settings required just for debugging values, such as saving images and setting the log level.

13.13 MMMReader_LL_LoadDataToSendSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadDataToSendSettings(
DATASENDSET* aDataToSendSettings
);

Decription:

This API loads the settings required just for the data to send settings, used primarily by the High Level API.
Pass in pointers to the setting structures defined above.

13.14 MMMReader_LL_LoadLoggingSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_LoadLoggingSettings(
LoggingSettings* aLoggingSettings
);

Decription:

This API loads the settings required just for the logging settings, used primarily by the High Level API. Pass in
pointers to the setting structures defined above.

Page 89 of 96
Low Level API Programming Manual

13.15 MMMReader_LL_InitialiseCameraImageSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseCameraImageSettings(
CAMERASET* aCameraSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
DOCPOS* aDocPosSettings,
IMGSET* aImageSettings,
PHOTOSET* aPhotoSettings,
OCRSET* aOcrSettings,
OCRUSERSET* aOcrUserSettings
);

Decription:

This API defaults the settings required just for the Camera and Image Processing APIs. Pass in pointers to the
setting structures defined above.

13.16 MMMReader_LL_InitialiseSignalSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseSignalSettings(
SoundSettings* aSoundSettings
);

Decription:

This API defaults the settings required just for the Signalling APIs. Pass in pointers to the setting structures
defined above.

13.17 MMMReader_LL_InitialiseRFSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseRFSettings(
RFIDSettings* aRFSettings
);

Decription:

This API defaults the settings required just for the RFID APIs. Pass in pointers to the setting structures defined
above.

Page 90 of 96
Low Level API Programming Manual

13.18 MMMReader_LL_InitialiseDebugSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseDebugSettings(
IMGDEBUG* aDebugSettings
);

Decription:

This API defaults the settings required just for debugging. Pass in pointers to the setting structures defined
above.

13.19 MMMReader_LL_InitialiseDataToSendSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseDataToSendSettings(
DATASENDSET* aDataToSendSettings
);

Decription:

This API defaults the settings required just for the data to send settings, primarily used by the High Level API.
Pass in pointers to the setting structures defined above.

13.20 MMMReader_LL_InitialiseLoggingSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_InitialiseLoggingSettings(
LoggingSettings* aLoggingSettings
);

Decription:

This API defaults the settings required just for the loggingsettings, primarily used by the High Level API. Pass in
pointers to the setting structures defined above.

Page 91 of 96
Low Level API Programming Manual

13.21 MMMReader_LL_SaveCameraImageSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveCameraImageSettings(
CAMERASET* aCameraSettings,
DOCDETECTSETTINGS* aDocDetectSettings,
DOCPOS* aDocPosSettings,
IMGSET* aImageSettings,
PHOTOSET* aPhotoSettings,
OCRSET* aOcrSettings,
OCRUSERSET* aOcrUserSettings
);

Decription:

This API saves the settings required just for the Camera and Image Processing APIs. Pass in pointers to the
setting structures defined above.

13.22 MMMReader_LL_SaveSignalSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveSignalSettings(
SoundSettings* aSoundSettings
);

Decription:

This API saves the settings required just for the Signalling APIs. Pass in pointers to the setting structures
defined above.

13.23 MMMReader_LL_SaveRFSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveRFSettings(
RFIDSettings* aRFSettings
);

Decription:

This API saves the settings required just for the RFID APIs. Pass in pointers to the setting structures defined
above.

Page 92 of 96
Low Level API Programming Manual

13.24 MMMReader_LL_SaveDebugSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveDebugSettings(
IMGDEBUG* aDebugSettings
);

Decription:

This API saves the settings required just for the debugging settings. Pass in pointers to the setting structures
defined above.

13.25 MMMReader_LL_SaveDataToSendSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveDataToSendSettings(
DATASENDSET* aDataToSendSettings
);

Decription:

This API saves the settings required just for the data to send settings, primarily used by the High Level API.
Pass in pointers to the setting structures defined above.

13.26 MMMReader_LL_SaveLoggingSettings

Prototype:
MMMReaderErrorCode MMMReader_LL_SaveLoggingSettings(
LoggingSettings* aLoggingSettings
);

Decription:

This API saves the settings required just for the logging settings, primarily used by the High Level API. Pass in
pointers to the setting structures defined above.

Page 93 of 96
Appendix A Low Level API Quick Reference
Name Description Name Description
Camera MMMReader_RFGetFile Returns raw data file from the RFID chip.
MMMReader_RFValidateDataGroup Validates a given data group.
MMMReader_CameraInitialise Initialises the Camera module.
MMMReader_RFDecodeDataGroup Extracts the data from the given data group.
MMMReader_CameraShutdown Shuts down the camera module.
MMMReader_RFValidateSignature Validates the signature on the chip.
MMMReader_IsCameraInitialised Indicates whether the camera module is initialised.
MMMReader_RFValidateSignedAttributes Validates the signed attributes on the chip.
MMMReader_CameraSuspend Disconnects from the camera device
MMMReader_RFGetAirBaudRate Returns the current air baud rate.
MMMReader_CameraResume Reconnects to the camera device
MMMReader_RFGetBACStatus Indicates the state of Basic Access Control.
MMMReader_IsCameraSuspended Indicates whether the camera is currently suspended.
MMMReader_RFGetChipId Returns the chip id of the currently open chip.
MMMReader_IsCameraActive Indicates whether the camera is in use.
MMMReader_RFResetPassport Clears all data associated with the RFID chip.
MMMReader_CameraCancelQueue Cancels all pending camera operations.
MMMReader_RFSendAPDU Allows direct access to the sending APDUs.
MMMReader_CameraDetectDocument Detects a document being placed on the window.
MMMReader_RFCheckActiveAuthentication Validates the chip using Active Authentication.
MMMReader_CameraDetectDocumentTwoSided Detects a document being placed on the window for double-
sided readers. MMMReader_RFValidateDocSignerCert Validates the doc signer certificates.
MMMReader_LocateDocument Locates a document already placed on the window MMMReader_RFSetCertificateCallback Callback to be used for obtaining certificates.
MMMReader_LocateDocumentTwoSided Locates a document already placed on the window for double-
sided readers.
Name Description
MMMReader_CameraTakeSnapshot Takes an image.
MMMReader_EnableUV Turns on the UV lamp Image Processing
MMMReader_GetUVEnabledTime Returns the time UV has been switched on. MMMReader_ImageProcessingInitialise Initialises the Image Processing module.
MMMReader_GetUVWarmupTime Returns the time remaining till UV is warmed up. MMMReader_ImageProcessingShutdown Shuts down the Image Processing module.
MMMReader_CameraCheckDetectBoxes Checks boxes to determine the document position. MMMReader_IsImageProcessingInitialised Indicates whether image processing is initialised.
MMMReader_IsImageProcessingActive Indicates that image processing is in use.
MMMReader_ImageProcessingCancelQueue Cancels all pending image processing operations.
Name Description
MMMReader_ImagePostProcessImage Post processes images to give “final” image.
RFID MMMReader_ImagePostProcessImageTwoSided Post processes double-sided images to give “final” image.
MMMReader_RFInitialise Initialises the RFID module. MMMReader_ImageReadCodeline Performs OCR on the image to read a codeline.
MMMReader_RFShutdown Shuts down the RFID module. MMMReader_ImageReadCodelineTwoSided Performs OCR on the double-sided image to read codeline(s).
MMMReader_IsRFInitialised Indicates whether the RFID module is initialised. MMMReader_ImageCropToCodeline Crops the image to the codeline portion.
MMMReader_RFSuspend Disconnects from the RFID device MMMReader_ImageCropToPhoto Crops the image to the passport photo.
MMMReader_RFResume Reconnects to the RFID device MMMReader_ImageConvertFormat Converts a buffer to a different image format.
MMMReader_IsRFSuspended Indicates whether the RFID is currently suspended MMMReader_ImagePerformSecurityCheck Performs a UV security check.
MMMReader_IsRFActive Indicates whether the RFID module is in use. MMMReader_ValidateCheckDigits Validates a codelines checkdigits.
MMMReader_RFIDCancelQueue Cancels all pending RFID operations. MMMReader_CollectQAMeasurements Collects QA data on the codeline.
MMMReader_RFOpen Opens an RFID chip. MMMReader_DocumentProcessingComplete Notifies SDK that all document processing is complete so any
MMMReader_RFWaitForOpen Waits for an RFID document to be placed, and opens it when post actions, such as eject document on CR5400 can be
found. performed.
MMMReader_RFWaitForRemoval Waits for an RFID document to be removed from the field.
MMMReader_RFPowerOff Powers off the RF antenna.
Name Description

Low level API Programming Manual.doc


Name Description Name Description
Image Processing – Plugins MMMReader_UHFGetMemoryBankData Read the contents of the desired memory bank from a UHF tag
that is present in the field of the reader.
MMMReader_ImagePluginLoad Loads the given plugin (eg barcodes).
MMMReader_UHFGetTagID Reads the TagID from a UHF tag that is present in the field of
MMMReader_ImagePluginUnLoad Unloads the given plugin. the reader.
MMMReader_ImagePluginDecode Decodes an image using a plugin
MMMReader_ImagePluginGetImageSettings Defines image settings for input images.
Name Description
MMMReader_ImagePluginGetRequiredImages Returns the names of image types required.
Parser
MMMReader_ParseInitialise Initialises the parsing module.
MMMReader_ParseShutdown Shuts down the parsing module and frees all related resources.
Name Description MMMReader_IsParsingInitialised Determines whether the parsing module has been initialised.
MMMReader_ParseCodeline Parses an ICAO complaint MRZ into its component fields.
Signalling Interface MMMReader_ParseAAMVA Parses a North American driving licence.
MMMReader_SignalInitialise Initialises the signalling interface.
MMMReader_CheckForAAMVA Checks whether a given piece of data is a NA driving licence.
MMMReader_SignalShutdown Shuts down the signalling interface.
MMMReader_SignalEvent Signals an event using the LEDs + sound.
MMMReader_LedEvent Signals an event using the LEDs. Name Description
MMMReader_SoundEvent Signals an event using sound. Miscellaneous
MMMReader_LL_LoadSettings Loads all INI settings into memory.
MMMReader_LL_SaveSettings Saves all INI settings to disk.
Name Description
MMMReader_LL_InitialiseSettings Initialises a settings structure with default values.
UHF MMMReader_LL_GetFileVersion Returns the version of a file.
MMMReader_UHFInitialise Initialises the UHF module and allocates resources required for MMMReader_LL_GetMMMReaderVersions Returns versions of all RTE files.
UHF read operations.
MMMReader_LL_GetSerialNumber Returns the serial number of the reader.
MMMReader_UHFShutdown Shuts down the UHF module and frees all related resources.
MMMReader_LL_GetCameraSerialNumber Returns the serial number of the camera.
MMMReader_IsUHFInitialised Determines whether the UHF module has been initialised.
MMMReader_LL_GetAPIVersion Returns the API version number.
MMMReader_UHFCancelQueue Cancels any pending UHF operations that have been queued by
non-blocking API calls within the UHF module, and attempts to MMMReader_LL_GetLastCompile Returns the compilation date of a module.
cancel any currently executing operation. MMMReader_LL_GetModule_info Return information about a given DLL.
MMMReader_IsUHFActive Determines whether any operation is currently active in the UHF MMMReader_DestroyCachedData Destroys all cached data supplied to callbacks.
module. MMMReader_DestroyCachedObject Destroys a given object.
MMMReader_UHFGetEPC Reads the EPC (Electronic Product Code) section from the EPC MMMReader_LL_GetConnectedScanners Lists the serial numbers of all connected Document Readers.
memory bank of a UHF tag that is present in the field of the
reader. MMMReader_LL_SelectScanner Indicates which reader to use when there are multiple.

Name Description

Error Handling
MMMReader_SetErrorHandler Assigns the error callback.
MMMReader_LL_GetLastError Returns the last error that occurred.
MMMReader_LL_GetErrorMessage Returns the string associated with an error code.
MMMReader_InitialiseLogging Initialises logging.
MMMReader_ShutdownLogging Stops logging, and closes the log file.
MMMReader_LL_LogMessage Logs a message to the log file.

Low level API Programming Manual.doc


Low level API Programming Manual.doc

You might also like