新中新身份证阅读器C++实现

2024-08-31 12:52

本文主要是介绍新中新身份证阅读器C++实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 最近有个身份证识别功能需要实现,通过整理把接口进行了封装整理,方便其他业务逻辑调用,代码如下:

1、IDCardHelper.h

#pragma once
#include <map>#pragma pack(1)
typedef struct tagIDCardData {char Name[32];		//姓名       char Sex[6];		//性别char Nation[64];	//名族char Born[18];		//出生日期char Address[72];	//住址char IDCardNo[38];	//身份证号char GrantDept[32]; //发证机关char UserLifeBegin[18];	// 有效开始日期char UserLifeEnd[18];	// 有效截止日期char PassID[20];		// 通行证号码char IssuesTimes[6];	//签发次数char reserved[12];		// 保留char PhotoFileName[255];// 照片路径char CardType[4];    //证件类型char EngName[122];   //英文名char CertVol[6];     //证件版本号
}IDCardData;
#pragma pack()typedef int(*ProgressCallback)(int progress);//二代证相关API---------------------------------------------------------------------------------------
typedef int (_stdcall *Syn_GetCOMBaud)(int iPort, unsigned int *  puiBaudRate);
typedef int (_stdcall *Syn_SetCOMBaud)(int iPort, unsigned int uiCurrBaud, unsigned int uiSetBaud);
typedef int (_stdcall *Syn_OpenPort)(int iPort);
typedef int (_stdcall *Syn_ClosePort)(int iPort);
//
//				SAM类函数
//
//
typedef int (_stdcall *Syn_SetMaxRFByte)(int	iPort, unsigned char ucByte, int	bIfOpen);
typedef int (_stdcall *Syn_ResetSAM)(int  iPort, int	iIfOpen);
typedef int (_stdcall *Syn_GetSAMStatus)(int iPort, int iIfOpen);
typedef int (_stdcall *Syn_GetSAMID)(int iPort, unsigned char *	pucSAMID, int iIfOpen);
typedef int (_stdcall *Syn_GetSAMIDToStr)(int iPort, char *	pcSAMID, int iIfOpen);
//
//				身份证卡类函数
//
//
typedef int (_stdcall *Syn_StartFindIDCard)(int iPort, unsigned char *	pucIIN, int	iIfOpen);
typedef int (_stdcall *Syn_SelectIDCard)(int iPort, unsigned char * pucSN, int iIfOpen);
typedef int (_stdcall *Syn_ReadBaseMsg)(int				iPort,unsigned char * pucCHMsg,unsigned int  * puiCHMsgLen,unsigned char * pucPHMsg,unsigned int  *	puiPHMsgLen,int				iIfOpen);
typedef int (_stdcall *Syn_ReadBaseMsgToFile)(int 			iPort,char * 			pcCHMsgFileName,unsigned int *	puiCHMsgFileLen,char * 			pcPHMsgFileName,unsigned int  *	puiPHMsgFileLen,int				iIfOpen);
typedef int	(_stdcall *Syn_ReadBaseFPMsg)(int				iPort,unsigned char *	pucCHMsg,unsigned int  *	puiCHMsgLen,unsigned char *	pucPHMsg,unsigned int  *	puiPHMsgLen,unsigned char *	pucFPMsg,unsigned int  *	puiFPMsgLen,int				iIfOpen);
typedef int	(_stdcall *Syn_ReadBaseFPMsgToFile)(int				iPort,char *			pcCHMsgFileName,unsigned int *	puiCHMsgFileLen,char *			pcPHMsgFileName,unsigned int *	puiPHMsgFileLen,char *			pcFPMsgFileName,unsigned int *	puiFPMsgFileLen,int				iIfOpen);
typedef int (_stdcall *Syn_ReadNewAppMsg)(int iPort, unsigned char * pucAppMsg, unsigned int * puiAppMsgLen, int iIfOpen);
typedef int (_stdcall *Syn_GetBmp)(int iPort, char * Wlt_File);typedef int (_stdcall *Syn_ReadMsg)(int iPort, int iIfOpen, IDCardData *pIDCardData);
typedef int (_stdcall *Syn_ReadFPMsg)(int iPort, int iIfOpen, IDCardData *pIDCardData, char * cFPhotoname);typedef int (_stdcall *Syn_FindReader)();
typedef int (_stdcall *Syn_FindUSBReader)();typedef int (_stdcall *Syn_BmpToJpeg)(char * cBmpName, char * cJpegName);
typedef int (_stdcall *Syn_PhotoToStrBase64)(char * cBase64, int * iLen, char *cPhotoName);
typedef int (_stdcall *Syn_StrBase64ToPhoto)(char * cBase64, int iLen, char *cPhotoName);
//
//				设置附加功能函数
//
//
typedef int (_stdcall *Syn_SetPhotoPath)(int iOption, char * cPhotoPath);
typedef int (_stdcall *Syn_SetPhotoType)(int iType);
typedef int (_stdcall *Syn_SetPhotoName)(int iType);
typedef int (_stdcall *Syn_SetPhotoNameEx)(int iType, char * cPhotoname);
typedef int (_stdcall *Syn_SetSexType)(int iType);
typedef int (_stdcall *Syn_SetNationType)(int iType);
typedef int (_stdcall *Syn_SetBornType)(int iType);
typedef int (_stdcall *Syn_SetUserLifeBType)(int iType);
typedef int (_stdcall *Syn_SetUserLifeEType)(int iType, int iOption);//
//				USBHID函数
//
//typedef int (_stdcall *Syn_USBHIDM1Reset)(int iPort, DWORD * pdwCardSN, unsigned char * pbSize);
typedef int (_stdcall *Syn_USBHIDM1AuthenKey)(int iPort, unsigned char KeyType, unsigned char BlockNo, unsigned char * pKey);
typedef int (_stdcall *Syn_USBHIDM1ReadBlock)(int iPort, unsigned char BlockNo, unsigned char * pBlock);
typedef int (_stdcall *Syn_USBHIDM1WriteBlock)(int iPort, unsigned char BlockNo, unsigned char * pBlock);
typedef int (_stdcall *Syn_USBHIDM1Halt)(int iPort);
typedef int (_stdcall *Syn_USBHIDReadFactoryInfo)(int iPort,unsigned char * pFactory,unsigned char * pVol,unsigned char * pSerialNo,unsigned char * pReserved);
typedef int (_stdcall *Syn_USBHIDWriteFactoryInfo)(int iPort,unsigned char * pFactory,unsigned char * pVol,unsigned char * pSerialNo,unsigned char * pReserved);
typedef int (_stdcall *Syn_USBHIDReadUserInfo)(int iPort, unsigned char *pInfo);
typedef int (_stdcall *Syn_USBHIDWriteUserInfo)(int iPort, unsigned char *pInfo);
typedef int (_stdcall *Syn_USBHIDGetMaxByte)(int iPort, unsigned char *pSAMMaxByte, unsigned char *pARMVol);
typedef int (_stdcall *Syn_USBHIDSendSound)(int iPort, unsigned char ucSound);
typedef int (_stdcall *Syn_USBHIDControlLED)(int iPort, unsigned char ucLed);
typedef int (_stdcall *Syn_USBHIDControlBeep)(int iPort, unsigned char ucType, unsigned short usTime);
typedef int (_stdcall *Syn_USBHIDGetSecCardID)(int iPort, unsigned char * pdwCardSN);typedef int (_stdcall *Syn_USBHIDSIMpowerOn)(int iPort, unsigned char * ucATR, unsigned char * ucLen);
typedef int (_stdcall *Syn_USBHIDSIMpowerOff)(int iPort);
typedef int (_stdcall *Syn_USBHIDSIMAPDU)(int iPort, int slen, unsigned char *datasend, int* rlen, unsigned char* datareceive);
//typedef int (_stdcall *Syn_USBHIDReadUserMac)(int iPort, unsigned char *pMac);
typedef int (_stdcall *Syn_USBHIDWriteUserMac)(int iPort, unsigned char *pMac);
//add new interface
//int _stdcall Syn_USBHIDSetTransportType(int iPort,int type);
typedef int (_stdcall *Syn_USBHIDSetUserIDCode)(int iPort, unsigned char *code, int len);
typedef int (_stdcall *Syn_USBHIDIsEncryptMode)(int iPort);
typedef int (_stdcall *Syn_USBHIDdoUpdate)(int iPort, unsigned char *updateBuffer, long bufferLen, ProgressCallback progressCallback);
//
//				USBReade.dll USBHID函数
//
//
//typedef int (_stdcall *Syn_USBOpenPort)(int iPort);
//typedef int (_stdcall *Syn_USBClosePort)(int iPort);
//typedef int (_stdcall *Syn_USBSetMaxRFByte)(int	iPort, unsigned char ucByte, int	bIfOpen);
//typedef int (_stdcall *Syn_USBStartFindIDCard)(int iPort, unsigned char *	pucIIN, int	iIfOpen);
//typedef int (_stdcall *Syn_USBSelectIDCard)(int iPort, unsigned char * pucSN, int iIfOpen);
//typedef int (_stdcall *Syn_USBReadBaseMsg)(
//	int				iPort,
//	unsigned char * pucCHMsg,
//	unsigned int  * puiCHMsgLen,
//	unsigned char * pucPHMsg,
//	unsigned int  *	puiPHMsgLen,
//	int				iIfOpen);
//typedef int	(_stdcall *Syn_USBReadBaseFPMsg)(
//	int				iPort,
//	unsigned char *	pucCHMsg,
//	unsigned int  *	puiCHMsgLen,
//	unsigned char *	pucPHMsg,
//	unsigned int  *	puiPHMsgLen,
//	unsigned char *	pucFPMsg,
//	unsigned int  *	puiFPMsgLen,
//	int				iIfOpen
//	);
//typedef int (_stdcall *Syn_USBReadNewAppMsg)(int iPort, unsigned char * pucAppMsg, unsigned int * puiAppMsgLen, int iIfOpen);//typedef int (_stdcall *Syn_USBGetSAMID)(int iPort, unsigned char *	pucSAMID, int iIfOpen);
//typedef int (_stdcall *Syn_USBGetSAMIDToStr)(int iPort, char *	pcSAMID, int iIfOpen);//typedef int (_stdcall *Syn_USBM1Reset)(int iPort, DWORD * pdwCardSN, unsigned char * pbSize);
//typedef int (_stdcall *Syn_USBM1AuthenKey)(int iPort, unsigned char KeyType, unsigned char BlockNo, unsigned char * pKey);
//typedef int (_stdcall *Syn_USBM1ReadBlock)(int iPort, unsigned char BlockNo, unsigned char * pBlock);
//typedef int (_stdcall *Syn_USBM1WriteBlock)(int iPort, unsigned char BlockNo, unsigned char * pBlock);
//typedef int (_stdcall *Syn_USBM1Halt)(int iPort);
//typedef int (_stdcall *Syn_USBReadFactoryInfo)(
//	int iPort,
//	unsigned char * pFactory,
//	unsigned char * pVol,
//	unsigned char * pSerialNo,
//	unsigned char * pReserved);
//typedef int (_stdcall *Syn_USBWriteFactoryInfo)(
//	int iPort,
//	unsigned char * pFactory,
//	unsigned char * pVol,
//	unsigned char * pSerialNo,
//	unsigned char * pReserved);
//typedef int (_stdcall *Syn_USBReadUserInfo)(int iPort, unsigned char *pInfo);
//typedef int (_stdcall *Syn_USBWriteUserInfo)(int iPort, unsigned char *pInfo);
//typedef int (_stdcall *Syn_USBGetMaxByte)(int iPort, unsigned char *pSAMMaxByte, unsigned char *pARMVol);
//typedef int (_stdcall *Syn_USBSendSound)(int iPort, unsigned char ucSound);
//typedef int (_stdcall *Syn_USBControlLED)(int iPort, unsigned char ucLed);
//typedef int (_stdcall *Syn_USBControlBeep)(int iPort, unsigned char ucType, unsigned short usTime);//typedef int (_stdcall *Syn_USBGetSecCardID)(int iPort, unsigned char * pdwCardSN);//typedef int (_stdcall *Syn_USBSIMpowerOn)(int iPort, unsigned char * ucATR, unsigned char * ucLen);
//typedef int (_stdcall *Syn_USBSIMpowerOff)(int iPort);
//typedef int (_stdcall *Syn_USBSIMAPDU)(int iPort, int slen, unsigned char *datasend, int* rlen, unsigned char* datareceive);
//typedef int (_stdcall *Syn_USBReadUserMac)(int iPort, unsigned char *pMac);
//typedef int (_stdcall *Syn_USBWriteUserMac)(int iPort, unsigned char *pMac);
//typedef int (_stdcall *Syn_USBPSAMpowerOn)( int iPort, int slot, unsigned char * ucATR, unsigned char * ucLen);
//typedef int (_stdcall *Syn_USBPSAMpowerOff)( int iPort, int slot);
//typedef int (_stdcall *Syn_USBPSAMAPDU)(int iPort, int slot,int slen,unsigned char *datasend,int* rlen,unsigned char* datareceive);
//typedef int (_stdcall *Syn_USBControlFingerLed)( int iPort,unsigned char ucType,unsigned short usTime);
typedef int (_stdcall *Syn_PSAMpowerOn)( int iPort, int slot, unsigned char * ucATR, unsigned char * ucLen);
typedef int (_stdcall *Syn_PSAMpowerOff)( int iPort, int slot);
typedef int (_stdcall *Syn_PSAMAPDU)(int iPort, int slot,int slen,unsigned char *datasend,int* rlen,unsigned char* datareceive);
typedef int (_stdcall *Syn_ControlFingerLed)( int iPort,unsigned char ucType,unsigned short usTime);
//add new interface
//int _stdcall Syn_USBSetTransportType(int iPort,int type);
//typedef int (_stdcall *Syn_USBSetUserIDCode)(int iPort, unsigned char *code, int len);
//typedef int (_stdcall *Syn_USBIsEncryptMode)(int iPort);
//

