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

相关文章

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

【C++ Primer Plus习题】13.4

大家好,这里是国中之林! ❥前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站。有兴趣的可以点点进去看看← 问题: 解答: main.cpp #include <iostream>#include "port.h"int main() {Port p1;Port p2("Abc", "Bcc", 30);std::cout <<

C++包装器

包装器 在 C++ 中,“包装器”通常指的是一种设计模式或编程技巧,用于封装其他代码或对象,使其更易于使用、管理或扩展。包装器的概念在编程中非常普遍,可以用于函数、类、库等多个方面。下面是几个常见的 “包装器” 类型: 1. 函数包装器 函数包装器用于封装一个或多个函数,使其接口更统一或更便于调用。例如,std::function 是一个通用的函数包装器,它可以存储任意可调用对象(函数、函数

C++11第三弹:lambda表达式 | 新的类功能 | 模板的可变参数

🌈个人主页: 南桥几晴秋 🌈C++专栏: 南桥谈C++ 🌈C语言专栏: C语言学习系列 🌈Linux学习专栏: 南桥谈Linux 🌈数据结构学习专栏: 数据结构杂谈 🌈数据库学习专栏: 南桥谈MySQL 🌈Qt学习专栏: 南桥谈Qt 🌈菜鸡代码练习: 练习随想记录 🌈git学习: 南桥谈Git 🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈�

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

让树莓派智能语音助手实现定时提醒功能

最初的时候是想直接在rasa 的chatbot上实现,因为rasa本身是带有remindschedule模块的。不过经过一番折腾后,忽然发现,chatbot上实现的定时,语音助手不一定会有响应。因为,我目前语音助手的代码设置了长时间无应答会结束对话,这样一来,chatbot定时提醒的触发就不会被语音助手获悉。那怎么让语音助手也具有定时提醒功能呢? 我最后选择的方法是用threading.Time

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

06 C++Lambda表达式

lambda表达式的定义 没有显式模版形参的lambda表达式 [捕获] 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 有显式模版形参的lambda表达式 [捕获] <模版形参> 模版约束 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 含义 捕获:包含零个或者多个捕获符的逗号分隔列表 模板形参:用于泛型lambda提供个模板形参的名

C#实战|大乐透选号器[6]:实现实时显示已选择的红蓝球数量

哈喽,你好啊,我是雷工。 关于大乐透选号器在前面已经记录了5篇笔记,这是第6篇; 接下来实现实时显示当前选中红球数量,蓝球数量; 以下为练习笔记。 01 效果演示 当选择和取消选择红球或蓝球时,在对应的位置显示实时已选择的红球、蓝球的数量; 02 标签名称 分别设置Label标签名称为:lblRedCount、lblBlueCount