1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
unit Itag01OCX;
interface
uses
Windows, Messages, SysUtils, Classes, CPort, CPortSetup, CPortCtl, gnugettext;
type
TItag01OCX = class(TComponent)
private
{ Private declarations }
lecteur : TComPort;
fidentifiantCrea : string;
fNumero_badge : string;
fDateDeValidite : TDateTime;
fPlageHoraire_1 : string;
fZoneAcces_1 : string;
fPlageHoraire_2 : string;
fZoneAcces_2 : string;
fPlageHoraire_3 : string;
fZoneAcces_3 : string;
fPlageHoraire_4 : string;
fZoneAcces_4 : string;
fPlageHoraire_5 : string;
fZoneAcces_5 : string;
fPlageHoraire_6 : string;
fZoneAcces_6 : string;
fPlageHoraire_7 : string;
fZoneAcces_7 : string;
fPlageHoraire_8 : string;
fZoneAcces_8 : string;
fImmatriculation : string;
fImmatriculation2 : string;
fImmatriculation3 : string;
fIdSingleCard : string;
fPortCom : string;
fFormatNumeroBadge : integer;
fNombre_plaque : string;
BlockValue : string;
Connecter : boolean;
procedure reception(Sender: TObject; Count: Integer);
procedure Envoie(instruction : string);
protected
{ Protected declarations }
public
{ Public declarations }
function test(p_int:Integer):Integer;
function Connexion : WordBool;
function Version : String;
published
{ Published declarations }
property PortCom : string read fPortCom write fPortCom;
property identifiantCrea : string read fidentifiantCrea write fidentifiantCrea;
property IdSingleCard : string read fIdSingleCard write fIdSingleCard;
property Numero_badge : string read fNumero_badge write fNumero_badge;
property DateDeValidite : TDateTime read fDateDeValidite write fDateDeValidite;
property PlageHoraire_1 : string read fPlageHoraire_1 write fPlageHoraire_1;
property PlageHoraire_2 : string read fPlageHoraire_2 write fPlageHoraire_2;
property PlageHoraire_3 : string read fPlageHoraire_3 write fPlageHoraire_3;
property PlageHoraire_4 : string read fPlageHoraire_4 write fPlageHoraire_4;
property PlageHoraire_5 : string read fPlageHoraire_5 write fPlageHoraire_5;
property PlageHoraire_6 : string read fPlageHoraire_6 write fPlageHoraire_6;
property PlageHoraire_7 : string read fPlageHoraire_7 write fPlageHoraire_7;
property PlageHoraire_8 : string read fPlageHoraire_8 write fPlageHoraire_8;
property ZoneAcces_1 : string read fZoneAcces_1 write fZoneAcces_1;
property ZoneAcces_2 : string read fZoneAcces_2 write fZoneAcces_2;
property ZoneAcces_3 : string read fZoneAcces_3 write fZoneAcces_3;
property ZoneAcces_4 : string read fZoneAcces_4 write fZoneAcces_4;
property ZoneAcces_5 : string read fZoneAcces_5 write fZoneAcces_5;
property ZoneAcces_6 : string read fZoneAcces_6 write fZoneAcces_6;
property ZoneAcces_7 : string read fZoneAcces_7 write fZoneAcces_7;
property ZoneAcces_8 : string read fZoneAcces_8 write fZoneAcces_8;
property Immatriculation : string read fImmatriculation write fImmatriculation;
property Immatriculation2 : string read fImmatriculation2 write fImmatriculation2;
property Immatriculation3 : string read fImmatriculation3 write fImmatriculation3;
property Nombre_Plaque : string read fNombre_Plaque write fNombre_Plaque;
property FormatNumeroBadge : integer read fFormatNumeroBadge write fFormatNumeroBadge;
procedure setup;
end;
procedure Register;
implementation
procedure TItag01OCX.setup;
begin
lecteur.ShowSetupDialog;
//lecteur.Port:='COM37';
lecteur.Open;
end;
function TItag01OCX.Version : string;
begin
Envoie('V');
result := 'ok';
end;
function TItag01OCX.test(p_int:Integer):Integer;
begin
result := p_int*2;
end;
function TItag01OCX.connexion:wordbool;
begin
if PortCom<>'' then
begin
lecteur.Port:=PortCom;
lecteur.BaudRate:=br9600;
lecteur.Open;
Connecter := true;
{if ConnectTo(PortCom) then
Connecter := true
else
Connecter := false;
//end}
end
else
begin
Connecter := False;
end;
result:= Connecter;
end;
procedure TItag01OCX.Envoie(instruction : string);
begin
lecteur.TransmitChar(instruction[1]);
end;
procedure TItag01OCX.reception(Sender: TObject; Count: Integer);
begin
Immatriculation:='test de reception';
end;
procedure Register;
begin
RegisterComponents('Exemples', [TItag01OCX]);
end;
end. |
Partager