新中新身份证阅读器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

相关文章

使用Python实现在Word中添加或删除超链接

《使用Python实现在Word中添加或删除超链接》在Word文档中,超链接是一种将文本或图像连接到其他文档、网页或同一文档中不同部分的功能,本文将为大家介绍一下Python如何实现在Word中添加或... 在Word文档中,超链接是一种将文本或图像连接到其他文档、网页或同一文档中不同部分的功能。通过添加超

windos server2022里的DFS配置的实现

《windosserver2022里的DFS配置的实现》DFS是WindowsServer操作系统提供的一种功能,用于在多台服务器上集中管理共享文件夹和文件的分布式存储解决方案,本文就来介绍一下wi... 目录什么是DFS?优势:应用场景:DFS配置步骤什么是DFS?DFS指的是分布式文件系统(Distr

NFS实现多服务器文件的共享的方法步骤

《NFS实现多服务器文件的共享的方法步骤》NFS允许网络中的计算机之间共享资源,客户端可以透明地读写远端NFS服务器上的文件,本文就来介绍一下NFS实现多服务器文件的共享的方法步骤,感兴趣的可以了解一... 目录一、简介二、部署1、准备1、服务端和客户端:安装nfs-utils2、服务端:创建共享目录3、服

C#使用yield关键字实现提升迭代性能与效率

《C#使用yield关键字实现提升迭代性能与效率》yield关键字在C#中简化了数据迭代的方式,实现了按需生成数据,自动维护迭代状态,本文主要来聊聊如何使用yield关键字实现提升迭代性能与效率,感兴... 目录前言传统迭代和yield迭代方式对比yield延迟加载按需获取数据yield break显式示迭

Python实现高效地读写大型文件

《Python实现高效地读写大型文件》Python如何读写的是大型文件,有没有什么方法来提高效率呢,这篇文章就来和大家聊聊如何在Python中高效地读写大型文件,需要的可以了解下... 目录一、逐行读取大型文件二、分块读取大型文件三、使用 mmap 模块进行内存映射文件操作(适用于大文件)四、使用 pand

python实现pdf转word和excel的示例代码

《python实现pdf转word和excel的示例代码》本文主要介绍了python实现pdf转word和excel的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价... 目录一、引言二、python编程1,PDF转Word2,PDF转Excel三、前端页面效果展示总结一

Python xmltodict实现简化XML数据处理

《Pythonxmltodict实现简化XML数据处理》Python社区为提供了xmltodict库,它专为简化XML与Python数据结构的转换而设计,本文主要来为大家介绍一下如何使用xmltod... 目录一、引言二、XMLtodict介绍设计理念适用场景三、功能参数与属性1、parse函数2、unpa

C#实现获得某个枚举的所有名称

《C#实现获得某个枚举的所有名称》这篇文章主要为大家详细介绍了C#如何实现获得某个枚举的所有名称,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以参考一下... C#中获得某个枚举的所有名称using System;using System.Collections.Generic;usi

Go语言实现将中文转化为拼音功能

《Go语言实现将中文转化为拼音功能》这篇文章主要为大家详细介绍了Go语言中如何实现将中文转化为拼音功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 有这么一个需求:新用户入职 创建一系列账号比较麻烦,打算通过接口传入姓名进行初始化。想把姓名转化成拼音。因为有些账号即需要中文也需要英

C# 读写ini文件操作实现

《C#读写ini文件操作实现》本文主要介绍了C#读写ini文件操作实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录一、INI文件结构二、读取INI文件中的数据在C#应用程序中,常将INI文件作为配置文件,用于存储应用程序的