Read SIS card from Delphi

Here is a simple smaple of reading SIS card data using EIDNative library from Delphi application.

program SisCardRead;

{$APPTYPE CONSOLE}

uses
Windows,
SysUtils,
Classes,
SISCard in '..\SISCard.pas',
EIDNative in '..\EIDNative.pas',
EIDCard in '..\EIDCard.pas';

type

TManagerProc = procedure; stdcall;
TManagerErrorProc = procedure(ErrorCode : cardinal); stdcall;

PManagerData = ^TManagerData;
TManagerData = record
CardInserted : TManagerProc;
CardActive : TManagerProc;
CardRemoved : TManagerProc;
CardInvalid : TManagerProc;
ReaderWaiting : TManagerProc;
Error : TManagerErrorProc;
end;

//callback functions
procedure DoCardInserted; stdcall;
begin
writeln('Card inserted');
end;

procedure DoCardActive; stdcall;
begin
writeln('Card active');
end;

procedure DoCardRemoved; stdcall;
begin
writeln('Card removed');
end;

procedure DoCardInvalid; stdcall;
begin
writeln('Card invalid');
end;

procedure DoReaderWaiting; stdcall;
begin
writeln('Reader waiting');
end;

procedure DoReaderError(ErrorCode : cardinal); stdcall;
begin
writeln('Reader error');
end;

var
MD : TManagerData;
SIS : TSISRecord;

procedure InitManagerData;
begin
MD.CardInserted := DoCardInserted;
MD.CardActive := DoCardActive;
MD.CardRemoved := DoCardRemoved;
MD.CardInvalid := DoCardInvalid;
MD.ReaderWaiting := DoReaderWaiting;
MD.Error := DoReaderError;
end;


begin
InitManagerData;
InitReaderEx(@MD);

if ReadSISCard(@SIS) then
begin
writeln('name: ',SIS.Name);
writeln('first name: ', SIS.FirstName);
writeln('initial: ', SIS.Initial);
writeln('sex: ',SIS.Sex);
writeln('birthdate ', SIS.BirthDate);
writeln('social security number: ', SIS.SocialSecurityNumber);
writeln('capture: ', SIS.CaptureDate);
writeln('begin: ', SIS.ValidityDateBegin);
writeln('end: ', SIS.ValidityDateEND);
writeln('num: ', SIS.CardNumber);
writeln('name: ', SIS.CardName);
end;


DoneReaderEx;
end.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s