第二代居民身份证阅读器GTICR100函数包使用手册.docx

上传人:b****6 文档编号:7988888 上传时间:2023-01-27 格式:DOCX 页数:17 大小:48.11KB
下载 相关 举报
第二代居民身份证阅读器GTICR100函数包使用手册.docx_第1页
第1页 / 共17页
第二代居民身份证阅读器GTICR100函数包使用手册.docx_第2页
第2页 / 共17页
第二代居民身份证阅读器GTICR100函数包使用手册.docx_第3页
第3页 / 共17页
第二代居民身份证阅读器GTICR100函数包使用手册.docx_第4页
第4页 / 共17页
第二代居民身份证阅读器GTICR100函数包使用手册.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

第二代居民身份证阅读器GTICR100函数包使用手册.docx

《第二代居民身份证阅读器GTICR100函数包使用手册.docx》由会员分享,可在线阅读,更多相关《第二代居民身份证阅读器GTICR100函数包使用手册.docx(17页珍藏版)》请在冰豆网上搜索。

第二代居民身份证阅读器GTICR100函数包使用手册.docx

第二代居民身份证阅读器GTICR100函数包使用手册

第二代居民身份证阅读器GTICR-100函数包使用手册

文档控制

文档更新记录

文档编号:

编制单位

产品部

本次修改日期:

2005.04.19

审核单位

总工办

历史修改累记:

2

审核主管

技术总监

目录

1概述4

2定义4

3函数列表4

4函数调用流程6

5函数说明6

6用户信息函数组使用时的调用顺序说明11

7一个完整的示例:

12

1         概述

本手册是操作身份证阅读器应用函数的定义格式、调用方法和返回值的说明。

1.      使用前请确认授权文件termb.lic在PC机C:

\根目录下。

2.      使用USB接口则请先安装对应系统的USB驱动;

3.      termb.dll是主DLL,sdtapi.dll和WltRS.dll被termb.dll调用;用户可不必关心sdtapi.dll和WltRS.dll,但三个DLL要求要放在同一个目录下;

4.      termb.dll、sdtapi.dll和WltRS.dll同时拷贝到调用此Dll的应用软件Exe文件所在目录下。

5.      termb.dll输出的文件放在调用者(*.exe)所在目录;

2         定义

应用函数开发包含在下列文件:

termb.dllAPI函数的动态联接库

(termb.dll的输出文件放在调用者所在目录中)

适用操作系统:

WindowsNT:

需要NT3.1版或以后版本

Windows:

需要Windows98、Windows2000或以后版本

适用开发语言:

VisualC++5.0及以后版本

VisualBasic5.0及以后版本

DELPHI3.0及以后版本

PowerBuilder6.0及以后版本

3        函数列表

序号

函数定义

函数功能

1.      

Int_stdcallInitComm(intPort)

初始化串口;

2.      

int_stdcallCloseComm()

关闭串口;

3.      

int_stdcallAuthenticate()

卡认证;

4.      

int_stdcallRead_Content(intActive)

读卡操作。

5.      

int_stdcallGetPeopleName(char*strTmp,intstrLen)

得到姓名信息

6.      

int_stdcallGetPeopleSex(char*strTmp,intstrLen)

得到性别信息

7.      

int_stdcallGetPeopleNation(char*strTmp,intstrLen)

得到民族信息

8.      

int_stdcallGetPeopleBirthday(char*strTmp,intstrLen)

得到出生日期

9.      

int_stdcallGetPeopleAddress(char*strTmp,intstrLen)

得到地址信息

10.   

int_stdcallGetPeopleIDCode(char*strTmp,intstrLen)

得到卡号信息

11.   

int_stdcallGetDepartment(char*strTmp,intstrLen)

得到发证机关信息

12.   

int_stdcallGetStartDate(char*strTmp,intstrLen)

得到有效启始日期

13.   

int_stdcallGetEndDate(char*strTmp,intstrLen)

得到有效截止日期

14.   

int_stdcallGetReserve(char*strTmp,intstrLen)

得到保留信息

15.   

int_stdcallSetBaseData(char*TxtFileName)

设置基本信息

16.   

int_stdcallSetPhotoData(char*WltFileName)

设置照片WLT信息

4         

函数调用流程

 

5        函数说明

5.1初始化串口

原型:

intInitComm(intPort)

说明:

本函数用于计算机的串口初始化。

参数:

Port:

设置串口

意义

1

串口1

2

串口2

3

串口3

4

串口4

1001

USB1

1002

USB2

1003

USB3

1004

USB4

注意:

使用ICR-300系列产品进行二次开发时,固定为串口2。

返回值:

意义

1

正确

其它

错误

示例:

#include

intmain()

{

intli_ret=0;

intli_Port=1;

li_ret=InitComm(li_Port);

returnli_ret;

}

5.2关闭串口

原型:

intCloseComm(void)

说明:

本函数用于关闭计算机已经打开的串口。

参数:

返回值:

意义

1

正确

其它

错误

示例:

#include

intmain()

{

intli_ret=0;

li_ret=CloseComm()

returnli_ret;

}

