Skip to content

API Reference

jlduragos edited this page Nov 7, 2023 · 8 revisions

Packages

Exceptions

  • org.idpass.smartscanner.lib.exceptions
    • SmartScannerException

org.idpass.smartscanner.lib.config.BarcodeFormat

Enumeration of supported barcode formats, from com.google.mlkit.vision.barcode.

org.idpass.smartscanner.lib.config.BarcodeOptions

Data class to hold configuration for barcode scanning.

Constructor parameters:

Parameter Type Default Description
barcodeFormats List<String> null Values are valid BarcodeFormat strings.
barcodeScannerSize String null Value is a valid ScannerSize string.
idPassLiteSupport Boolean null

Static properties:

Property Type Description
BarcodeOptions.default BarcodeOptions Default barcode options.
BarcodeOptoins.defaultIdPassLite BarcodeOptions Default barcode options for ID PASS Lite scanning.

org.idpass.smartscanner.lib.config.OCROptions

Data class to hold configuration for the SmartScanner user interface.

Constructor parameters:

Parameter Type Default Description
regex String null returns text if it matches regex.
type String null
analyzeStart ImageResultType null Delays analyzing the image to give time for user to focus.

Static properties:

Property Type Description
OCROptions.default OCROptions Default OCR options.

org.idpass.smartscanner.lib.config.Config

Data class to hold configuration for the SmartScanner user interface.

Constructor parameters:

Parameter Type Default Description
background String null
font String null
imageResultType ImageResultType null
label String null
isManualCapture Boolean null
branding Boolean null
showGuide Boolean null Show MRZ target guide.
showOcrGuide Boolean null Show OCR target guide.
xGuide Number null Sets MRZ and OCR target guide's offset horizontally. Takes values 0.0-1.0.
yGuide Number null Sets MRZ and OCR target guide's offset vertically. Takes values 0.0-1.0.
widthGuide Number null Sets the width of target guide for MRZ and OCR.
heightGuide Number null Sets the height of target guide for MRZ and OCR.

Static properties:

Property Type Description
Config.default Config

org.idpass.smartscanner.lib.config.Fonts

Enumeration of supported fonts.

  • Fonts.NOTO_SANS_ARABIC
  • Fonts.ROBOTO
  • Fonts.SOURCE_SANS_PRO

org.idpass.smartscanner.lib.config.ImageResultType

Enumeration of supported image result types.

  • ImageResultType.PATH : The image will be saved in the file system and return the path to the file.
  • ImageResultType.BASE_64 : The image will be encoded in Base64 format and returned.

org.idpass.smartscanner.lib.config.Modes

Enumeration of supported SmartScanner capturing mode.

  • Modes.BARCODE : Capture barcodes.
  • Modes.IDPASS_LITE : Capture ID PASS Lite cards.
  • Modes.PDF_417 : Capture PDF417.
  • Modes.MRZ : Capture MRZ.
  • Modes.OCR : Capture OCR.
  • Modes.NFC_SCAN : Capture NFC.
  • Modes.QRCODE : Capture QRCode.

Enumeration of supported MRZ formats.

org.idpass.smartscanner.lib.config.ScannerOptions

Data class for configuration for the SmartScanner.

Constructor parameters:

Parameter Type Default Description
mode Modes Modes.MRZ
config Config null
mrzFormat MrzFormat null
barcodeOptions BarcodeOptions null

Static properties:

Property Type Description
ScannerOptions.defaultForBarcode ScannerOptions Default options when scanning for barcode.
ScannerOptions.defaultForMRZ ScannerOptions Default options when scanning for MRZ.
ScannerOptions.defaultForIdPassLite ScannerOptions Default options when scanning ID PASS Lite cards.

Static methods:

org.idpass.smartscanner.lib.config.ScannerSize

Enumeration of supported sizes for the scanner UI.

  • ScannerSize.SMALL
  • ScannerSize.MEDIUM
  • ScannerSize.LARGE
  • ScannerSize.CUSTOM_QR

org.idpass.smartscanner.lib.extensions.Context

Extends the Context class with additional methods.

Context extension methods

  • hideKeyboard() : Hides the virtual keyboard for the given View.
    • Parameters:
    • Returns: void

org.idpass.smartscanner.lib.extensions.Image

Extends the Bitmap, Image, and String classes with additional methods.

Bitmap extension methods

  • cacheImageToLocal() : Caches a Bitmap into the file system, with rotation and quality modifications.

    • Parameters:
      • localPath : String. The path where the image will be written to.
      • rotation : Int, default: 0. How much to rotate, in degrees. Accepts values from 0 to 360.
      • quality : Int, default: 100. Accepts values from 0 to 100.
    • Return: void
  • resizeBitmap() : Resizes a Bitmap into the provided dimensions.

    • Parameters:
      • newWidth : Int
      • newHeight : Int
    • Return: : Bitmap
  • encodeBase64() : Encodes a Bitmap into Base64.

    • Parameters:
      • rotation : Int, default: 0. How much to rotate, in degrees. Accepts values from 0 to 360.
    • Return: String, the Base64 representation of the image.
  • rotate() : Rotates a Bitmap.

    • Parameters:
      • rotation: Int, default: 0. How much to rotate, in degrees. Accepts values from 0 to 360.
    • Return:: Bitmap

Image extension methods

  • toBitmap() : Converts an Image object into a Bitmap object.
    • Parameters:
      • rotation: Int, default: 0. How much to rotate, in degrees. Accepts values from 0 to 360.
    • Return: Bitmap

String extension methods

  • decodeBase64() : Decodes a Bitmap from a Base64 String.

    • Parameters: None
    • Return: Bitmap, the decoded image.
  • toBitmap() : Reads the file in file system path represented by the String as a Bitmap.

    • Parameters: None
    • Return: Bitmap, the read image.

org.idpass.smartscanner.lib.extensions.Network

Extends the Context class with additional methods related to network connectivity.

Context extension methods

  • getConnectionType() : Returns the current connection type.
    • Parameters: None
    • Return: Int
      • 0: No connection
      • 1: Cellular / mobile data
      • 2: Wifi
      • 3: VPN

org.idpass.smartscanner.lib.extensions.Number

Extends the Int and Double classes with additional methods.

Int extension methods

  • Int.noValue() : Static method that returns 0.

Double extension methods

  • Double.noValue() : Static method that returns 0.0.

org.idpass.smartscanner.lib.extensions.String

Extends the String class with additional methods.

String extension methods

  • String.empty(): Static method that returns an empty string "".
  • String.space(): Static method that returns a space " ".
  • String.formatToSimpleDate() : Static method that formats a given date.
    • Parameters:
    • Return: String representation of the date in yyyyMMddHHmmss format.