身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx

上传人:b****5 文档编号:7748387 上传时间:2023-01-26 格式:DOCX 页数:9 大小:17.80KB
下载 相关 举报
身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx_第1页
第1页 / 共9页
身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx_第2页
第2页 / 共9页
身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx_第3页
第3页 / 共9页
身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx_第4页
第4页 / 共9页
身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx

《身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx》由会员分享,可在线阅读,更多相关《身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx(9页珍藏版)》请在冰豆网上搜索。

身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明.docx

身份证阅读器动态库应用函数的定义格式调用方法和返回值的说明

华视电子读写设备有限公司

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

在使用前,请确认授权文件termb.lic是否在你的PC机C:

\根目录下。

1.定义

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

termb.dllAPI函数的动态联接库

sdtapi.dll内部动态库

cvrapi.dll内部动态库

wltrs.dll内部动态库

termb.lic身份证相片解压授权文件,放于C:

\目录下

适用操作系统:

WindowsNT:

需要NT3.1版或以后版本

Windows:

需要Windows98、Windows2000或以后版本

适用开发语言:

VisualC++5.0及以后版本

VisualBasic5.0及以后版本

Delphi3.0及以后版本

PowerBuilder6.0及以后版本

2.函数列表

//以下为主要API函数

intCVR_InitComm(intPort)初始化连接;

intCVR_Authenticate()卡认证;

intCVR_Read_Content(intActive)读卡操作。

intCVR_CloseComm()关闭连接;

//以下为可选API函数,方便二次开发

intCVR_Ant(intmode)射频操作

intCVR_ReadBaseMsg(

unsignedchar*pucCHMsg,unsignedint*puiCHMsgLen,unsignedchar*pucPHMsg,unsignedint*puiPHMsgLen,

intnMode)读卡操作(读入内存)

intGetPeopleName(char*strTmp,int*strLen)得到姓名信息

intGetPeopleSex(char*strTmp,int*strLen)得到性别信息

intGetPeopleNation(char*strTmp,int*strLen)得到民族信息

intGetPeopleBirthday(char*strTmp,int*strLen)得到出生日期

intGetPeopleAddress(char*strTmp,int*strLen)得到地址信息

intGetPeopleIDCode(char*strTmp,int*strLen)得到身份证号信息

intGetDepartment(char*strTmp,int*strLen)得到发证机关信息

intGetStartDate(char*strTmp,int*strLen)得到有效开始日期

intGetEndDate(char*strTmp,int*strLen)得到有效截止日期

 

3.函数调用流程

.      函数说明

4.1   初

始化连接

原型:

intCVR_InitComm(intPort)

说明:

本函数用于PC与华视电子第二代居民身份证阅读器的连接。

参数:

Port:

连接串口(COM1~COM16)或USB口(1001~1016)

意义

1

串口1

2

串口2

3

串口3

4

串口4

1001

USB口1

1002

USB口2

1003

USB口3

1004

USB口4

返回值:

意义

1

正确

0

错误

4.2   关闭串口

原型:

intCVR_CloseComm(void)

说明:

本函数用于关闭PC到阅读器的连接。

参数:

返回值:

意义

1

正确

0

错误

4.3   卡认证

原型:

intCVR_Authenticate(void)

说明:

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

卡认证循环间隔大于300ms。

参数:

返回值:

意义

说明

1

正确

卡片正确放置时

0

错误

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

注意:

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

4.4   读卡操作

原型:

intCVR_Read_Content(intActive);

说明:

本函数用于通过阅读器从第二代居民身份证中读取相应信息。

卡认证成功以后才可做读卡操作,读卡完毕若继续读卡应移走二代证卡片重新放置做卡认证。

参数:

Active读取信息类型

Active

意义

说明

1

读基本信息

生成文字WZ.TXT、相片数据XP.WLT和相片ZP.BMP(解码)

2

读基本信息

生成文字WZ.TXT和相片数据XP.WLT

3

读最新住址信息

生成最新住址NEWADD.TXT(卡无最新地址则生成空文件)

4

读基本信息

生成WZ.TXT(解码),相片ZP.BMP(解码)

5

读芯片管理号

芯片管理号IINSNDN.bin

6

读基本信息

以设备唯一标志号,生成文字WZ.TXT(解码),相片XP.BMP(解码)

(用于终端网络环境)

返回值:

返回值

意义

1

正确

0

错误

 

4.5   射频操作

原型:

intCVR_Ant(intmode);