5.3卡认证

原型:

intAuthenticate(void)

说明:

本函数用于读卡器和卡片之间的合法身份确认。

参数:

返回值:

意义

说明

1

正确

卡片正确放置时

其它

错误

未放卡或卡片放置不正确时

注意:

若卡片放置后发生认证错误时,应移走卡片重新放置。

示例:

#include

intmain()

{

intli_ret=0;

li_ret=authenticate()

returnli_ret;

}

注意:

若采用查询方式自动判断卡片是否放置,则间隔时间建议大于300ms。

5.4读卡操作

原型:

intRead_Content(intActive);

说明:

本函数用于通过读卡器从非接触卡中读取相应信息。

参数:

Active读取信息类型

Active值

意义

说明

1

读基本信息

形成文字信息文件WZ.TXT、相片文件XP.WLT和ZP.BMP

2

只读文字信息

形成文字信息文件WZ.TXT和相片文件XP.WLT

3

读最新住址信息

形成最新住址文件NEWADD.TXT

5

读芯片管理号

形成二进制文件IINSNDN.bin

返回值:

意义

1

正确

0

读卡错误

-1

相片解码错误

-2

wlt文件后缀错误

-3

wlt文件打开错误

-4

wlt文件格式错误

-5

软件未授权

-6

设备连接失败

注意:

1、 读完基本信息后,若需要立即读取最新住址信息或芯片管理号,在未移走卡片的情况下可以不用卡认证;

2、 单独读取最新住址信息或芯片管理号时,需要先进行卡认证;

3、若卡片放置后发生读卡错误时,应移走卡片重新放置。

文字信息采用GB13000的UCS-2进行存储,各项目分配如下:

项目

长度(字节)

说明

姓名

30

汉字

性别

2

代码

民族

4

代码

出生

16

年月日:

YYYYMMDD

住址

70

汉字和数字

公民身份号码

36

数字

签发机关

30

汉字

有效期起始日期

16

年月日:

YYYYMMDD

有效期截止日期

16

年月日:

YYYYMMDD

有效期为长期时存储“长期”

预留区

36

保留信息

最新住址

70

汉字和数字

芯片管理号分配如下:

项目

长度(字节)

说明

IIN

4

SN

8

DN

16

5.5用户信息函数组

该组函数用于读取当前系统缓冲中的二代证卡内信息。

该组函数具有如下特点:

●      得到的字符信息全部为ANSI编码方式;可以直接用来显示;

●      得到的字符信息已经按照相关标准作了相应转换;将性别编码转换成了相应的文字信息(如1-“男”),将民族编码转换成了相应的文字信息(如04-“藏”);

●      该组函数返回值表示一致,含义如下:

0:

表示取到的字符信息不完整,增大strTmp参数分配的内存,就可完整读出信息;

(用户信息各字段的长度定义见下表)

非0:

表示读出的字节总数;

用户信息各字段的长度定义(单位:

字节)

姓名

30

性别

2

民族

4

出生日期

16

住址

70

身份号码

36

签发机关

30

有效启始日期

16

有效截止日期

16

保留

36

A.读取卡内姓名信息

原型:

intSTDCALLGetPeopleName(char*strTmp,unsignedintstrLen);

说明:

本函数用于读取ANSI字符编码方式的姓名信息;

参数:

[out]strTmp读到的信息;

 [in]strLen表示strTmp参数分配的内存空间大小(单位:

字节);

 

B.其他函数原型如下:

读性别信息:

int_stdcallGetPeopleSex(char*strTmp,unsignedintstrLen);

读民族信息:

int_stdcallGetPeopleNation(char*strTmp,unsignedintstrLen);

读出生日期:

int_stdcallGetPeopleBirthday(char*strTmp,unsignedintstrLen);

读住址信息:

int_stdcallGetPeopleAddress(char*strTmp,unsignedintstrLen);

读身份号码:

int_stdcallGetPeopleIDCode(char*strTmp,unsignedintstrLen);

读签发机关:

int_stdcallGetDepartment(char*strTmp,unsignedintstrLen);

读有效启始日期:

int_stdcallGetStartDate(char*strTmp,unsignedintstrLen);

读有效截止日期:

int_stdcallGetEndDate(char*strTmp,unsignedintstrLen);

读保留信息:

int_stdcallGetReserve(char*strTmp,unsignedintstrLen);

读照片信息:

int_stdcallGetPhotoBMP(char*Photo,unsignedintLen);

5.6数据解析函数

以下两个函数主要是用在无卡状态下解析保存在文件中的历史二代证信息;

●      将人员基本信息文件名(带全路径)通过SetBaseData函数送入termb.dll中后,该Dll将解析人员基本信息;外部程序可通过调用“读用户信息函数组”中的函数得到想要的信息;

●      将人员WLT类型的照片文件名(带全路径)通过SetPhoteData函数送入termb.dll后,在二代证机具联机状态下(不需要卡),该dll将WLT文件解压成BMP文件,外部程序可通过调用“读用户信息函数组”中的GetPhotoBMP函数得到BMP文件的内容信息;

●      参数说明:

[in]Fname文件的全路径名;

●      返回值说明:

1——表示正确执行了功能;

0——表示文件已损坏,或非标准格式,或文件大小过大;

 

A.    设置人员基本信息

int_stdcallSetBaseData(char*FName);

B.    设置人员照片信息;

int_stdcallSetPhoteData(char*FName);

 

6         用户信息函数组使用时的调用顺序说明

6.1联机工作状态下:

 

6.2无卡时对保存在文件中的信息进行解析时:

 

备注:

上述两种应用场景可灵活的动态切换。

 

7         一个完整的示例:

DELPHI调用示例:

unitUnit1;

interface

uses

Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,

StdCtrls,Buttons,ExtCtrls;

type

TForm1=class(TForm)

BitBtn1:

TBitBtn;

Button2:

TButton;

Button3:

TButton;

Image1:

TImage;

procedureFormClose(Sender:

TObject;varAction:

TCloseAction);

procedureBitBtn1Click(Sender:

TObject);

procedureFormCreate(Sender:

TObject);

procedureButton3Click(Sender:

TObject);

procedureButton2Click(Sender:

TObject);

private

{Privatedeclarations}

public

{Publicdeclarations}

end;

var

Form1:

TForm1;

mInitComm:

Function(Port:

integer):

integer;Stdcall;

mCloseComm:

Function:

integer;stdcall;

mAuthenticate:

Function:

integer;stdcall;

mRead_Content:

Function(Active:

integer):

integer;stdcall;

GetName:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetSex:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetNation:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetAddress:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetBirthday:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetCode:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetDepartment:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetStartDate:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetEndDate:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetReserve:

Function(info:

pchar;len:

integer):

integer;stdcall;

GetPhotoBMP:

Function(info:

pchar;len:

integer):

integer;stdcall;

SetBaseData:

Function(filename:

string):

integer;stdcall;

SetPhotoData:

Function(filename:

string):

integer;stdcall;

DLLHandle:

Integer;

 

implementation

{$R*.DFM}

procedureTForm1.FormCreate(Sender:

TObject);

vari:

integer;

DLLPath:

String;

begin

DLLPath:

=ExtractFiledir(Application.exeName);

DLLPath:

=DLLPath+'\termb.dll';

DLLHandle:

=LoadLibrary(Pchar(DLLPath));

 

@mInitComm:

=GetProcAddress(DLLHandle,'InitComm');

@mCloseComm:

=GetProcAddress(DLLHandle,'CloseComm');

@mAuthenticate:

=GetProcAddress(DLLHandle,'Authenticate');

@mRead_Content:

=GetProcAddress(DLLHandle,'Read_Content');

@GetName:

=GetProcAddress(DLLHandle,'GetPeopleName');

@GetSex:

=GetProcAddress(DLLHandle,'GetPeopleSex');

@GetNation:

=GetProcAddress(DLLHandle,'GetPeopleNation');

@GetAddress:

=GetProcAddress(DLLHandle,'GetPeopleAddress');

@GetBirthday:

=GetProcAddress(DLLHandle,'GetPeopleBirthday');

@GetCode:

=GetProcAddress(DLLHandle,'GetPeopleIDCode');

@GetDepartment:

=GetProcAddress(DLLHandle,'GetDepartment');

@GetStartDate:

=GetProcAddress(DLLHandle,'GetStartDate');

@GetEndDate:

=GetProcAddress(DLLHandle,'GetEndDate');

@GetReserve:

=GetProcAddress(DLLHandle,'GetReserve');

@GetPhotoBMP:

=GetProcAddress(DLLHandle,'GetPhotoBMP');

@SetBaseData:

=GetProcAddress(DLLHandle,'SetBaseData');

@SetPhotoData:

=GetProcAddress(DLLHandle,'SetPhotoData');

end;

procedureTForm1.FormClose(Sender:

TObject;varAction:

TCloseAction);

begin

ifDLLHandle<>nullthen

freeLibrary(DLLHandle);

end;

procedureTForm1.BitBtn1Click(Sender:

TObject);

begin

mInitComm

(1);

sleep(1000);

mAuthenticate;

sleep(2000);

mRead_Content

(1);

sleep(2000);

Button3Click(self);

Application.ProcessMessages;

mRead_Content

(2);

sleep(2000);

mRead_Content(3);

sleep(1000);

mRead_Content(5);

sleep(1000);

mCloseComm;

end;

procedureTForm1.Button3Click(Sender:

TObject);

varinfo:

array[1..100]ofchar;

photo:

array[1..102400]ofchar;

fileHandle:

THandle;

Len:

integer;

begin

fillchar(info,100,#0);

GetName(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetSex(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetNation(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetAddress(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetBirthday(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetCode(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetDepartment(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetStartDate(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetEndDate(@info[1],100);

showmessage(info);

fillchar(info,100,#0);

GetReserve(@info[1],100);

showmessage(info);

fillchar(photo,100,#0);

Len:

=GetPhotoBMP(@photo[1],100*1024);

fileHandle:

=FileCreat

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 其它

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1