这篇关于新中新身份证阅读器C++实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1123964

相关文章

SpringBoot3实现Gzip压缩优化的技术指南

《SpringBoot3实现Gzip压缩优化的技术指南》随着Web应用的用户量和数据量增加,网络带宽和页面加载速度逐渐成为瓶颈,为了减少数据传输量,提高用户体验,我们可以使用Gzip压缩HTTP响应,... 目录1、简述2、配置2.1 添加依赖2.2 配置 Gzip 压缩3、服务端应用4、前端应用4.1 N

SpringBoot实现数据库读写分离的3种方法小结

《SpringBoot实现数据库读写分离的3种方法小结》为了提高系统的读写性能和可用性,读写分离是一种经典的数据库架构模式,在SpringBoot应用中,有多种方式可以实现数据库读写分离,本文将介绍三... 目录一、数据库读写分离概述二、方案一:基于AbstractRoutingDataSource实现动态

Python FastAPI+Celery+RabbitMQ实现分布式图片水印处理系统

《PythonFastAPI+Celery+RabbitMQ实现分布式图片水印处理系统》这篇文章主要为大家详细介绍了PythonFastAPI如何结合Celery以及RabbitMQ实现简单的分布式... 实现思路FastAPI 服务器Celery 任务队列RabbitMQ 作为消息代理定时任务处理完整

Java枚举类实现Key-Value映射的多种实现方式

《Java枚举类实现Key-Value映射的多种实现方式》在Java开发中,枚举(Enum)是一种特殊的类,本文将详细介绍Java枚举类实现key-value映射的多种方式,有需要的小伙伴可以根据需要... 目录前言一、基础实现方式1.1 为枚举添加属性和构造方法二、http://www.cppcns.co

使用Python实现快速搭建本地HTTP服务器

《使用Python实现快速搭建本地HTTP服务器》:本文主要介绍如何使用Python快速搭建本地HTTP服务器,轻松实现一键HTTP文件共享,同时结合二维码技术,让访问更简单,感兴趣的小伙伴可以了... 目录1. 概述2. 快速搭建 HTTP 文件共享服务2.1 核心思路2.2 代码实现2.3 代码解读3.

MySQL双主搭建+keepalived高可用的实现

《MySQL双主搭建+keepalived高可用的实现》本文主要介绍了MySQL双主搭建+keepalived高可用的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,... 目录一、测试环境准备二、主从搭建1.创建复制用户2.创建复制关系3.开启复制,确认复制是否成功4.同

Java实现文件图片的预览和下载功能

《Java实现文件图片的预览和下载功能》这篇文章主要为大家详细介绍了如何使用Java实现文件图片的预览和下载功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... Java实现文件(图片)的预览和下载 @ApiOperation("访问文件") @GetMapping("

使用Sentinel自定义返回和实现区分来源方式

《使用Sentinel自定义返回和实现区分来源方式》:本文主要介绍使用Sentinel自定义返回和实现区分来源方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Sentinel自定义返回和实现区分来源1. 自定义错误返回2. 实现区分来源总结Sentinel自定

Java实现时间与字符串互相转换详解

《Java实现时间与字符串互相转换详解》这篇文章主要为大家详细介绍了Java中实现时间与字符串互相转换的相关方法,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录一、日期格式化为字符串(一)使用预定义格式(二)自定义格式二、字符串解析为日期(一)解析ISO格式字符串(二)解析自定义

opencv图像处理之指纹验证的实现

《opencv图像处理之指纹验证的实现》本文主要介绍了opencv图像处理之指纹验证的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学... 目录一、简介二、具体案例实现1. 图像显示函数2. 指纹验证函数3. 主函数4、运行结果三、总结一、