com.rscja.deviceapi

## Class Fingerprint

- java.lang.Object
- - com.rscja.deviceapi.Fingerprint

- All Implemented Interfaces:
    IFingerprint

      public class Fingerprint
      extends java.lang.Object
      implements IFingerprint

  指纹识别模块操作类,
  Fingerprint identify module operation type

  注意：
  Note:
  1、使用前请确认您的机器已安装此模块。
  1. Please make sure this module is installed in your device before using.
  2、要正常使用模块需要在\libs\armeabi\目录放置libDeviceAPI.so文件
  2. Put libDeviceAPI.so file in directory \libs\armeabi\ then module can be used normally.
  3、在操作设备前需要调用 `init()` 打开设备，使用完后调用 `free()` 关闭设备
  3. Before operating the device, call `init()` to switch on the device, then call `free()` to switch off the device.

  Author:
    liuruifeng

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Fingerprint.BufferEnum` 模块缓冲区枚举 Module buffer zone example.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `autoEnroll(int count, int userID)` 刷指定次数指纹，模块自动完成注册功能 Scan fingerprint in specified number, module complete registered function automatically
    `int[]` | `autoMatch(int count, int startPage, int pageNum)` 刷指定次数指纹，自动完成比对功能 Scan fingerprint in specified number, complete comparison function automatically
    `boolean` | `deletChar(int pageID, int num)` 删除库中特征值 delete feature value in database.
    `boolean` | `downChar(Fingerprint.BufferEnum buffer, java.lang.String hexStr)` 下载特征数据到指定缓存区 download feature data to specified buffer zone
    `boolean` | `empty()` 清空模块中保存的指纹数据 empty out saved fingerprint data in module.
    `boolean` | `free()` 释放指纹模块 Release fingerprint module.
    `boolean` | `genChar(Fingerprint.BufferEnum buffer)` 生成特征值（存于指定缓存区） Generate feature value( save in specified buffer zone)
    `boolean` | `getImage()` 获取指纹图像（存于模块图像缓存区） Acquire fingerprint image( save in buffer zone of module image)
    `static Fingerprint` | `getInstance()` 获取指纹模块操作实例 Acquire fingerprint module operation Instance.
    `java.lang.String` | `getRandomData()` 获取随机数，检测模块是否正常 Acquire random number, detect module is normal or not.
    `java.lang.String` | `getVersion()` 获取模块版本 Acquire module version
    `boolean` | `init()` 初始化指纹模块，默认波特率为57600 Initialize fingerprint module, default baud rate is 57600.
    `boolean` | `init(int baudrate)` 初始化指纹模块 Initialize fingerprint module.
    `boolean` | `isPowerOn()`
    `boolean` | `loadChar(Fingerprint.BufferEnum buffer, int pageID)` 加载指定ID页到特征值缓存区 Load specified ID page to feature value buffer zone
    `int` | `match()` 对比模板缓冲区1与模板缓冲区2的指纹模板文件 fingerprint template file of comparison template buffer zone 1 and template buffer zone 2.
    `java.lang.String` | `readChipSN()` 获取芯片序列号 acquire chip serial number
    `java.lang.String` | `readSysPara()` 获取系统参数，仅返回版本号 Acquire system parameter, return version number only
    `java.lang.String[]` | `readSysParaMore()` 获取系统参数 Acquire system parameter
    `boolean` | `regModel()` 合并特征文件。将模板缓冲区1与模板缓冲区2中的模板文件合并生成模板，结果存于模板缓冲区1。 Combine feature file.
    `int[]` | `search(Fingerprint.BufferEnum buffer, int startPage, int pageNum)` 检索指纹库 Searching fingerprint database
    `boolean` | `setDeviceName(java.lang.String name)` 设置设备名称 Setup device name
    `boolean` | `setManuFacture(java.lang.String name)` 设置厂商名称 Setup manufacture name
    `boolean` | `setPWD(java.lang.String passWord)` 设置密码 Setup password
    `boolean` | `setReg(int regID, int value)` 设置寄存器值，修改模块参数 Setup the value in RAM, modify the parameter in module.
    `boolean` | `storChar(Fingerprint.BufferEnum buffer, int pageID)` 存储模板文件。将模板缓冲区buffer中的模板文件存到 PageID号所对应的指纹库位置 save templatefile.
    `java.lang.String` | `upChar(Fingerprint.BufferEnum buffer)` 上传指定缓冲区中的指纹特征数据 Upload fingerprint feature data of specified buffer zone
    `int` | `upImage(int mode, java.lang.String fileName)` 上传指纹图像文件 Upload finerprint image file
    `int` | `upImageISO(int mode, java.lang.String fileName)` 上传指纹ISO图像文件 Upload fingerprint ISO image file
    `boolean` | `validPWD(java.lang.String passWord)` 验证密码 Verify password
    `int` | `validTempleteNum()` 获取模块中已保存的指纹特征数据个数 Acquire number of saved fingerprint feature data in module

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static Fingerprint getInstance()
                                         throws ConfigurationException

      获取指纹模块操作实例
      Acquire fingerprint module operation Instance.
      Returns:
        指纹模块操作实例
        fingerprint module operation example.
      Throws:
        `ConfigurationException` - 配置错误异常
        configuration error

    - #### init

          public boolean init()

      初始化指纹模块，默认波特率为57600
      Initialize fingerprint module, default baud rate is 57600.
      Specified by:
        `init` in interface `IFingerprint`
      Returns:
        true成功，false失败

    - #### init

          public boolean init(int baudrate)

      初始化指纹模块
      Initialize fingerprint module.
      Specified by:
        `init` in interface `IFingerprint`
      Parameters:
        `baudrate` - 波特率(57600或115200)
        Baud rate(57600 or 115200)
      Returns:
        true成功，false失败

    - #### free

          public boolean free()

      释放指纹模块
      Release fingerprint module.
      Specified by:
        `free` in interface `IFingerprint`
      Returns:
        true成功，false失败

    - #### getRandomData

          public java.lang.String getRandomData()

      获取随机数，检测模块是否正常
      Acquire random number, detect module is normal or not.
      Specified by:
        `getRandomData` in interface `IFingerprint`
      Returns:
        random number content in hexdecimal format, null means failure.

    - #### getImage

          public boolean getImage()

      获取指纹图像（存于模块图像缓存区）
      Acquire fingerprint image( save in buffer zone of module image)
      Specified by:
        `getImage` in interface `IFingerprint`
      Returns:
        true成功，false失败

    - #### genChar

          public boolean genChar(Fingerprint.BufferEnum buffer)

      生成特征值（存于指定缓存区）
      Generate feature value( save in specified buffer zone)
      Specified by:
        `genChar` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓冲区编号枚举 Buffer zone code example
      Returns:
        true成功，false失败

    - #### search

          public int[] search(Fingerprint.BufferEnum buffer,
                              int startPage,
                              int pageNum)

      检索指纹库
      Searching fingerprint database
      Specified by:
        `search` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓存区
        Buffer zone
        `startPage` - 页开始ID
        Page start ID
        `pageNum` - 从startPage开始的num个
        Page number from start Page
      Returns:
        number 0 is page ID, 1st element is comparison result, feedback null if it is failure.

    - #### match

          public int match()

      对比模板缓冲区1与模板缓冲区2的指纹模板文件
      fingerprint template file of comparison template buffer zone 1 and template buffer zone 2.
      Specified by:
        `match` in interface `IFingerprint`
      Returns:
        comparison score, if comparison failed, feedback is -1.

    - #### regModel

          public boolean regModel()

      合并特征文件。将模板缓冲区1与模板缓冲区2中的模板文件合并生成模板，结果存于模板缓冲区1。
      Combine feature file. combine the template file in template buffer zone 1 and template buffer zone 2 then generate template, save the result in template buffer zone 1.
      Specified by:
        `regModel` in interface `IFingerprint`
      Returns:
        true成功，false失败

    - #### storChar

          public boolean storChar(Fingerprint.BufferEnum buffer,
                                  int pageID)

      存储模板文件。将模板缓冲区buffer中的模板文件存到 PageID号所对应的指纹库位置
      save templatefile. save the template file of template buffer zone in according position of PageID.
      Specified by:
        `storChar` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓冲区
        Buffer zone
        `pageID` - 页ID，值为0~254
        PageID, value range 0~254
      Returns:
        true成功，false失败

    - #### loadChar

          public boolean loadChar(Fingerprint.BufferEnum buffer,
                                  int pageID)

      加载指定ID页到特征值缓存区
      Load specified ID page to feature value buffer zone
      Specified by:
        `loadChar` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓存区
        Buffer zone
        `pageID` - 页ID
        Page ID
      Returns:
        true成功，false失败

    - #### upChar

          public java.lang.String upChar(Fingerprint.BufferEnum buffer)

      上传指定缓冲区中的指纹特征数据
      Upload fingerprint feature data of specified buffer zone
      Specified by:
        `upChar` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓存区
        buffer zone
      Returns:
        hexdecimal feature value, null means failure.

    - #### downChar

          public boolean downChar(Fingerprint.BufferEnum buffer,
                                  java.lang.String hexStr)

      下载特征数据到指定缓存区
      download feature data to specified buffer zone
      Specified by:
        `downChar` in interface `IFingerprint`
      Parameters:
        `buffer` - 缓存区
        Buffer zone
        `hexStr` - 十六进制特征数据
        hexdecimal feature data
      Returns:
        true成功，false失败

    - #### deletChar

          public boolean deletChar(int pageID,
                                   int num)

      删除库中特征值
      delete feature value in database.
      Specified by:
        `deletChar` in interface `IFingerprint`
      Parameters:
        `pageID` - 页ID
        PageID
        `num` - 从PageID开始的num个
        Page number from PageID.
      Returns:
        true成功，false失败

    - #### empty

          public boolean empty()

      清空模块中保存的指纹数据
      empty out saved fingerprint data in module.
      Specified by:
        `empty` in interface `IFingerprint`
      Returns:
        true成功，false失败

    - #### setReg

          public boolean setReg(int regID,
                                int value)

      设置寄存器值，修改模块参数
      Setup the value in RAM, modify the parameter in module.
      Specified by:
        `setReg` in interface `IFingerprint`
      Parameters:
        `regID` - 寄存器ID
        RAM ID
        `value` - 需要修改的值
        Values need to be modified
      Returns:
        true成功，false失败

    - #### autoEnroll

          public int autoEnroll(int count,
                                int userID)

      刷指定次数指纹，模块自动完成注册功能
      Scan fingerprint in specified number, module complete registered function automatically
      Specified by:
        `autoEnroll` in interface `IFingerprint`
      Parameters:
        `count` - 次数
        frequency
        `userID` - 注册ID
        Registered ID
      Returns:
        register success return ID, failure return -1

    - #### autoMatch

          public int[] autoMatch(int count,
                                 int startPage,
                                 int pageNum)

      刷指定次数指纹，自动完成比对功能
      Scan fingerprint in specified number, complete comparison function automatically
      Specified by:
        `autoMatch` in interface `IFingerprint`
      Parameters:
        `count` - 次数
        frequency
        `startPage` - 起始页
        Start page
        `pageNum` - 页数
        Page number
      Returns:
        1st element is successful matchin ID, 2nd element is comparison score, null is failure.

    - #### validTempleteNum

          public int validTempleteNum()

      获取模块中已保存的指纹特征数据个数
      Acquire number of saved fingerprint feature data in module
      Specified by:
        `validTempleteNum` in interface `IFingerprint`
      Returns:
        successful return number of fingerprint feature data, failed return -1

    - #### readChipSN

          public java.lang.String readChipSN()

      获取芯片序列号
      acquire chip serial number
      Specified by:
        `readChipSN` in interface `IFingerprint`
      Returns:
        hexdecimal chip serial number, null is failure

    - #### setManuFacture

          public boolean setManuFacture(java.lang.String name)

      设置厂商名称
      Setup manufacture name
      Specified by:
        `setManuFacture` in interface `IFingerprint`
      Parameters:
        `name` - 名称,缓存 8字节
        Name, cache 8 bytes
      Returns:
        true成功，false失败

    - #### setDeviceName

          public boolean setDeviceName(java.lang.String name)

      设置设备名称
      Setup device name
      Specified by:
        `setDeviceName` in interface `IFingerprint`
      Parameters:
        `name` - 设备名称,缓存 8字节
        Device name, cache 8 byte
      Returns:
        true成功，false失败

    - #### readSysPara

          public java.lang.String readSysPara()

      获取系统参数，仅返回版本号
      Acquire system parameter, return version number only
      Specified by:
        `readSysPara` in interface `IFingerprint`
      Returns:
        hexdecimal parameter data, null is failure

    - #### getVersion

          public java.lang.String getVersion()

      获取模块版本
      Acquire module version
      Specified by:
        `getVersion` in interface `IFingerprint`
      Returns:
        null is failure

    - #### upImage

          public int upImage(int mode,
                             java.lang.String fileName)

      上传指纹图像文件
      Upload finerprint image file
      Specified by:
        `upImage` in interface `IFingerprint`
      Parameters:
        `mode` - 是否带bmp格式头文件 0表示不带 大于0表示带。默认为1
        be with bmp header file or not, 0 means without, greater than 0 means with. Default 1
        `fileName` - 文件路径，包括文件名，函数根据该参数生成图像文件
        File directory, including file name, the formula will generate image file according to this parameter
      Returns:
        success return image size value, failure return -1

    - #### upImageISO

          public int upImageISO(int mode,
                                java.lang.String fileName)

      上传指纹ISO图像文件
      Upload fingerprint ISO image file
      Specified by:
        `upImageISO` in interface `IFingerprint`
      Parameters:
        `mode` - 是否带bmp格式头文件 0表示不带 大于0表示带。默认为1
        be with bmp header file or not, 0 means without, greater than 0 means with. Default 1
        `fileName` - 文件路径，包括文件名，函数根据该参数生成图像文件
        file directory, including file name, formula will generate image file according to this parameter
      Returns:
        success return image size value, failure return -1

    - #### setPWD

          public boolean setPWD(java.lang.String passWord)

      设置密码
      Setup password
      Specified by:
        `setPWD` in interface `IFingerprint`
      Parameters:
        `passWord` - 密码
        password
      Returns:
        true成功，false失败

    - #### validPWD

          public boolean validPWD(java.lang.String passWord)

      验证密码
      Verify password
      Specified by:
        `validPWD` in interface `IFingerprint`
      Parameters:
        `passWord` - 密码
        Password
      Returns:
        true成功，false失败

    - #### readSysParaMore

          public java.lang.String[] readSysParaMore()

      获取系统参数
      Acquire system parameter
      Specified by:
        `readSysParaMore` in interface `IFingerprint`
      Returns:
        [0]safety level [1]distribute size [2]baud rate [3]product serial code [4]version number [5]manufacture code [6]sensor name, null means failure

    - #### isPowerOn

          public boolean isPowerOn()

      Specified by:
        `isPowerOn` in interface `IFingerprint`