📄 codapi.h
字号:
//-------------------------------
// Name: CODApi.h
//-------------------------------
#ifndef __CODAPI_H__
#define __CODAPI_H__
#ifndef DllExport
#define DllExport __declspec( dllexport )
#endif
/*
Definitions of different Error Codes
*/
#define COD_S_OK 0x00 // Successful termination of a function
#define COD_E_TIMEOUT 0x02 // Timeout occured, no response from the card
#define COD_E_CRC 0x03 // Wrong CRC checksum
#define COD_E_PARITY 0x04 // Parity error
#define COD_E_BITCOUNT 0x05 // Wrong Bitcount received
#define COD_E_NAK 0x06 // Negative Acknowledge received
#define COD_E_BCC 0x07 // Error in the Checkbyte
#define COD_E_GENERAL 0x08 // General error not further specified
#define COD_E_COLLISION 0x10 // Received Data corrupt due to a collision
#define COD_E_CARD_NAK 0x15 // NAK from the Card
#define COD_E_CSUM_NEG 0x52 // Negative checksum
#define COD_E_UNKNOWN_CMD 0x6D // Unknown command
#define COD_E_FORMAT_ERROR 0x6F // Wrong data format
#define COD_E_COMP_DEFECT 0x86 // Component defect
#define COD_E_SYS_ERROR 0x98 // System error (e.g. no card)
#define COD_E_PROT_ERROR 0x9A // Protocol error
#define COD_E_CMD_NOT_ALLOWED 0x9B
#define COD_E_CARD_REMOVED 0xCA // No card present
#define xdata
#define data
#ifndef FWRC_DEFINED
#define FWRC_DEFINED
typedef unsigned char FWRC;
#endif
#ifndef MEM_BUFFER_DEFINED
#define MEM_BUFFER_DEFINED
typedef struct {
BYTE srclen;
BYTE xdata *srcbuf;
} MEM_BUFFER;
#endif
// Defines of CL Protocol constants
#define CASCADE_TAG 0x88
/*------------------------------------------------------------------------------
Group Reader-specific Functions:
------------------------------------------------------------------------------*/
/*++
InterfaceOpen:
This funktion open the serial interface for read and write
Arguments:
strPortSettings - String, which specifies the settings of the serial port
"<Portnumber>:<Baudrate>" e.g. "COM1:115200"
Return Value:
An Integer value indicating the status of the requested action.
Return Meaning
====== =======
1 InterfaceOpen was successfull
0 InterfaceOpen failed
Author:
Notes:
--*/
//extern "C" int WINAPI InterfaceOpen(char *strPortSettings);
DllExport int InterfaceOpen(char *strPortSettings);
/*++
InterfaceClose:
This function closes the serial interface
Arguments:
none
Return Value:
none
Author:
Notes:
--*/
//extern "C" void WINAPI InterfaceClose();
DllExport void InterfaceClose();
/*++
InterfaceType:
This function returns the Information about the type of the attached interface.
Arguments:
none
Return Value:
An Integer value indicating the interface type.
Return Meaning
====== =======
1 Interface type = RS232
2 Interface type = Parallel
3 Interface type = TCP/IP
4 Interface type = PC/SC
5 Interface type = USB
6.. RFU
Author:
Notes:
--*/
//extern "C" int WINAPI InterfaceType();
DllExport int InterfaceType();
/*------------------------------------------------------------------------------
Group GUI-Specific Functions:
------------------------------------------------------------------------------*/
/*++
ask10:
This function sets the SLF9000 to ASK10 Mode
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, ASK is 10%
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI ask10 (void);
DllExport FWRC ask10 (void);
/*++
ask100:
This function sets the SLF9000 to ASK100 Mode
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, ASK is 100%
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI ask100 (void);
DllExport FWRC ask100 (void);
/*++
fifo_rd_modify_wr:
This function writes a Fifo-Byte at the specified Position
Arguments:
bFifoPos - Specifies the Position of the Byte in the Fifo
bNewVal - Specifies the Value of the new Byte at FifoPos
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI fifo_rd_modify_wr (BYTE bFifoPos, BYTE bNewVal);
DllExport FWRC fifo_rd_modify_wr (BYTE bFifoPos, BYTE bNewVal);
/*++
get_all_regs:
This function reads all SLF9000 Registers (excl. Fifo) into RegBuf
Arguments:
pbRegBuf - Buffer for the Register Values
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI get_all_regs (BYTE *pbRegBuf);
DllExport FWRC get_all_regs (BYTE *pbRegBuf);
/*++
fifo_rd:
This function reads the complete SLF9000 Fifo into FifoBuf
Arguments:
pbFifoBuf - Buffer for the Fifo content
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI fifo_rd (BYTE *pbFifoBuf);
DllExport FWRC fifo_rd (BYTE *pbFifoBuf);
/*++
fifo_wr:
This function writes the complete SLF9000 Fifo from FifoBuf
Arguments:
pbFifoBuf - Buffer for the Fifo content
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI fifo_wr (BYTE *pbFifoBuf);
DllExport FWRC fifo_wr (BYTE *pbFifoBuf);
/*++
card_reset:
This function resets all cards in the RF-Field by switching the RF off
and on again.
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI card_reset (void);
DllExport FWRC card_reset (void);
/*++
slf9000_soft_reset:
This function resets the SLF9000.
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI slf9000_soft_reset (void);
DllExport FWRC slf9000_soft_reset (void);
/*------------------------------------------------------------------------------
Group SLF9000:
------------------------------------------------------------------------------*/
/*++
rf_on:
This function activates the RF field of the contactless reader
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, RF field is on
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI rf_on(void);
DllExport FWRC rf_on(void);
/*++
rf_off:
This function deactivates the RF field of the contactless reader
Arguments:
none
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, RF field is off
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI rf_off(void);
DllExport FWRC rf_off(void);
/*++
wr_cll_reg:
This function writes the reg_value to the register adressed by reg_adr
Arguments:
reg_adr - specifies the address of the register to be written
reg_value - specifies the value to be written
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, value written
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI wr_cll_reg (BYTE reg_adr, BYTE reg_value);
DllExport FWRC wr_cll_reg (BYTE reg_adr, BYTE reg_value);
/*++
rd_cll_reg:
This function reads the reg_value from the register adressed by reg_adr
Arguments:
reg_adr - specifies the address of the register to be written
RegValue - specifies the location where the value of the addressed register is written to
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, register value valid
COD_E_GENERAL Error during command execution, command failed
Author:
Notes:
--*/
//extern "C" FWRC WINAPI rd_cll_reg (BYTE reg_adr, BYTE data *RegValue);
DllExport FWRC rd_cll_reg (BYTE reg_adr, BYTE data *RegValue);
/*++
trscv_cll:
This function transmits the Data submitted in SRCPTR and returns the response into DESTPTR.
Any communication parameter (Time-Out, Bitcount) must be set before. The status of the
reception must be retrieved separately after termination (except Time-Out).
Arguments:
SrcPtr - specifies the data to to be sent
DestPtr - specifies the buffer for the received data
Return Value:
A FWRC value indicating the status of the requested action.
Return Meaning
====== =======
COD_S_OK Successful termination, DestPtr contains the received data
COD_E_TIMEOUT No answer from the card received in between the waiting time
Author:
Notes:
--*/
//extern "C" FWRC WINAPI trscv_cll (MEM_BUFFER *SrcPtr, MEM_BUFFER *DestPtr);
DllExport FWRC trscv_cll (MEM_BUFFER *SrcPtr, MEM_BUFFER *DestPtr);
/*++
set_comm_mode:
With this command, the addition and the check of CRC and Parity for the subsequent
communication can be specified. Further, the divisor rates for the transmission and
reception can be set.
Arguments:
bmMode - specifies the addition and checking of Parity and CRC
b8 b1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -