C定义:
#ifdef _WIN32
#define STDCALL __stdcall
#else
#define STDCALL
#endif
#ifndef SDTAPI_
#define SDTAPI_
#ifdef __cplusplus
extern "C"{
#endif
/**********************************************************
********************** 端口类API *************************
**********************************************************/
int STDCALL SDT_SetMaxRFByte(int iPortID,unsigned char ucByte,int bIfOpen);
int STDCALL SDT_GetCOMBaud(int iComID,unsigned int *puiBaud);
int STDCALL SDT_SetCOMBaud(int iComID,unsigned int uiCurrBaud,unsigned int uiSetBaud);
int STDCALL SDT_OpenPort(int iPortID);
int STDCALL SDT_ClosePort(int iPortID);
int STDCALL SDT_GetErrorString(int ErrorCode, char * ErrorString);
/**********************************************************
********************** SAM类API **************************
**********************************************************/
int STDCALL SDT_GetSAMStatus(int iPortID,int iIfOpen);
int STDCALL SDT_ResetSAM(int iPortID,int iIfOpen);
int STDCALL SDT_GetSAMID(int iPortID,unsigned char *pucSAMID,int iIfOpen);
int STDCALL SDT_GetSAMIDToStr(int iPortID,char *pcSAMID,int iIfOpen);
/**********************************************************
******************* 卡类API ************************
**********************************************************/
int STDCALL SDT_StartFindIDCard(int iPortID,unsigned char *pucIIN,int iIfOpen);
int STDCALL SDT_SelectIDCard(int iPortID,unsigned char *pucSN,int iIfOpen);
int STDCALL SDT_ReadBaseMsg(int iPortID,unsigned char * pucCHMsg,unsigned int * puiCHMsgLen,unsigned char * pucPHMsg,unsigned int *puiPHMsgLen,int iIfOpen);
int STDCALL SDT_ReadFPMsg(int iPortID,unsigned char * pucFPMsg,unsigned int * puiFPMsgLen,int iIfOpen);
int STDCALL SDT_ReadIINSNDN(int iPortID,unsigned char * pucIINSNDN,int iIfOpen);
int STDCALL SDT_ReadNewAppMsg(int iPortID,unsigned char * pucAppMsg,unsigned int * puiAppMsgLen,int iIfOpen);
int STDCALL SDT_ReadBaseMsgToFile(int iPortID,char * pcCHMsgFileName,unsigned int * puiCHMsgFileLen,char * pcPHMsgFileName,unsigned int *puiPHMsgFileLen,int iIfOpen);
int STDCALL SDT_ReadIINSNDNToASCII(int iPortID, unsigned char *pucRecvData,int iIfOpen);
#ifdef __cplusplus
}
#endif
#endif
Delphi定义:
//设置射频适配器最大通信字节数
function SDT_SetMaxRFByte(iPort:integer;ucByte:uchar;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_SetMaxRFByte';
//查看串口当前波特率(该函数只用于SAM采用RS232串口的情形,如果采用USB接口则不支持该API)
function SDT_GetCOMBaud(iPort:integer;puiBaudRate:byte):integer;stdcall;external 'sdtapi.dll' name 'SDT_GetCOMBaud';
//设置SAM的串口的波特率(该函数只用于SAM采用RS232串口的情形,如果采用USB接口则不支持该API),设置成功后,在该SAM和主机注册表中都记录设置后的波特率,保证在SAM重新启动和该套API被重新调用时采用设置后的波特率。该函数调用成功后,需要延时5毫秒,然后才能继续与SAM通信
function SDT_SetCOMBaud(iPort:integer;uiCurrBaud:byte;uiSetBaud:byte):integer;stdcall;external 'sdtapi.dll' name 'SDT_SetCOMBaud';
//打开端口
function SDT_OpenPort(Com:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_OpenPort';
//关闭端口
function SDT_ClosePort(Com:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ClosePort';
//对SAM复位
function SDT_ResetSAM(iPort:integer;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ResetSAM';
//对SAM进行状态检测
function SDT_GetSAMStatus(iPort:integer;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_GetSAMStatus';
//读取SAM的编号
function SDT_GetSAMID(iPort:integer;pucSAMID:uchar;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_GetSAMID';
//读取SAM的编号(转换成字符串)
function SDT_GetSAMIDToStr(iPort:integer;pcSAMID:char;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_GetSAMIDToStr';
//开始找卡
function SDT_StartFindIDCard(iPort:Integer;pucIIN:array of CHAR;iIfOpen:Integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_StartFindIDCard';
//选卡
function SDT_SelectIDCard(iPort:Integer;pucSN:array of Char;iIfOpen:Integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_SelectIDCard';
//读取ID卡内基本信息区域信息
function SDT_ReadBaseMsg(iPort:integer;pucCHMsg:PChar;var puiCHMsgLen:Integer;pucPHMsg:PChar;var puiPHMsgLen:Integer;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ReadBaseMsg';
//读取ID卡内IIN,SN和DN
function SDT_ReadIINSNDN(iPort:integer;pucIINSNDN:uchar;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ReadIINSNDN';
//与SDT_ ReadBaseMsg函数类似,读取ID卡内基本信息区域信息,并将读到的基本信息写进输入参数所指定的文件中
function SDT_ReadBaseMsgToFile(iPortID:integer;pcCHMsgFileName:char;puiCHMsgFileLen:Integer;pcPHMsgFileName:char;puiPHMsgFileLen:Integer;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ReadBaseMsgToFile';
//读取ID卡内IIN,SN和DN,并把16进制转化成ASCII形式
function SDT_ReadIINSNDNToASCII(iPort:integer;pucIINSNDN:uchar;iIfOpen:integer):integer;stdcall;external 'sdtapi.dll' name 'SDT_ReadIINSNDNToASCII';
//将wlt文件解码成bmp文件
function GetBmp(Wlt_File:char;intf:integer):integer;stdcall;external 'WltRS.dll' name 'GetBmp';
编译通过,运行不正确!
