⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mc900.h

📁 智能卡 CPU卡操作DEMO 测试工具
💻 H
📖 第 1 页 / 共 2 页
字号:

/*
 Function:	Power-On IC card.

 Syntax:    void PowerOn (int port, unsigned char *data, unsigned char *me1,
					 unsigned char *me2,int *status, int *line)

					 port           // port selected (1 through 4)
					 data           //answer to reset data.
					 me1,me2        //IC card status.
					 status         //mc900 status.
					 line           //comunication status.

 Remarks:   PowerOn connecting the operating voltage to IC card.
				Power on must be applied to the card prior to any
				other operation.

				IC card status: For CPU card when no error occurs,
					me1,me2=(0x90,0), when error occurs the me1,me2
					will be set according to the error. For memory
					card, me1,me2=(0x90,0) is always true.

				MC900 status: The coupler status. (See enum MC900Status).

				communication status: The computer communication status.
									(See enum MC900_ReplyStatus).
*/


/*
 Function:	Power-On IC card and detect card type.

 Syntax:    int AutoPowerOn (int port, unsigned char *data, unsigned char *me1,
					 unsigned char *me2,int *status, int *line)

					 port           // port selected (1 through 4)
					 data           //answer to reset data.
					 me1,me2        //IC card status.
					 status         //mc900 status.
					 line           //comunication status.

 Remarks:   PowerOn connecting the operating voltage to IC card
				and detect card type.
				Power on must be applied to the card prior to any
				other operation.

				IC card status: For CPU card when no error occurs,
					me1,me2=(0x90,0), when error occurs the me1,me2
					will be set according to the error. For memory
					card, me1,me2=(0x90,0) is always true.

				MC900 status: The coupler status. (See enum MC900Status).

				communication status: The computer communication status.
									(See enum MC900_ReplyStatus).

 Returns:	>0 type of card if success(See enum CardType), the card is
						powered on.
				<0 if fail, card status unknown.
				=0 if not in the card type list. The card is powered off after
					 the function returned.
*/

int FAR PASCAL AutoPowerOn (int com, unsigned char *data, unsigned char *me1, unsigned char *me2,
		int *status, int *line);

/*
 Function:	detect if card is in the reader.

 Syntax:    int IfCardExist(int com, int *status, int *line);

					 com           // port selected (1 through 4)
					 status         //mc900 status.
					 line           //comunication status.


				MC900 status: The coupler status. (See enum MC900Status).

				communication status: The computer communication status.
									(See enum MC900_ReplyStatus).

 Returns:   =1 if card is in the reader.
				=0 if card is not in the reader.
				<0 if fail.
*/
int FAR PASCAL IfCardExist(int com, int *status, int *line);



void FAR PASCAL  PowerOn (int com, unsigned char *data, unsigned char *me1, unsigned char *me2,
		int *status, int *line);


/*
 Function:	Power-Off IC card.

 Syntax:	void PowerOff (int port, int *status, int *line)

					 port           // port selected (1 through 4)
					 status         //mc900 status.
					 line           //comunication status.

 Remarks:   PowerOff disconnecting the operating voltage to IC card.
				Power Off must be applied to the card after all	other
				operation has completed.
*/
void FAR PASCAL  PowerOff (int port, int *status, int *line);


/*
 Function:	Set type of IC card.

 Syntax:	void DefineCard(int port,unsigned char type,int * rc)
					 port           // port selected (1 through 4)
					 type           //card type.
					 int *rc;       // result

 Remarks:	DefineCard tells to coupler the type of the card
				to be operate.

				result:       =-1 if failed
								  =0  if success
*/
void FAR PASCAL  DefineCard(int port,enum CardType type,int * rc);


/*
 Function:      ISO OutCommand.

 Syntax:  void OutCommand (int port, unsigned char cla, unsigned char ins,
			  unsigned int P1P2,unsigned char P3, unsigned char *data, unsigned char *me1,
			  unsigned char *me2, int *status, int *line,int *olen);

					 port           // port selected (1 through 4)
					 cla,ins,P1P2,P3// ISO OutCommand parameters.
										 //cla:command class
										 //ins:command
										 //P1P2:offset of data
										 //P3:  length of data
					 data           //pointer to data buffer.
					 me1,me2        //IC card status.
					 status         //mc900 status.
					 line           //comunication status.

 Remarks:	Standard ISO out command.
*/

void FAR PASCAL  OutCommand (int com, unsigned char cla, unsigned char ins, unsigned int P1P2,
		 unsigned char P3, unsigned char *data, unsigned char *me1,
		 unsigned char *me2, int *status, int *line,int *olen);


/*
 Function:	ISO standard In Command.

 Syntax:	void InCommand (int port, unsigned char cla, unsigned char ins, unsigned  int P1P2,
		 unsigned char P3, unsigned char *data, unsigned char *me1,
		 unsigned char *me2, int *status, int *line
		 int *olen, int APDUtype, int le)


					 port           // port selected (1 through 4)
					 cla,ins,P1P2,P3// ISO OutCommand parameters.
										 //cla:command class
										 //ins:command
										 //P1P2:offset of data
										 //P3:  length of data
					 data           //pointer to data buffer.
					 me1,me2        //IC card status.
					 status         //mc900 status.
					 line           //comunication status.

 Remarks:	Standard ISO in command.
*/
void FAR PASCAL  InCommand (int com, unsigned char cla, unsigned char ins, unsigned int P1P2,
		 unsigned char P3, unsigned char *data, unsigned char *me1,
		 unsigned char *me2, int *status, int *line, int * olen,
		 int APDUtype,int le);

/*functions below is used by programmers of out own company,
	and is not recommanded to be used by customers.*/

void FAR PASCAL  CommonCommand (int com,
		 unsigned char *data, unsigned int len,unsigned char *me1,
		 unsigned char *me2, int *status, int *line,int *olen);

#ifdef __cplusplus
	}
#endif

int FAR PASCAL  Transact (int port, unsigned char * in_data, int in_len,
	  unsigned char * out_data, int * out_len);

void i_to_hex (unsigned int in_int,unsigned char * out_hex,int byte_len);

void SetOutBody (unsigned char *out_data,int out_len,
	unsigned char * out_body,unsigned char * me1,unsigned char * me2,
	int * status);

int ICread(int port, int address, int datalen,
	unsigned char Class,unsigned char Command,
	 unsigned char *data,unsigned char * me1,unsigned char * me2,
	int * status, int *line);

int ICwrite(int port, int address, int datalen,
	unsigned char Class,unsigned char Command,
	 unsigned char *data,unsigned char * me1,unsigned char * me2,
	int * status, int *line);
void FAR PASCAL  OutCommand_echo (int com, unsigned char cla, unsigned char ins, unsigned int P1P2,
		 unsigned char P3, unsigned char *data, unsigned char *me1,
		 unsigned char *me2, int *status, int *line,int *olen);
void FAR PASCAL  InCommand_echo (int com, unsigned char cla, unsigned char ins, unsigned int P1P2,
		 unsigned char P3, unsigned char *data, unsigned char *me1,
		 unsigned char *me2, int *status, int *line, int * olen,
		 int APDUtype,int le);


int FAR PASCAL ASCIIToChar(unsigned char *dest,unsigned char *src, unsigned len);
int FAR PASCAL CharToASCII(unsigned char *dest, unsigned char *src, unsigned len);

#endif /* _MC900_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -