Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 26-02-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
hay un evento el cual me interesa
Se llama OnAttTransatacion
uno de sus parametros me devuelve "el codigo" asignado a la huella digital (previamwnte grabada en el huellero)

no tengo idea de como acceder a ese metodo

me das una mano?
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
  #2  
Antiguo 26-02-2019
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.293
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por oscarac Ver Mensaje
no tengo idea de como acceder a ese metodo
me das una mano?

¿Has definido el método para capturar el evento??
¿Has hecho el Log de los parámetros? A ver qué valores llegan en el evento.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #3  
Antiguo 26-02-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
si he definido el metodo para capturar el evento
pero no se como llamarlo (invocarlo)

sigo el mismo procedimiento que el ejemplo que pusiste en ese post pero me suelta muchos errores
no se por donde empezar
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
  #4  
Antiguo 26-02-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
Código Delphi [-]
unit FrmMain_f;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, zkemkeeper_TLB, dateutils,
  Vcl.OleCtrls;

type
  TForm1 = class(TForm)
    edtIp: TEdit;
    edtPort: TEdit;
    btnDispositivoLoad: TButton;
    dbgrd1: TDBGrid;
    mmoLOG: TMemo;
    lbl1: TLabel;
    procedure btnDispositivoLoadClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
//    Procedure LeerHuella (sender: tobject; EnrollNumber, IsInValid, AttState,
//      VerifyMethod, Year, Month, Day, Hour, Minute, Second: integer);

    Procedure CapturaCodigo (sender: tobject; EnrollNumber : String; IsInvalid, AttState, VerifyMethod, year, Month, Day, hour, Minute, Second : Integer);
  private

    { Private declarations }
  public
      ZK1 : TCZKEM;
      Connected : Boolean;
      procedure OnConnect(Sender : TObject);
      procedure OnDisconnect(Sender : TObject);
      function CapturaRegistros : Boolean;
      procedure Log(aMsj : string);
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnDispositivoLoadClick(Sender: TObject);
begin

  if not(ZK1.Connect_Net(EdtIP.Text, StrToInt(EdtPort.Text))) then
    begin
      lbl1.Caption := 'Error. No se pudo conectar';
      exit;
    end;
    if not ZK1.RegEvent(1, 65535) then  //65535
      lbl1.Caption := 'Error RegEvent';

    ZK1.PullMode := 1;

      Log('Conectado...');


end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ZK1 := TCZKEM.Create(nil);
  ZK1.OnConnected := OnConnect;
  ZK1.OnAttTransaction := CapturaCodigo;
//  aqui me sale error
[dcc32 Error] FrmMain_f.pas(68): E2010 Incompatible types: 'Integer' and 'string'
end;

procedure TForm1.OnConnect(Sender: TObject);
begin
  Connected := True;
end;

procedure TForm1.OnDisconnect(Sender: TObject);
begin
  Connected := False;
end;


Procedure TForm1.CapturaCodigo (sender: tobject; EnrollNumber : String; IsInvalid, AttState, VerifyMethod, year, Month, Day, hour, Minute, Second : Integer);
Var _Resultado : Integer;   //EnrollNumber, IsInvalid, AttState, VerifyMethod, year, Month, Day, hour, Minute, Second : Integer;
begin
      Log('Entro a Leer huella');
    _Resultado := ZK1.OnAttTransactionEx (sender, EnrollNumber, IsInvalid, AttState, VerifyMethod, year, Month, Day, hour, Minute, Second);
// aqui debo jalar el codigo que se almacena en la variable EnrollNumber
end;

procedure TForm1.Log(aMsj: string);
begin
  MmoLOG.Lines.Add(aMsj);
end;

end.
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
  #5  
Antiguo 26-02-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
vayamos por partes a ver si estoy entendiendo bien
Código Delphi [-]
unit FrmMain_f;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, zkemkeeper_TLB, dateutils,
  Vcl.OleCtrls;

type
  TForm1 = class(TForm)
    edtIp: TEdit;
    edtPort: TEdit;
    btnDispositivoLoad: TButton;
    dbgrd1: TDBGrid;
    mmoLOG: TMemo;
    lbl1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure LeerHuella(Sender: Tobject);
  private

    { Private declarations }
  public
      ZK1 : TCZKEM;
      Connected : Boolean;
      procedure OnConnect(Sender : TObject);
      procedure OnDisconnect(Sender : TObject);
      procedure Log(aMsj : string);
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ZK1 := TCZKEM.Create(nil);
  ZK1.OnConnected := OnConnect;
  ZK1.OnFinger := LeerHuella;
  if not(ZK1.Connect_Net(EdtIP.Text, StrToInt(EdtPort.Text))) then
    begin
      lbl1.Caption := 'Error. No se pudo conectar';
      exit;
    end;
    if not ZK1.RegEvent(1, 65535) then  //65535
      lbl1.Caption := 'Error RegEvent';

    ZK1.PullMode := 1;
    Log('Conectado...');
end;

procedure TForm1.OnConnect(Sender: TObject);
begin
  Connected := True;
end;

procedure TForm1.OnDisconnect(Sender: TObject);
begin
  Connected := False;
end;


procedure TForm1.LeerHuella(sender: tobject);
  Var _Resultado : Integer;
_Sender : TObject;
EnrollNumber : Integer;
IsInValid, AttState, VerifyMethod, Year, Month, Day, Hour, Minute, Second : Integer;
begin
  Log ('Huella Detectada');
end;

procedure TForm1.Log(aMsj: string);
begin
  MmoLOG.Lines.Add(aMsj);