说明:

本函数用于打开/关闭射频。

阅读器在不读卡时,如果射频对其它的电子产品有干扰的话,可以选择关闭射频,当需要读卡时,再打开射频。

该函数只在当连接到串行接口的阅读器时,调用有效。

如不调用此函数时,射频一直处于打开状态。

注:

当CVR_InitComm函数调用成功后,该函数有效。

参数:

mode

MODE

意义

0

关闭射频

1

打开射频

返回值:

返回值

意义

1

正确

0

错误

 

4.6   读文字、照片信息到自定义内存缓冲

原型:

intCVR_ReadBaseMsg(unsignedchar*pucCHMsg,unsignedint*puiCHMsgLen,unsignedchar*pucPHMsg,unsignedint*puiPHMsgLen,

intnMode)

说明:

此函数代替CVR_Read_Content函数,将身份信息读到自定义内存缓冲中。

卡认证CVR_Authenticate成功以后调用本函数。

参数:

参数

说明

备注

pucCHMsg

身份文字信息内存缓冲指针

方向:

Out

puiCHMsgLen

身份文字信息长度

默认256Byte

pucPHMsg

身份照片信息内存缓冲指针

方向:

Out

puiPHMsgLen

身份照片信息长度

默认1024Byte

nMode

传入参数1

文字编码为默认UCS-2格式,

照片未解压成bmp文件

传入参数2

文字编码已转换成GBK国标码格式,

照片未解压成bmp文件

传入参数3

文字编码为默认UCS-2格式,

照片已解压成zp.bmp文件

传入参数4

文字编码已转换成GBK国标码格式,

照片已解压成zp.bmp文件

返回值:

返回值

意义

1

正确

0

错误

 

4.7   读各项文字信息到自定义内存缓冲

原型:

int_stdcallGetPeopleName(char*strTmp,int*strLen)//得到姓名信息

int_stdcallGetPeopleSex(char*strTmp,int*strLen)//得到性别信息

int_stdcallGetPeopleNation(char*strTmp,int*strLen)//得到民族信息

int_stdcallGetPeopleBirthday(char*strTmp,int*strLen)//得到出生日期

int_stdcallGetPeopleAddress(char*strTmp,int*strLen)//得到地址信息

int_stdcallGetPeopleIDCode(char*strTmp,int*strLen)//得到卡号信息

int_stdcallGetDepartment(char*strTmp,int*strLen)//得到发证机关信息

int_stdcallGetStartDate(char*strTmp,int*strLen)//得到有效开始日期

int_stdcallGetEndDate(char*strTmp,int*strLen)//得到有效截止日期

说明:

以上函数调用流程为:

调用CVR_Read_Content或者CVR_ReadBaseMsg函数成功后再分别调用以上函数。

CVR_Read_Content或者CVR_ReadBaseMsg函数自动在应用程序当前目录产生BMP照片文件。

参数:

*strTmp返回的信息缓存指针。

*strLen返回的信息长度指针。

返回值:

返回值

意义

1

正确

0

错误

 

注意:

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

注意:

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

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

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

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

项目

长度(字节)

说明

姓名

30

汉字

性别

2

代码

民族

4

代码

出生

16

年月日:

YYYYMMDD

住址

70

汉字和数字

公民身份号码

36

数字

签发机关

30

汉字

有效期起始日期

16

年月日:

YYYYMMDD

有效期截止日期

16

年月日:

YYYYMMDD

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

最新住址

70

汉字和数字

芯片管理号分配如下:

项目

长度(字节)

说明

IIN

4

SN

8

DN

16

functionCVR_InitComm(constPort:

integer):

integer;stdcall;external'termb.dll';

functionCVR_Authenticate():

integer;stdcall;external'termb.dll';

functionCVR_Read_Content(constActive:

integer):

integer;stdcall;external'termb.dll';

functionCVR_CloseComm():

integer;stdcall;external'termb.dll';

functionCVR_Ant(constmode:

integer):

integer;stdcall;external'termb.dll';

functionCVR_ReadBaseMsg(constpucCHMsg:

pchar;constpuiCHMsgLen:

Longint;constnMode:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleName(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleSex(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleNation(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleBirthday(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleAddress(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetPeopleIDCode(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetDepartment(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetStartDate(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

functionGetEndDate(conststrTmp:

pchar;conststrLen:

integer):

integer;stdcall;external'termb.dll';

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

当前位置:首页 > 高等教育 > 理学

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

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