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.

Comments

Popular posts from this blog

Quricol - QR code generator library

EIDNative Library 2.0 released

Quricol 2.0 - QR Code generator