end;

end.

Código Delphi [-]
    procedure LeerHuella(Sender: Tobject);

es el procedimiento que se ejecutara cuando ponga el dedo en el huellero
Código Delphi [-]
  ZK1 := TCZKEM.Create(nil);
  ZK1.OnConnected := OnConnect;
  ZK1.OnFinger := LeerHuella;

cargo el "componente", lo conecto y le digo cuando se dispare el evento Onfinger (que es colocar el dedo en el huellero) ejecuta el procedimiento Leer huella

hasta ahi estamos bien si?
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
  #6  
Antiguo 27-02-2019
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.293
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por oscarac Ver Mensaje
...cargo el "componente", lo conecto y le digo cuando se dispare el evento Onfinger (que es colocar el dedo en el huellero) ejecuta el procedimiento Leer huella

hasta ahi estamos bien si?

Yo hasta aquí lo veo bien.
Crear el componente, le assignas los eventos OnFinger y OnConnect (el OnDisconnect no).
Y luego haces el Connect_Net.


A partir de ahí si llegas al punto en que está conectado (suponiendo que no haya que llamar algún método más para inicializar) deberían empezar a llegarte eventos cuando pongas el dedo.
Cada vez que se ejecute el evento en el dispositivo (OnFinger), a tu programa llegará el control al procedimniento LeerHuella.



¿Es correcto?
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #7  
Antiguo 27-02-2019
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.293
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Algunas consideraciones...


1) Los procedimientos definidos, colócalos dentro de la parte privada.
Código Delphi [-]
   ...

    dbgrd1: TDBGrid;
    mmoLOG: TMemo;
    lbl1: TLabel;
  private

    procedure FormCreate(Sender: TObject);
    procedure LeerHuella(Sender: Tobject);

    procedure AttTransactionProc(ASender: TObject; EnrollNumber: Integer; IsInValid: Integer;
                                 AttState: Integer; VerifyMethod: Integer;
                                 Year: Integer; Month: Integer; Day: Integer;
                                 Hour: Integer; Minute: Integer;
                                 Second: Integer);
    procedure GeneralEventProc(ASender: TObject; const DataStr: WideString);
  public


2) Define un par más para ver otros eventos:
Código Delphi [-]
    procedure AttTransactionProc(ASender: TObject; EnrollNumber: Integer; IsInValid: Integer;
                                 AttState: Integer; VerifyMethod: Integer;
                                 Year: Integer; Month: Integer; Day: Integer;
                                 Hour: Integer; Minute: Integer;
                                 Second: Integer);
    procedure GeneralEventProc(ASender: TObject; const DataStr: WideString);


3) Añade la implementación con el Log.
Código Delphi [-]
procedure TForm1.GeneralEventProc(ASender: TObject; const DataStr: WideString);
begin
  Log('TForm1.GeneralEventProc');
  Log('  - DataString: ' + DataStr);
end;

procedure TForm1.AttTransactionProc(ASender: TObject; EnrollNumber, IsInValid,
  AttState, VerifyMethod, Year, Month, Day, Hour, Minute, Second: Integer);
begin
  Log('TForm1.AttTransactionProc');
  Log('  - EnrollNumber: ' + IntToStr(EnrollNumber));
  Log('  - IsInValid: ' + IntToStr(IsInValid));
  Log('  - AttState: ' + IntToStr(AttState));
  Log('  - VerifyMethod: ' + IntToStr(VerifyMethod));
  Log('  - Year: ' + IntToStr(Year));
  Log('  - Month: ' + IntToStr(Month));
  Log('  - Day: ' + IntToStr(Day));
  Log('  - Hour: ' + IntToStr(Hour));
  Log('  - Minute: ' + IntToStr(Minute));
  Log('  - Second: ' + IntToStr(Second));
end;


4) Y asignalos todos en la creación del componente:
Código Delphi [-]
...

  ZK1 := TCZKEM.Create(nil);
  ZK1.OnConnected := OnConnect;
  ZK1.OnFinger := LeerHuella;
  ZK1.OnDisConnected := OnDisconnect;
  ZK1.OnAttTransaction := AttTransactionProc;
  ZK1.OnGeneralEvent := GeneralEventProc;


Por último, estaría bien que nos pusieras la salida del Log, cuando ejecutas y cuando pones el dedo en el lector.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #8  
Antiguo 27-02-2019
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
Cita:
Empezado por Neftali [Germán.Estévez] Ver Mensaje
Yo hasta aquí lo veo bien.
Crear el componente, le assignas los eventos OnFinger y OnConnect (el OnDisconnect no).
Y luego haces el Connect_Net.


A partir de ahí si llegas al punto en que está conectado (suponiendo que no haya que llamar algún método más para inicializar) deberían empezar a llegarte eventos cuando pongas el dedo.
Cada vez que se ejecute el evento en el dispositivo (OnFinger), a tu programa llegará el control al procedimniento LeerHuella.



¿Es correcto?
Correcto, hasta aqui funciona
voy a probar lo que has mencionado posteriormente y les aviso
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Interceptar DBEdit ecfisa OOP 3 01-07-2008 11:57:34
Interceptar post.... brandolin Varios 1 29-08-2007 15:23:47
Interceptar impresión Walcasar Impresión 0 19-10-2006 15:22:20
Interceptar DBNavigator dape Conexión con bases de datos 1 09-04-2005 18:36:16
interceptar error edfz Conexión con bases de datos 2 08-04-2004 01:12:28


La franja horaria es GMT +2. Ahora son las 04:37:01.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi