#ifndef SSSE32_H
#define SSSE32_H
#include <windows.h>
#include <stdio.h>

//状态码
#define IFD_OK	0					 //执行成功
#define IFD_EU_TypeError	-1		 //卡片类型不对
#define IFD_EU_NoExist	-2			 //无卡
#define IFD_EU_NoPower	-3			 //有卡未上电
#define IFD_EU_NoResponse	-4	     //卡片无应答
#define IFD_ConnectError	-11	     //读卡器连接错
#define IFD_UnConnected	-12	         //未建立连接(没有执行打开设备函数)
#define IFD_BadCommand	-13	         //(动态库)不支持该命令
#define IFD_ParameterError	-14	     //(发给动态库的)命令参数错
#define IFD_CheckSumError	-15	     //信息校验和出错
#define IFD_OutTime   -20           //信息校验和出错


#ifdef __cplusplus
extern "C" {
#endif



/*############设备操作函数#################*/
long WINAPI EU_Reader_Open(char* dev_Name); 
long WINAPI EU_Reader_OpenEx(char* dev_Name, unsigned int VID, unsigned int PID);//
long WINAPI EU_Reader_Close(long ReaderHandle);
long WINAPI EU_PosBeep(long ReaderHandle, unsigned char time);//蜂鸣
long WINAPI EU_Reader_EnterDFU (long ReaderHandle);  //进入USB下载程序状态
long WINAPI EU_Reader_LeaveDFU (long ReaderHandle);  //离开USB下载程序状态
long WINAPI EU_Reader_Libinfo(char* info);
long WINAPI EU_Reader_ReadEEPROM (long ReaderHandle,int offset,int length,unsigned char *buffer);//从eeprom读取数据
long WINAPI EU_Reader_WriteEEPROM (long ReaderHandle,int offset,int length,unsigned char *buffer);//从eeprom写入数据
long WINAPI EU_Machine_Reset(long ReaderHandle);  
void WINAPI EU_Reader_PPS(bool IsEnable);
 
long WINAPI EU_Reader_GetDeviceVersion(long ReaderHandle,char *VDate);


long WINAPI EU_Reader_GetDeviceSN(long ReaderHandle,char* dev_Ser); //获取设备序列号，从设备获取
long WINAPI EU_Reader_SetDeviceSN(long ReaderHandle,char* dev_Ser); //设置设备序列号
 
long WINAPI EU_Reader_GetKeybordVersion(long ReaderHandle,char *VDate);

long WINAPI EU_Reader_GetKeybordVersion(long ReaderHandle,char *VDate);


long WINAPI EU_Reader_GetSAMID(long ReaderHandle,char *SAMID);

long WINAPI EU_Reader_SetDeviceReadMode(long ReaderHandle,unsigned char type ); //设置读卡器为主动/被动读卡模式 type==1 主动  type==0被动

long WINAPI EU_Reader_ChangeSlot(long ReaderHandle,unsigned char slot ); //切换卡座

//读取功能表
long WINAPI EU_Reader_ContatctInfo(long ReaderHandle,char *VDate); 
long WINAPI EU_Reader_NoContatctInfo(long ReaderHandle,char *VDate);

long WINAPI EU_Reader_GetDeviceCSN(long ReaderHandle,char *data);



long WINAPI EU_DispInfo(long ReaderHandle,unsigned char row,unsigned char list,char *data); //显示信息

long WINAPI EU_DispSound(long ReaderHandle,unsigned char type,unsigned char nMode); //声音提示信息 type(1~14) nMode==0内置键盘语音，nMode==1外置键盘语音
/*
	1、请插卡 2、请刷卡 3、读卡错误 4、请输入密码  5、密码错误  6、操作成功 7、操作超时 8、操作失败 9、请取回卡 10、请重新输入密码 11、请再次输入密码 12、请输入新密码 13、请输入旧密码 14、请确认新密码
*/

long WINAPI EU_CtlLight(long ReaderHandle);//清屏，关屏

long WINAPI EU_ChangeLight(long ReaderHandle,unsigned char mode);//改变屏幕亮度 mode=1 调亮  mode=0调暗

long WINAPI EU_GetInputPass(long ReaderHandle, unsigned char ctime, unsigned char *rlen, unsigned char start,unsigned char stop,unsigned char * cpass);//获取密码，带超时 start==0用内置键盘，start==1用外置键盘

long WINAPI EU_GetInputPassID(long ReaderHandle, unsigned char ctime, unsigned char *rlen, unsigned char start,unsigned char stop,unsigned char * cardID,unsigned char * cpass);//获取密码，带超时,带ID

long WINAPI EU_GetTimeOut(long ReaderHandle,unsigned char flag);//获取密码、读磁条超时


long WINAPI EU_PassGet(long ReaderHandle,unsigned char *rlen,unsigned char time,unsigned char start,unsigned char stop,unsigned char * cpass);//获取密码

long WINAPI EU_PassGetID(long ReaderHandle,unsigned char *rlen,unsigned char time,unsigned char start,unsigned char stop,unsigned char * cardID,unsigned char * cpass);//获取密码，带卡号

long WINAPI EU_PassCheck(long ReaderHandle,unsigned char *rlen,unsigned char * cpass); //查下数据是否到了

long WINAPI EU_PassSetDES(long ReaderHandle,unsigned char DES); //设置加密模式3des or des

long WINAPI EU_PassSetDevID(long ReaderHandle,unsigned char *devID);//设置键盘设备ID

long WINAPI EU_PassGetDevID(long ReaderHandle,unsigned char *devID);//获取键盘设备ID

long WINAPI EU_PassSetKeyLen(long ReaderHandle,unsigned char len);//设置密码长度

long WINAPI EU_Reader_Auto(long ReaderHandle,int t_IntType);//



long WINAPI  EU_Reader_GetMagCardMode(long ReaderHandle, 
                                       unsigned short * Mode, 
                                       unsigned short * Track,
                                       unsigned short *fOutType,
                                       unsigned short *fEnter);
/*
参数：
   ReaderHandle：IN 接口句柄；
   Mode：OUT  Mode=1 通过软件控制读取 Mode=2模拟键盘
   Track：OUT 磁条轨道，当为模拟键盘输出时有效
   fOutType：OUT 输出模式 0=全部输出，1=去除起始字符，2=只输出数字（卡号）
   fEnter：OUT 是否换行 1=换行，0=不换行

返回值:
   等于 0 表示执行成功；其他值表示失败
*/

long WINAPI  EU_Reader_SetMagCardMode (long ReaderHandle, 
                                        unsigned short  Mode, 
                                        unsigned short  Track, 
                                        unsigned short fOutType,
                                        unsigned short fEnter);
/*
  参数：
   ReaderHandle：IN 接口句柄；
   Mode：IN  Mode=1 通过软件控制读取 Mode=2模拟键盘
   Track：IN  磁条轨道，当为模拟键盘输出时有效
   fOutType：IN 输出模式 0=全部输出，1=去除起始字符，2=只输出数字（卡号）
   fEnter：IN 是否换行 1=换行，0=不换行

返回值:
   等于 0 表示执行成功；其他值表示失败

*/

long WINAPI PEU_Reader_ID_N(long ReaderHandle,unsigned char *GetData);

/*############接触CPU操作函数#################*/

long WINAPI EU_Reader_pre_PowerOn(long ReaderHandle,unsigned char EU_Slot_No,unsigned char* Response);//上电 冷 返回数据长度
long WINAPI EU_Reader_hot_PowerOn(long ReaderHandle,unsigned char EU_Slot_No,unsigned char* Response);//上电 热 返回数据长度

long WINAPI EU_Reader_Zpre_PowerOn(long ReaderHandle,unsigned char EU_Slot_No,unsigned char* Response);//住建卡小卡
long WINAPI EU_Reader_PowerOn(long ReaderHandle,unsigned char EU_Slot_No,unsigned char* Response);//上电  返回数据长度 冷+热
long WINAPI EU_Reader_PowerOnHEX(long ReaderHandle,unsigned char EU_Slot_No,unsigned char* Response);//上电 冷+热 返回数据长度
/*
	大卡座EU_Slot_No：0x01
	SAM1:0x11
	SAM2:0x12
	SAM3:0x13
	SAM4:0x14
	下同

*/
long WINAPI EU_Reader_PowerOff(long ReaderHandle,unsigned char EU_Slot_No);//下电

long WINAPI EU_Reader_GetStatus(long ReaderHandle,unsigned char EU_Slot_No);//获取卡座状态

long WINAPI EU_Reader_Application2(long ReaderHandle,unsigned char EU_Slot_No,
							 long Lenth_of_Command_APDU,unsigned char* Command_APDU,
							 unsigned char* Response_APDU);  //执行apdu命令  返回数据长度
long WINAPI EU_Reader_Application(long ReaderHandle,unsigned char EU_Slot_No,
							 long Lenth_of_Command_APDU,unsigned char* Command_APDU,
							 unsigned char* Response_APDU);

long WINAPI EU_Reader_ApplicationHEX(long ReaderHandle,unsigned char EU_Slot_No,
							 char* Command_APDU,
							 char* Response_APDU);  //执行apdu命令  返回数据长度

long WINAPI EU_Reader_LongApplication(long ReaderHandle,unsigned char EU_Slot_No,
							 long Lenth_of_Command_APDU,unsigned char* Command_APDU,
							 unsigned char* Response_APDU);  //执行apdu命令  返回数据长度

//cpuetu=01、02、03、04代表的波特率分别为9600、19200、38400、115200 
//unsigned char cpupro ---- 卡的协议类型 =0表示T=0协议 =1表示T=1协议
long WINAPI EU_SetCpupara(long ReaderHandle,unsigned char EU_Slot_No,unsigned char cpupro,unsigned char cpuetu);//设置速率

long WINAPI EU_SetCpuETU(long ReaderHandle,unsigned char EU_Slot_No,unsigned char cpupro,unsigned char cpuetu);//设置速率

/*############ 4442基本操作函数#################*/

long WINAPI EU_Reader_4442_PowerOn(long ReaderHandle,unsigned char *data); //4442卡上电 返回数据长度
long WINAPI EU_Reader_4442_PowerOff(long ReaderHandle); //4442卡下电
long WINAPI EU_Reader_4442_Read(long ReaderHandle,int offset,int len,unsigned char *data); //4442卡读数据
long WINAPI EU_Reader_4442_Write(long ReaderHandle,int offset,int len,unsigned char *data); //4442卡写数据 
long WINAPI EU_Reader_4442_Verify(long ReaderHandle,unsigned char *key); //4442卡认证密钥
long WINAPI EU_Reader_4442_Change(long ReaderHandle,unsigned char *newkey); //4442卡修改密钥
long WINAPI EU_Reader_4442_ReadProtect(long ReaderHandle,int offset,int len,unsigned char *data); //4442卡读保护数据
long WINAPI EU_Reader_4442_WriteProtect(long ReaderHandle,int offset,int len,unsigned char *data); //4442卡写保护数据
long WINAPI EU_Reader_4442_ReadCount(long ReaderHandle); //读取4442卡密钥剩余认证次数 返回次数0~3次

/*############ 24cXX基本操作函数#################*/

long WINAPI EU_Reader_24c_PowerOn(long ReaderHandle,unsigned char *data,unsigned char flag); //24cxx卡上电 flag=0为24C01~16  flag=1为24C32~1024
long WINAPI EU_Reader_24c_PowerOff(long ReaderHandle,unsigned char flag); //24cxx卡下电 flag=0为24C01~16  flag=1为24C32~1024
long WINAPI EU_Reader_24c_Read(long ReaderHandle,int offset,int len,unsigned char *data,unsigned char flag); //24cxx卡读数据 flag=0为24C01~16  flag=1为24C32~1024
long WINAPI EU_Reader_24c_Write(long ReaderHandle,int offset,int len,unsigned char *data,unsigned char flag); //24cxx卡写数据  flag=0为24C01~16  flag=1为24C32~1024

/*############ 4428 基本操作函数#################*/

long WINAPI EU_Reader_4428_PowerOn(long ReaderHandle,unsigned char *data); //4428卡上电
long WINAPI EU_Reader_4428_PowerOff(long ReaderHandle); //4428卡下电
long WINAPI EU_Reader_4428_Read(long ReaderHandle,int offset,int len,unsigned char *data); //4428卡读数据
long WINAPI EU_Reader_4428_Write(long ReaderHandle,int offset,int len,unsigned char *data); //4428卡写数据 
long WINAPI EU_Reader_4428_Verify(long ReaderHandle,unsigned char *key); //4428卡认证密钥
long WINAPI EU_Reader_4428_Change(long ReaderHandle,unsigned char *newkey); //4428卡修改密钥
long WINAPI EU_Reader_4428_ReadProtect(long ReaderHandle,int offset,int len,unsigned char *data); //4428卡读保护数据
long WINAPI EU_Reader_4428_WriteProtect(long ReaderHandle,int offset,int len,unsigned char *data); //4428卡写保护数据
long WINAPI EU_Reader_4428_ReadCount(long ReaderHandle); //读取4428卡密钥剩余认证次数 返回次数0~8次
/*############非接基本操作函数#################*/

long WINAPI PEU_Reader_SetTypeA(long ReaderHandle);//设置读typeA
long WINAPI PEU_Reader_SetTypeB(long ReaderHandle);//设置读typeB

long WINAPI PEU_Reader_Select(long ReaderHandle,unsigned char cardtype);//选择卡片，41为typea,M1 42为typeb,TypeB卡片需先上电后选卡

long WINAPI PEU_Reader_Request(long ReaderHandle);//typea M1请求卡片

long WINAPI PEU_Reader_RFControl(long ReaderHandle,short flag);//flag=0 关闭天线 flag=1 打开天线
long WINAPI PEU_Reader_Halt(long ReaderHandle);

long WINAPI PEU_Reader_anticoll(long ReaderHandle,unsigned char *uid);//防碰撞 typea M1卡片

/*############ M1卡操作函数#################*/
long WINAPI PEU_Reader_M1Rest(long ReaderHandle,unsigned char *uid);

long WINAPI PEU_Reader_Authentication(long ReaderHandle,unsigned char Mode, unsigned char SecNr);//认证密钥 M1

long WINAPI PEU_Reader_Authentication_Pass(long ReaderHandle,unsigned char Mode, unsigned char SecNr,unsigned char *PassWord);//认证密钥M1 带密钥参数

long WINAPI PEU_Reader_Authentication_PassHEX(long ReaderHandle,unsigned char Mode, unsigned char SecNr,char *PassWord);//认证密钥M1 带密钥参数

long WINAPI PEU_Reader_Readval(long ReaderHandle,unsigned char Addr,unsigned long *value);	//读值

long WINAPI PEU_Reader_Initval(long ReaderHandle,unsigned char Addr,unsigned long value);//初始化值

long WINAPI PEU_Reader_Increment(long ReaderHandle,unsigned char Addr,unsigned long value);	//增值

long WINAPI PEU_Reader_Decrement(long ReaderHandle,unsigned char Addr,unsigned long value);//减值

long WINAPI PEU_Reader_Read(long ReaderHandle,unsigned char Addr,unsigned char *Data);	//读取卡片M1

long WINAPI PEU_Reader_ReadHEX(long ReaderHandle,unsigned char Addr,unsigned char *Data);	//读取卡片M1
long WINAPI PEU_Reader_WriteHEX(long ReaderHandle,unsigned char Addr,unsigned char *Data);//写入数据M1

long WINAPI PEU_Reader_Write(long ReaderHandle,unsigned char Addr,unsigned char *Data);//写入数据M1

long WINAPI PEU_Reader_LoadKey(long ReaderHandle,unsigned char Mode,unsigned char SecNr,unsigned char *Key);//装载密钥
/*
SecNr:扇区号
Mode：01 02 03 分别为第一、二、三套密钥KeyA
04 05 06 分别为第一、二、三套密钥KEYB
*/

/*############ ID 卡号  #####################################*/
long WINAPI PEU_Reader_IdCard(long ReaderHandle,unsigned char *Number);

/*############ TypeA CPU 卡操作函数 #################*/
long WINAPI PEU_Reader_PowerOnTypeA(long ReaderHandle,unsigned char* Response);//上电 返回数据长度 失败小于0

long WINAPI PEU_Reader_PowerOnTypeAHEX(long ReaderHandle, char* Response);//上电 返回数据长度 失败小于0

/*############ TypeB CPU 卡操作函数#################*/
long WINAPI PEU_Reader_PowerOnTypeB(long ReaderHandle,unsigned char* Response);//上电 返回数据长度 失败小于0


long WINAPI PEU_Reader_Application(long ReaderHandle,
							 long Lenth_of_Command_APDU,unsigned char* Command_APDU,
							 unsigned char* Response_APDU);  //type a/b执行apdu命令 返回数据长度 失败小于0

long WINAPI PEU_Reader_ApplicationHEX(long ReaderHandle,
							 long Lenth_of_Command_APDU, char* Command_APDU,
							  char* Response_APDU);  //type a/b执行apdu命令 返回数据长度 失败小于0

long  WINAPI HD_USBkey(long ReaderHandle,unsigned char _Adr, int len);//模拟键盘

/*############ 15693 卡操作函数#################*/

long WINAPI PEU_Reader_Inventory(long ReaderHandle,unsigned char* Response_APDU);//此命令通过防冲突用于得到读卡区域内所有卡片的序列号

long WINAPI PEU_Reader_15693_Read(long ReaderHandle,unsigned char blk_add,unsigned char* Response_APDU);//用来读取1个扇区的值

long WINAPI PEU_Reader_15693_Write(long ReaderHandle,unsigned char blk_add,unsigned char* data,
									unsigned char* Response_APDU);//对一个块进行写操作（每次只能写一个块）

long WINAPI PEU_Reader_API(long ReaderHandle,unsigned char* data,unsigned char* Response_APDU);//Data[0]	0代表写API,1代表锁API

long WINAPI PEU_Reader_DSFID(long ReaderHandle,unsigned char* data,unsigned char* Response_APDU);//Data[0]	0代表写DSFID,1代表锁DSFID

long WINAPI PEU_Reader_LockDataBlock(long ReaderHandle,unsigned char blk_add,unsigned char* Response_APDU);//用于锁定块内容。注意：此过程不可逆（不能解锁）块锁定后内容不能在修改。

long WINAPI PEU_Reader_SystemInfor(long ReaderHandle,unsigned char *Response_APDU);//用于得到卡的详细信息


//############################ AT88SC 102 Card #########################################################

long WINAPI EU_Reader_102_PowerOn(long ReaderHandle,unsigned char *data); //102卡上电
long WINAPI EU_Reader_102_PowerOff(long ReaderHandle);					   //102卡下电

long WINAPI EU_Reader_102_Read(long ReaderHandle,int offset,int len,unsigned char *data);  //102卡读数据
long WINAPI EU_Reader_102_Write(long ReaderHandle,int offset,int len,unsigned char *data); //102卡写数据
long WINAPI EU_Reader_102_BrushCard(long ReaderHandle,int offset,int len);                 //102擦卡

long WINAPI EU_Reader_102_Verify(long ReaderHandle,unsigned char *key);                               //102用户密码认证
long WINAPI EU_Reader_102_VerifyBrush(long ReaderHandle,int zone,unsigned char *key);                 //102擦卡密码认证
long WINAPI EU_Reader_102_Change(long ReaderHandle,unsigned char *newkey);                            //102修改用户密码
long WINAPI EU_Reader_102_ChangeBrushKey(long ReaderHandle,int zone,int len, unsigned char *databuff);//修改擦卡密码 熔断后无效

long WINAPI EU_Reader_102_ClearRead(long ReaderHandle,int zone);        //应用区读属性清0     　　必须用户密码核对正确后方可读卡
long WINAPI EU_Reader_102_ClearWrite(long ReaderHandle,int zone);       //应用区写属性清0       个人化后 任何情况下都不可写

long WINAPI EU_Reader_102_Imitate(long ReaderHandle,int mode);   //模拟熔断  mode==1为模拟  mode==0为取消模拟
long WINAPI EU_Reader_102_PassCount(long ReaderHandle);          //用户密码错误计数器
long WINAPI EU_Reader_102_BrushPassCount(long ReaderHandle);     //擦卡密码计时器  个人化后有128次使用，用完即止
long WINAPI EU_Reader_102_Personal(long ReaderHandle);           //熔断操作  个人化操作  调用后无法取消

//############################# AT88SC 1604 Card ##############################################################

long WINAPI EU_Reader_1604_PowerOn(long ReaderHandle,unsigned char *data);    //1604卡上电
long WINAPI EU_Reader_1604_PowerOff(long ReaderHandle);					   //1604卡下电

long WINAPI EU_Reader_1604_Read(long ReaderHandle,int offset,int len,unsigned char *data);  //1604卡读数据
long WINAPI EU_Reader_1604_Write(long ReaderHandle,int offset,int len,unsigned char *data); //1604卡写数据
long WINAPI EU_Reader_1604_BrushCard(long ReaderHandle,int offset,int len);                 //1604擦卡

long WINAPI EU_Reader_1604_Verify(long ReaderHandle,int zone,unsigned char *key);           //1604密码认证 zone=0为主密码 1为1区密码 2为2区密码 3为3区密码
long WINAPI EU_Reader_1604_VerifyBrush(long ReaderHandle,int zone,unsigned char *key);      //1604擦卡密码认证
long WINAPI EU_Reader_1604_Change(long ReaderHandle,int zone,unsigned char *newkey);        //1604修改密码
long WINAPI EU_Reader_1604_ChangeBrushKey(long ReaderHandle,int zone,unsigned char *databuff);//修改擦卡密码 熔断后无效

long WINAPI EU_Reader_1604_ClearRead(long ReaderHandle,int zone);        //应用区读属性清0     　　必须用户密码核对正确后方可读卡
long WINAPI EU_Reader_1604_ClearWrite(long ReaderHandle,int zone);       //应用区写属性清0       个人化后 任何情况下都不可写

long WINAPI EU_Reader_1604_Imitate(long ReaderHandle,int mode);   //模拟熔断  mode==1为模拟  mode==0为取消模拟
long WINAPI EU_Reader_1604_PassCount(long ReaderHandle,int zone); //密码错误计数器
long WINAPI EU_Reader_1604_BrushPassCount(long ReaderHandle,int zone);     //擦卡密码错误计时器  共8次 
long WINAPI EU_Reader_1604_Personal(long ReaderHandle);           //熔断操作  个人化操作  调用后无法取消

//############################### 闪存 Flash ##########################################################
long WINAPI EU_Reader_ReadFlash(long ReaderHandle,int offset,int len,unsigned char *data);

long WINAPI EU_Reader_WriteFlash(long ReaderHandle,int offset,int len,unsigned char *data);

//############################### 读身份证 ############################################################

int rgb2bmp(char *rgb_buffer,int nWidth,int nHeight,FILE*fp1);

long WINAPI PEU_Reader_ID_Request(long ReaderHandle);//身份证寻卡
long WINAPI PEU_Reader_ID_Select(long ReaderHandle);//身份证选卡

long WINAPI PEU_Reader_ReadIDCard(long ReaderHandle, char * pErrMsg);
long WINAPI PEU_Reader_ReadIDCardFp(long ReaderHandle, char * pErrMsg);

long WINAPI PEU_Reader_ID_Read(long ReaderHandle,unsigned char* Response);//身份证读卡
long WINAPI PEU_Reader_ID_Read_Fp(long ReaderHandle,unsigned char *data);/*读取身份证 添加读取指纹信息*/

long WINAPI PEU_Reader_ReadIDMsg(long ReaderHandle, const char* pBmpFile, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData, char *pExpire,char * pErrMsg);

long WINAPI PEU_Reader_ReadIDMsg_FP(long ReaderHandle, const char* pBmpFile, unsigned char* FpData, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData, char *pExpire,char * pErrMsg);

long WINAPI PEU_Reader_ReadIDPhotoInfo(long ReaderHandle, char* pBase64FileData, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData,  char *pExpire,char * pErrMsg);
//如果pBmpFileData==NULL，则不生成照片，如需生成照片，这里输出照片数据BASE64编码信息，需分配6025空间
long WINAPI PEU_Reader_ReadIDPhotoInfo_Fp(long ReaderHandle, char* pBmpFileData, unsigned char* pFpData, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData,  char *pExpire,char * pErrMsg);

long WINAPI PEU_Reader_ID_ReadUID(long ReaderHandle,unsigned char* UID);//读身份证ID

long WINAPI PEU_Reader_ID_ReadMsgEx(long ReaderHandle, bool iType, char* bmpFilePath, OUT char* pBaseInfo, OUT char* pbmpPhotoInfo, char* pbase64PhotoInfo, OUT unsigned char* pFPinfo, unsigned char* wlt,  char * pErrMsg);

long WINAPI PEU_Reader_ReadIDInfo(long ReaderHandle, char* pBmpFile,char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData, char *pExpire,char * pErrMsg);

long WINAPI PEU_Reader_ReadIDInfo_Fp(long ReaderHandle, char* pBmpFile, unsigned char* pFpData, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData, char *pExpire,char * pErrMsg);

//bool ZP_decode( unsigned char* tupian, const char* pFilePath, char* pBmpFileData, char* base64Data, char* pErrMsg);


long WINAPI PEU_Reader_ID_GetIDInfo(int type, char * pOutputInfo);
/*
获取单条身份证信息 char * pOutputInfo
*/
int WINAPI GetName(char* pName);
int WINAPI GetSex(char* pSex);
int WINAPI GetNation(char* pNation);
int WINAPI GetBirth(char* pBirth);
int WINAPI GetAddress(char* pAddress);
int WINAPI GetCertNo(char* pCertNo);
int WINAPI GetDepartemt(char* pDepartemt);
int WINAPI GetEffectDate(char* pEffectDate);
int WINAPI GetExpireDate(char* pExpireDate);

int WINAPI GetTXZHM(char* pTXZHM);
int WINAPI GetTXZQFCS(char* pTXZQFCS);

int WINAPI GetB64FileData(char* pB64FileData);
int WINAPI GetBmpFileData(char* pBmpFileData);
int WINAPI GetBmpFile(char* pBmpfilepath);

int	WINAPI IsFingerExist();
int	WINAPI GetFingerprint(unsigned char* fpInfo);

int	WINAPI GetCardType();
int WINAPI GetEnName(char* pEnName);
int WINAPI GetNationalityCode(char* pNationalityCode);
int WINAPI GetCardVersion(char* pCardVersion);
int WINAPI GetAuthorCode(char* pAuthorCode);
int WINAPI GetCardTypeFlag(char* pCardTypeFlag);

//#################################### 歪果仁身份证 ########################################################
long WINAPI PEU_Reader_ID_ReadWGR(long ReaderHandle, const char* pBmpFile, char *pName, char *pSex, char *pNation, char *pBirth, char *pAddress, char *pCertNo, char *pDepartment , char *pEffectData, char *pExpire,char * pErrMsg);

long WINAPI PEU_Reader_SICARD(long ReaderHandle, char* SBKH, char *XM, char *XB, char *MZ, char *CSRQ, char *SHBZHM, char *FKRQ, char *KYXQ,char* ErrMsg);

//#####################################################################################################

/*加密机&sam卡*/
long WINAPI iReadCardBas_SAM(long ReaderHandle,int iType, char* pOutInfo);

long WINAPI iReadCardBas_HSM_Step1(long ReaderHandle, int iType, char* pOutInfo);

long WINAPI iReadCardBas_HSM_Step2(long ReaderHandle, char *pKey, char* pOutInfo);



long WINAPI Rcard(long ReaderHandle,unsigned char ctime,int track,unsigned char *rlen,unsigned char *getdata);//读磁条卡


long WINAPI PEU_Reader_CardInfo(long ReaderHandle,
								 unsigned char * EUardSN , 
								 unsigned char * EUardIndate,
								 unsigned char *MsgInfo,
								 unsigned char * MsgInfoLen,
								 int t_IntMode) ;
/**
参数：
ReaderHandle：	[IN] 读卡器句柄，由EU_Reader_Open 函数获得。
EUardSN：	[OUT] 卡序列号，2字节
EUardIndate:	[OUT] 卡有效期，6字节
				MsgInfo：	[OUT] 二磁道数据
				MsgInfoLen：	[OUT] 返回的二磁道数据长度
				t_IntMode：	[IN] 读卡方式：0x01 表示接触式, 0x02 表示非接触式
返回值；返回0成功，其它失败
*/


long WINAPI HexToStr(unsigned char *Src,int len,unsigned char *Des );

long WINAPI StrToHex(unsigned char *Src, int len,unsigned char *Des);




#ifdef __cplusplus
}
#endif
#endif