unit Reader;

interface

uses
  Windows, Messages, SysUtils;

type
  ReaderDateTime = record
    Year:integer;
    Month:Byte;
    Day:Byte;
    Hour:Byte;
    Minute:Byte;
    Second:Byte;
  end;
  pReaderDateTime = ^ReaderDateTime;

  TagIds = record
    TagType:Byte;
    AntNum:Byte;
    Ids: Array[0..11] of Byte;
  end;
  pTagIds = ^TagIds;

  OLTagIds = record
    DateTime:ReaderDateTime;
    TagType:Byte;
    AntNum:Byte;
    Ids: Array[0..11] of Byte;
  end;
  pOLTagIds = ^OLTagIds;

  LockFlag = record
    Flag:Byte;
	  Action:Byte;
  end;

const
  SDK_FILE = 'Reader.dll';

  function SelectStation(m_StationNum:Byte):Smallint	;Stdcall external SDK_FILE name 'SelectStation';
  function OpenReader(phcom:PHandle; LinkType:Byte;com_port:String):Smallint;Stdcall external SDK_FILE name 'OpenReader';
  function CloseReader(hCom:THANDLE):Smallint;Stdcall external SDK_FILE name 'CloseReader';
  function ResetReader(hCom:THANDLE):Smallint;Stdcall external SDK_FILE name 'ResetReader';
  function SetBaudRate(hCom:THandle;BaudRate:Word):Smallint;Stdcall external SDK_FILE name 'SetBaudRate';
  function SetParameter(hCom:THandle;iAddr:Word;ParaCount:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'SetParameter';
  function GetParameter(hCom:THandle;iAddr:Word;ParaCount:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'GetParameter';
  function GetFirmwareVersion(hCom:THandle; SoftwareFlag:pByte;major:pByte;minor:pByte):Smallint;Stdcall external SDK_FILE name 'GetFirmwareVersion';
  function StopRFwork(hCom:THandle):Smallint;Stdcall external SDK_FILE name 'StopRFwork';

  function SingleTagIdentify(hCom:THandle;TagType:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'SingleTagIdentify';
  function MultipleTagIdentify(hCom:THandle;TagType:Byte;Count:pByte;value:pTagIds):Smallint;Stdcall external SDK_FILE name 'MultipleTagIdentify';
  function ReadTagUserWithID(hCom:THandle;DataCount:Byte;Addr:Word;Tag_ID:pByte;value:pByte):Smallint;Stdcall external SDK_FILE name 'ReadTagUserWithID';
  function ReadTagUser(hCom:THandle;DataCount:Byte;Addr:Word;value:pByte):Smallint;Stdcall external SDK_FILE name 'ReadTagUser';
  function WriteTagUserWithID(hCom:THandle;DataCount:Byte;Addr:Word;Tag_ID:pByte;value:pByte;TagStatus:pByte):Smallint;Stdcall external SDK_FILE name 'WriteTagUserWithID';
  function WriteTagUser(hCom:THandle;DataCount:Byte;Addr:Word;value:pByte;TagStatus:pByte):Smallint;Stdcall external SDK_FILE name 'WriteTagUser';

  function ReadSingleTag(hCom:THandle;TagType:Byte;Addr:Byte;Length:Byte;ID:pByte;value:pByte):Smallint;Stdcall external SDK_FILE name 'ReadSingleTag';
  function ReadSingleTag0(hCom:THandle;TagType:Byte;Id:pByte;Addr:Byte;Length:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'ReadSingleTag0';
  function WriteSingleTag(hCom:THandle; TagType:Byte;Id:pByte;Addr:Byte;Length:Byte;value:pByte;Result:pByte):Smallint;Stdcall external SDK_FILE name 'WriteSingleTag';
  function WriteSingleTag0(hCom:THandle; TagType:Byte; Id:pByte;Addr:Byte;Length:Byte;value:pByte;Result:pByte):Smallint;Stdcall external SDK_FILE name 'WriteSingleTag0';
  //function NfcLockTag(hCom:THandle;TagType:Byte;Id:pByte;LockFlag:pLockFlags;value:pByte):Smallint;Stdcall external SDK_FILE name 'NfcLockTag';
  function LockTag(hCom:THandle;TagType:Byte;Id:pByte;Addr:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'LockTag';
  function LockTag0(hCom:THandle;TagType:Byte;Id:pByte;Addr:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'LockTag0';
  function QueryLock(hCom:THandle;TagType:Byte; Id:pByte;Addr:Byte;Length:Byte;value:pByte): Smallint;Stdcall external SDK_FILE name 'QueryLock';
  function QueryLock0(hCom:THandle;TagType:Byte; Id:pByte;Addr:Byte;Length:Byte;value:pByte):Smallint;Stdcall external SDK_FILE name 'QueryLock0';
  function SetRelayState(hCom:THandle;Mask:Byte;State:Byte):Smallint;Stdcall external SDK_FILE name 'SetRelayState';
  function SetIdmData(hCom:THandle;order:Byte;match_length:Byte;count:Integer; value:pTagIds):Smallint;Stdcall external SDK_FILE name 'SetIdmData';
  function GetIdmData(hCom:THandle;moreFlag:pByte;count:pInteger;value:pTagIds):Smallint;Stdcall external SDK_FILE name 'GetIdmData';
  function SetOLEnable(hCom:THandle;flag:Byte):Smallint;Stdcall external SDK_FILE name 'SetOLEnable';
  function GetOLData(hCom:THandle;moreFlag:pByte;count:PInteger; value:pOlTagIds):Smallint;Stdcall external SDK_FILE name 'GetOLData';
  function SetReaderDateTime(hCom:THandle;ReaderdateTime:pReaderDateTime):Smallint;Stdcall external SDK_FILE name 'SetReaderDateTime';
  function GetReaderDateTime(hCom:THandle;ReaderdateTime:pReaderDateTime):Smallint;Stdcall external SDK_FILE name 'GetReaderDateTime';
implementation

end.
