//---------------------------------------------------------------------------

#ifndef LEGO_COMMH
#define LEGO_COMMH
//---------------------------------------------------------------------------
#include <DBTables.hpp>
#include <Classes.hpp>
#include "LM2000.h"
//---------------------------------------------------------------------------
class CheckLEGOs : public TThread
{
private:
        TLm2000 *Lm2000;
        TSession *TbSession;
        TTable *TbCards;
        TTable *TbHistorial;
        TTable *TbAccesos;
        void __fastcall TbHistorialBeforeOpen(TDataSet *DataSet);
        void __fastcall TbAccesosBeforeOpen(TDataSet *DataSet);

        bool __fastcall EsEntrada( int ID );

        bool __fastcall Lm2000VerboseMessage(AnsiString msg);
        bool __fastcall Lm2000BuscaTarjeta(int ID, int FGA, int TPA,
              int CDA, int *TPR, int *PNR, char *message);

        AnsiString Puerto;
        AnsiString DB_host, DB_login, DB_pwd;

        int nLEGOSe, nLEGOSs, *IDe, *IDs, DiasDeCortesia;
protected:
        void __fastcall Execute();
        bool AntiPassBack;
public:
        __fastcall CheckLEGOs(bool CreateSuspended);
        void __fastcall SetPuerto( AnsiString pCOM );
        void __fastcall SetDB( AnsiString Host, AnsiString Login, AnsiString PWD );
        void __fastcall SetLegoID(int nLe, int *Le, int nLs, int *Ls);
        void __fastcall SetDiasCortesia( int nDias );
        bool __fastcall RetiraPermisoSalida(void);
        void __fastcall SetAntiPassBack(bool AP);
        int crdDENTRO, maxDENTRO;
};
//---------------------------------------------------------------------------
#endif
 