unit fpengine;

interface

uses Windows,Messages, SysUtils, Variants,FMTBcd;

///////////////////////////////////////////////////////////////////////////////////////////////////
const
  FPDATASIZE=256;
  IMGWIDTH=256;
  IMGHEIGHT=288;
  IMGSIZE=73728;
///////////////////////////////////////////////////////////////////////////////////////////////////
//窗口自定义消息
  WM_FPMESSAGE=WM_USER+120;
  FPM_DEVICE=$01;			//状态提示
  FPM_PLACE=$02;			//请按手指
  FPM_LIFT=$03;			  //请抬起手指
  FPM_CAPTURE=$04;		//采集图像
  FPM_ENROLL=$06;			//登记指纹模版
  FPM_GENCHAR=05 ;    //采集特征点
  FPM_NEWIMAGE=$07;		//指纹图像
  FPM_TIMEOUT=$08;    //超时

  RET_OK:Integer=1;
  RET_FAIL:Integer=0;


////////////////////////////////////////////////////////////////////////////////////////////////////
//以下两个函数与设备有关，用于操作设备

//设置接受自定消息的窗体
procedure SetMsgMainHandle(hWnd:Integer);stdcall;external 'fpengine.dll';

//打开设备 style=1串口，0为USB
function OpenDevice(nPortNum:integer;nPortPara:integer;nDeviceType:integer):Integer;stdcall; external 'fpengine.dll';
//测试设备
function LinkDevice(): Integer;stdcall; external 'fpengine.dll';
//关闭设备
function CloseDevice(): Integer;stdcall; external 'fpengine.dll';

//从设备获取指纹图像数据
function GetFingerImage(var imagedata:BYTE;var size:Integer):Integer;stdcall; external 'fpengine.dll';
//在窗口上画指纹图像
function DrawFingerImage(var imagedata:Byte;size,hdc,left,top:Integer):Integer;stdcall; external 'fpengine.dll';
//在窗口上画指纹图像
function SetImage(var imagedata:Byte;wImageWidth,wImageHeight:Word):Integer;stdcall; external 'fpengine.dll';
function DrawImage(hdc,left,top:Integer):Integer;stdcall; external 'fpengine.dll';

function DrawImageEx(hdc,left,top,zoom:Integer;color:COLORREF):Integer;stdcall; external 'fpengine.dll';

function SetDispOption(bSet:Integer;iZoom:Real;clrBack,clrForce:COLORREF):Integer;stdcall; external 'fpengine.dll';

//获取设备内指纹模板数
function DevGetTemplatesCount(var count:Integer):Integer;stdcall; external 'fpengine.dll';
//清除设备内指纹模板
function DevClearTemplates():Integer;stdcall; external 'fpengine.dll';
//登记指纹模板到设备
function DevEnrollTemplate(id:Integer):Integer;stdcall; external 'fpengine.dll';
//在设备内比对指定编号的模板
function DevVerifyTemplate(id:Integer;var iScore:Integer):Integer;stdcall; external 'fpengine.dll';
//在设备内搜索指纹
function DevIdentifyTemplate(var id:Integer):Integer;stdcall; external 'fpengine.dll';

//登记指纹模板到计算机
function EnrollToPc(var templates:Byte;var tempsize:Integer):Integer;stdcall; external 'fpengine.dll';
//提取指纹特征点到计算机
function GenCharToPc(var templates:Byte;var tempsize:Integer):Integer;stdcall; external 'fpengine.dll';
//在设备内比对指纹模板
function MatchOneToOne(var templates1:Byte;tempsize1:Integer;var templates2:Byte;tempsize2:Integer;var iScore:Integer):Integer;stdcall; external 'fpengine.dll';
//在设备内比对指纹模板
function MatchInDevice(var templates1:Byte;tempsize1:Integer;var templates2:Byte;tempsize2:Integer;var iScore:Integer):Integer;stdcall; external 'fpengine.dll';
//在设备内验证指纹模板
function VerifyInDevice(var templates1:Byte;tempsize1:Integer;var iScore:Integer):Integer;stdcall; external 'fpengine.dll';

//在消息中用GetImage获取指纹图像
function GetImage(var imagedata:Byte;var size:Integer):Integer;stdcall; external 'fpengine.dll';
//设置登记次数等
function EnrollSet(icount,bvalid:Integer):Integer;stdcall; external 'fpengine.dll';
//////////////////////////////////////////////////////////////////////////////////////////////////

//采集指纹图像
procedure CaptureImage();stdcall;external 'fpengine.dll';
//获取指纹特征点
procedure GenFpChar();stdcall;external 'fpengine.dll';
//登记指纹模板
procedure EnrolFpChar();stdcall;external 'fpengine.dll';

function GetWorkMsg():Integer;stdcall; external 'fpengine.dll';
function GetRetMsg():Integer;stdcall; external 'fpengine.dll';
function ReleaseMsg():Integer;stdcall; external 'fpengine.dll';

function GetFpCharByGen(var fpdata:Byte;var size:Integer):Integer;stdcall; external 'fpengine.dll';
function GetFpCharByEnl(var fpdata:Byte;var size:Integer):Integer;stdcall; external 'fpengine.dll';
function GetFpStrByGen(var tpstr:Char):Integer;stdcall; external 'fpengine.dll';
function GetFpStrByEnl(var fpstr:Char):Integer;stdcall; external 'fpengine.dll';



////////////////////////////////////////////////////////////////////////////////////////////////////
//以下两个函数与设备无关，用于从图象中生成模板和比对模板

//从指纹图像提取提取特征并生成模板,
//pFingerData	指纹图象数据,大小为256*288,
//pTemplate		提取出的指纹特征,256字节大小.
//返回1表示成功
function CreateTemplate(var pFingerData:Byte;var pTemplate:Byte): Integer;stdcall; external 'fpengine.dll';
//比对指纹特征点
//pSrcData，pDstData是要匹配的指纹特征
//返回分数，一般大于50分表示成功。也可以设置其它分数,分数越高,安全等级越高
function MatchTemplate(var pSrcData:Byte;var pDstData:Byte): Integer;stdcall; external 'fpengine.dll';

function MatchTemplateEx(var pSrcData:Char;var pDstData:Char): Integer;stdcall; external 'fpengine.dll';

function SetStatusLed(types,status:Integer): Integer;stdcall; external  'fpengine.dll';

implementation

end.
