#pragma once
typedef enum{
	CARD_NO,//没有卡
	CARD_M1,//M1卡(4个字节)
	CARD_SIM,//超级SIM卡
	CARD_SSC,//社保卡
	CARD_YCT,//(广州)羊城通卡
	CARD_ID//身份证
}Type_Card;

typedef enum {
	rateEvent,		/**速率*/
	dataEvent		/**检测到卡*/
}readEventtype;

typedef enum{
	Type_TTL,//串口方式
	Tpye_USB//USB方式
}Cardtype;

typedef void (*onEvent) (readEventtype event, void* user_data);//已停用
#define ESIDCARD_NOTIFY_FIND				1	// 发现证件
#define ESIDCARD_NOTIFY_HEARTBEAT		2
#define ESIDCARD_NOTIFY_LOG					3		
typedef void (* IDCARD_ReadInfo)(int notify,void* user_data);

struct _ICInfo
{
	unsigned char ictype;
	unsigned char ICbuff[50];
	int ICbufflen;
};

typedef struct idInfo
{
	unsigned char name[30];//张三
	unsigned char sex[2];
	unsigned char nation[4];
	unsigned char birthDay[16];//生日
	unsigned char address[140];//地址
	unsigned char cardId[36];//身份证ID
	unsigned char grantDept[64];//发布身份证的公安局
	unsigned char begainTime[16];//开始时间
	unsigned char endTime[16];//结束时间
	char img[5*1024];		//头像信息
	unsigned int imglength;
	struct _ICInfo icinfo;
	onEvent		  eventCb;

}IDInfo;

typedef enum{
	STA_FAIL,   //读卡失败
	STA_OK=1, //读身份证卡成功
	STA_IC_OK,//读取IC卡成功
	STA_NAT_FAIL,//网络连接失败
	STA_UART_FAIL,//串口数据错误
	SAT_USB_FAIL,//USB数据错误
	STA_READCARD_TIMEOUT,//读卡超时
	STA_mDATA_FAIL,//和单片机交互出错
	STA_sDATA_FAIL,//和服务器交互出错
	STA_SERVERDISCON,//服务器断开连接
	STA_NO_CARD,//没有检测到卡
	STA_MCU_NoWORK,//单片机异常
	
}Card_Status;

//extern "C" 
extern  int  ReadIDCardLib(IDInfo *info,Cardtype ctype);
extern  int  SaveImage(char* wltBuffer,const char* bmpPath);
extern  int 	SetServiceInfo(const char* address, int port);
extern  int 	SetComInfo(const char* comName, int ibaudRate);
extern  void CARD_SetReadInfoCB(IDCARD_ReadInfo cb);


