first commit (2002-04-24)
This commit is contained in:
commit
4d943d773d
252 files changed
+17433
No files matched your search
Binary file not shown.
File diff suppressed because it is too large.
Load diff
Binary file not shown.
@@ -0,0 +1,180 @@
|
||||
// #define PRUEBAS_SIN_VCL
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef LM2000H
|
||||
#define LM2000H
|
||||
//---------------------------------------------------------------------------
|
||||
#include <SysUtils.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Forms.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
/** Estructura que define a una tarjeta */
|
||||
typedef struct
|
||||
{
|
||||
int FLG; // Enabling flag
|
||||
int TYP; // Card Type
|
||||
int CDA; // Card Code
|
||||
int PIN; // PIN
|
||||
int GIS; // Expiration day
|
||||
int MES; // Expiration month
|
||||
int ANS; // Expiration year
|
||||
int ORS; // Expiration hour
|
||||
int MIS; // Expiration minute
|
||||
int SES; // Expiration second
|
||||
int REV; // Revision
|
||||
int CRD; // Credit
|
||||
} TCard;
|
||||
|
||||
/** Estructura que define el modo de lectura/escritura */
|
||||
typedef struct
|
||||
{
|
||||
int FMC; // Card memory flag
|
||||
int MAC; //
|
||||
int LFN; // Operation logic
|
||||
int NCR; // Cards in memory
|
||||
int CMN; // Minimum code
|
||||
int CMX; // Maximum code
|
||||
int NBN; // Number of bands
|
||||
int NMP; // Number of messages
|
||||
int NFA; // Number of periods
|
||||
int RMS; // Lines in messages
|
||||
int MCA; // Motive mode
|
||||
int MCR; // Credit mode
|
||||
} RMem;
|
||||
|
||||
/** Program Operation Parameters */
|
||||
typedef struct
|
||||
{
|
||||
int BKN; // Network block
|
||||
int BKP; // Printer block
|
||||
int PRN; // Print mode
|
||||
int MCL; // Mode for requesting information from P.C.
|
||||
int MCK; // Card control mode
|
||||
int ENF; // Enabling of keyboard functions
|
||||
int SNV; // Anomaly memorization mode
|
||||
int ENI; // Number of intrusions per apparatus block
|
||||
} POP;
|
||||
|
||||
/** Configuracion de fecha/hora */
|
||||
typedef struct
|
||||
{
|
||||
int GIA; // Day
|
||||
int MEA; // Month
|
||||
int ANA; // Year
|
||||
int ORA; // Hour
|
||||
int MIA; // Minute
|
||||
int SEA; // Second
|
||||
} RClock;
|
||||
|
||||
/** Estructura TSD */
|
||||
typedef struct
|
||||
{
|
||||
int CHN;
|
||||
int GSL;
|
||||
int MMS;
|
||||
int ASL;
|
||||
int HSL;
|
||||
int MSL;
|
||||
int SSL;
|
||||
} TSD;
|
||||
|
||||
/** Caracteres en la Banda */
|
||||
typedef struct
|
||||
{
|
||||
int GAP; // Number of empty characters preceding prefix
|
||||
int LEP; // Length of prefix in characters
|
||||
int GAC; // Number of empty characters preceding code
|
||||
int LEC; // Length of code in characters
|
||||
int GAR; // Number of empty characters preceding revision
|
||||
int LER; // Number of characters containing number of revision
|
||||
int GDI; // Number of empty characters preceding validity start date
|
||||
int GDF; // Number of empty characters preceding validity end date
|
||||
} CAB;
|
||||
|
||||
/** LM2000
|
||||
Clase que encapsula las funciones necesarias para comunicarse con el LM2000
|
||||
*/
|
||||
#ifdef PRUEBAS_SIN_VCL
|
||||
class PACKAGE TLm2000
|
||||
#else
|
||||
class PACKAGE TLm2000 : public TComponent
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
int __fastcall GeneraChecksum( char *cadena );
|
||||
char * __fastcall ObtenerRespuesta( char *rcv );
|
||||
char * __fastcall EnviarComando( char *CMD, int ID, char *rcv );
|
||||
char * __fastcall ObtenerParametro( char *cadena, int narg, char *prm );
|
||||
bool __fastcall ProcesaTarjeta( int ID, char *msg );
|
||||
|
||||
/** Manejador que apunta al Puerto donde dialogamos */
|
||||
HANDLE LM_handle;
|
||||
/** Indica si estamos en comunicación actualmente */
|
||||
bool LM_opened;
|
||||
|
||||
void __fastcall ProcesaTransito( char *FGT, char *TPT, char *CDT, char *O, char *DTT, char *CTT, char *ETT );
|
||||
|
||||
#ifndef PRUEBAS_SIN_VCL
|
||||
typedef bool __fastcall (__closure *Tprintfv)( AnsiString msg );
|
||||
typedef bool __fastcall (__closure *TBuscaTarjeta)( int ID, int FGA, int TPA, int CDA, int *TPR, int *PNR, char *message );
|
||||
typedef void __fastcall (__closure *TOnProcesaTransito)( char *FGT, char *TPT, char *CDT, char *O, char *DTT, char *CTT, char *ETT );
|
||||
Tprintfv printfv;
|
||||
TBuscaTarjeta FOnBuscaTarjeta;
|
||||
TOnProcesaTransito FOnProcesaTransito;
|
||||
#else
|
||||
void __fastcall printfv( AnsiString msg );
|
||||
#endif
|
||||
|
||||
protected:
|
||||
public:
|
||||
#ifdef PRUEBAS_SIN_VCL
|
||||
__fastcall TLm2000(void);
|
||||
#else
|
||||
__fastcall TLm2000(TComponent* Owner);
|
||||
#endif
|
||||
__fastcall ~TLm2000(void);
|
||||
|
||||
void __fastcall CierraPuerto(void);
|
||||
int __fastcall AbrePuerto(LPTSTR lpszPortName);
|
||||
|
||||
/** El 'polling' debe llamar continuamente a esta función para conocer
|
||||
el estado de los dispositivos 'ID' */
|
||||
char * __fastcall SimpleInterrogation( int ID, char *rcv );
|
||||
|
||||
// LECTURA DE MEMORIA
|
||||
bool __fastcall ReadCardMemory( int ID, TCard *CRD );
|
||||
void __fastcall ReadEntireCardMemory( int ID );
|
||||
// ESCRITURA DE MEMORIA
|
||||
int __fastcall EnterCardMemory( int ID, TCard *CRD );
|
||||
int __fastcall DeleteCardMemory( int ID, int TIP, int COD );
|
||||
int __fastcall DeleteAllCardMemory( int ID, int TIP );
|
||||
// CONFIGURACION LM2000
|
||||
bool __fastcall ConfigureMemory( int ID, RMem *mem );
|
||||
RMem * __fastcall ReadMemoryCFG( int ID, RMem *mem );
|
||||
bool __fastcall ProgrammingPeriods( int ID, int NFS, int PBN, char *StarTime, char *EndTime, int GIF );
|
||||
bool __fastcall ResetClock( int ID, RClock *clock );
|
||||
int __fastcall ReadingPrefixes( int ID, int NPR );
|
||||
bool __fastcall ReadPersonalMessage( int ID );
|
||||
void __fastcall ReadAllPersonalMessage( int ID );
|
||||
void __fastcall SetTime( int ID, TSD *tsd );
|
||||
char * __fastcall ReadSystemMessages( int ID, int IDmsg, char *rcv );
|
||||
bool __fastcall ProgramOperationParameters( int ID, POP *pop );
|
||||
bool __fastcall SetCharsOnBand( int ID, CAB *cab );
|
||||
bool __fastcall GetCharsOnBand( int ID, CAB *cab );
|
||||
bool __fastcall PassageOpening( int ID, int Passage );
|
||||
|
||||
/* Llamadas que deben ser sobrecargadas CALLBACK*/
|
||||
// void __fastcall ProcesaTransito( char *FGT, char *TPT, char *CDT, char *O, char *DTT, char *CTT, char *ETT );
|
||||
// bool __fastcall BuscaTarjeta( int FGA, int TPA, int CDA, int *TPR, int *PNR, char *message );
|
||||
#ifndef PRUEBAS_SIN_VCL
|
||||
__published:
|
||||
__property Tprintfv OnVerboseMessage = {read=printfv, write=printfv };
|
||||
__property TOnProcesaTransito OnProcesaTransito = {read=FOnProcesaTransito, write=FOnProcesaTransito };
|
||||
__property TBuscaTarjeta OnBuscaTarjeta = {read=FOnBuscaTarjeta, write=FOnBuscaTarjeta };
|
||||
#endif
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,159 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.06.00"/>
|
||||
<PROJECT value="..\LM2000_vcl\LM2000_vcl.bpl"/>
|
||||
<OBJFILES value="..\obj\LM2000_vcl.obj ..\obj\LM2000.obj"/>
|
||||
<RESFILES value="LM2000.dcr"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES)"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value=""/>
|
||||
<SPARELIBS value="rtl.lib vcl.lib"/>
|
||||
<PACKAGES value="rtl.bpi vcl.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value="_DEBUG"/>
|
||||
<SYSDEFINES value="_RTLDLL;NO_STRICT;USEPACKAGES"/>
|
||||
<MAINSOURCE value="LM2000_vcl.cpp"/>
|
||||
<INCLUDEPATH value="..\cap_control;$(BCB)\include;$(BCB)\include\vcl"/>
|
||||
<LIBPATH value="..\cap_control;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||
<WARNINGS value="-w-par"/>
|
||||
<OTHERFILES value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I..\cap_control -I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp
|
||||
-D_DEBUG -boa"/>
|
||||
<CFLAG1 value="-Od -H=c:\ARCHIV~1\borland\CBUILD~2\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8
|
||||
-b- -k -y -v -vi- -c -tWM"/>
|
||||
<PFLAGS value="-N2..\obj -N0..\obj -$YD -$W -$O- -$A8 -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zd"/>
|
||||
<LFLAGS value="-l..\LM2000_vcl -I..\obj -D"Funciones para el Manejo del LM2000" -aa -Tpp
|
||||
-x -Gn -Gl -Gi -v"/>
|
||||
<OTHERFILES value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0pkg32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
|
||||
<OTHERFILES value=""/>
|
||||
</LINKER>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="LM2000_vcl.cpp" FORMNAME="" UNITNAME="LM2000_vcl" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="LM2000.cpp" FORMNAME="" UNITNAME="LM2000" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="LM2000.dcr" FORMNAME="" UNITNAME="LM2000" CONTAINERID="DcrTool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\cap_control_CB5\rtl.bpi" FORMNAME="" UNITNAME="rtl" CONTAINERID="BPITool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\cap_control_CB5\vcl.bpi" FORMNAME="" UNITNAME="vcl" CONTAINERID="BPITool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
</FILELIST>
|
||||
<BUILDTOOLS>
|
||||
</BUILDTOOLS>
|
||||
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=1
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=3
|
||||
Item0=..\cap_control;$(BCB)\include;$(BCB)\include\vcl
|
||||
Item1=..\cap_control;$(BCB)\include;$(BCB)\include\vcl;C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
Item2=;..\cap_control;$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=3
|
||||
Item0=..\cap_control;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item1=..\cap_control;$(BCB)\lib\obj;$(BCB)\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
Item2=;..\cap_control;$(BCB)\lib\obj;$(BCB)\lib
|
||||
|
||||
[HistoryLists\hlDebugSourcePath]
|
||||
Count=1
|
||||
Item0=$(BCB)\source\vcl
|
||||
|
||||
[HistoryLists\hlConditionals]
|
||||
Count=1
|
||||
Item0=_DEBUG
|
||||
|
||||
[HistoryLists\hlIntOutputDir]
|
||||
Count=1
|
||||
Item0=..\obj
|
||||
|
||||
[HistoryLists\hlFinalOutputDir]
|
||||
Count=3
|
||||
Item0=..\LM2000_vcl
|
||||
Item1=C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl\
|
||||
Item2=C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
|
||||
[HistoryLists\hIBPIOutputDir]
|
||||
Count=3
|
||||
Item0=..\LM2000_vcl
|
||||
Item1=C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl\
|
||||
Item2=C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteLauncher=
|
||||
RemoteCWD=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
|
||||
[Linker]
|
||||
LibPrefix=
|
||||
LibSuffix=
|
||||
LibVersion=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Package source.
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma argsused
|
||||
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
del *.~*
|
||||
del *.tds
|
||||
del *.obj
|
||||
|
||||
del *.ilc
|
||||
del *.ild
|
||||
del *.ilf
|
||||
del *.ils
|
||||
Binary file not shown.
Binary file not shown.
+104
@@ -0,0 +1,104 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="TestLM.exe"/>
|
||||
<OBJFILES value="TestLM.obj test.obj"/>
|
||||
<RESFILES value="TestLM.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES) test.dfm"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="LM2000_vcl.lib VCL50.lib"/>
|
||||
<SPARELIBS value="VCL50.lib LM2000_vcl.lib"/>
|
||||
<PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi VCLDB50.bpi VCLADO50.bpi ibsmp50.bpi
|
||||
VCLBDE50.bpi VCLDBX50.bpi QRPT50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi
|
||||
DSS50.bpi TEEQR50.bpi VCLIB50.bpi VCLMID50.bpi VCLIE50.bpi INETDB50.bpi
|
||||
INET50.bpi NMFAST50.bpi WEBMID50.bpi bcbie50.bpi dclocx50.bpi
|
||||
bcb2kaxserver50.bpi asgc5.bpi CabForCB.bpi CoolPack.bpi JDsoft.bpi
|
||||
PhantomPack.bpi RAS_Tools.bpi LM2000_vcl.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="tlink32"/>
|
||||
<USERDEFINES value="_DEBUG"/>
|
||||
<SYSDEFINES value="NO_STRICT"/>
|
||||
<MAINSOURCE value="TestLM.cpp"/>
|
||||
<INCLUDEPATH value="..\LM2000_vcl;$(BCB)\include;$(BCB)\include\vcl"/>
|
||||
<LIBPATH value="..\..\VCLs\lib;..\LM2000_vcl;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||
<WARNINGS value="-w-par"/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I..\LM2000_vcl -I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp
|
||||
-D_DEBUG -boa"/>
|
||||
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
|
||||
-tW -tWM"/>
|
||||
<PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zd"/>
|
||||
<LFLAGS value="-D"" -aa -Tpe -x -Gn -v"/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
|
||||
</LINKER>
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
||||
@@ -0,0 +1,22 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
USERES("TestLM.res");
|
||||
USEFORM("test.cpp", Form1);
|
||||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->CreateForm(__classid(TForm1), &Form1);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "test.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "LM2000"
|
||||
#pragma resource "*.dfm"
|
||||
TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TForm1::TForm1(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
Lm2000->AbrePuerto("COM1");
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall TForm1::Lm2000BuscaTarjeta(int ID, int FGA, int TPA,
|
||||
int CDA, int *TPR, int *PNR, char *message)
|
||||
{
|
||||
return CheckBox1->Checked;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::FormDestroy(TObject *Sender)
|
||||
{
|
||||
Lm2000->CierraPuerto();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Button1Click(TObject *Sender)
|
||||
{
|
||||
Lm2000->PassageOpening( 1, 1 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Button2Click(TObject *Sender)
|
||||
{
|
||||
Lm2000->PassageOpening( 1, 2 );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Button3Click(TObject *Sender)
|
||||
{
|
||||
Lm2000->PassageOpening( 1, 3 );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Button4Click(TObject *Sender)
|
||||
{
|
||||
Lm2000->PassageOpening( 1, 4 );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TForm1::Lm2000VerboseMessage(AnsiString msg)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,67 @@
|
||||
object Form1: TForm1
|
||||
Left = 197
|
||||
Top = 174
|
||||
Width = 425
|
||||
Height = 320
|
||||
Caption = 'Form1'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnDestroy = FormDestroy
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object Button1: TButton
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 193
|
||||
Height = 113
|
||||
Caption = 'Salida por defecto, del cabezal 1'
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 8
|
||||
Top = 136
|
||||
Width = 193
|
||||
Height = 113
|
||||
Caption = 'Salida por defecto, del cabezal 2'
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 216
|
||||
Top = 8
|
||||
Width = 193
|
||||
Height = 113
|
||||
Caption = 'Salida 1'
|
||||
TabOrder = 2
|
||||
OnClick = Button3Click
|
||||
end
|
||||
object Button4: TButton
|
||||
Left = 216
|
||||
Top = 136
|
||||
Width = 193
|
||||
Height = 113
|
||||
Caption = 'Salida 2'
|
||||
TabOrder = 3
|
||||
OnClick = Button4Click
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 8
|
||||
Top = 264
|
||||
Width = 145
|
||||
Height = 17
|
||||
Caption = 'Las tarjetas son corectas'
|
||||
TabOrder = 4
|
||||
end
|
||||
object Lm2000: TLm2000
|
||||
OnVerboseMessage = Lm2000VerboseMessage
|
||||
OnBuscaTarjeta = Lm2000BuscaTarjeta
|
||||
Left = 376
|
||||
Top = 16
|
||||
end
|
||||
end
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef testH
|
||||
#define testH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Classes.hpp>
|
||||
#include <Controls.hpp>
|
||||
#include <StdCtrls.hpp>
|
||||
#include <Forms.hpp>
|
||||
#include "LM2000.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TForm1 : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TButton *Button1;
|
||||
TButton *Button2;
|
||||
TButton *Button3;
|
||||
TButton *Button4;
|
||||
TLm2000 *Lm2000;
|
||||
TCheckBox *CheckBox1;
|
||||
bool __fastcall Lm2000BuscaTarjeta(int ID, int FGA, int TPA,
|
||||
int CDA, int *TPR, int *PNR, char *message);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
void __fastcall Button2Click(TObject *Sender);
|
||||
void __fastcall Button3Click(TObject *Sender);
|
||||
void __fastcall Button4Click(TObject *Sender);
|
||||
bool __fastcall Lm2000VerboseMessage(AnsiString msg);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TForm1(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
USEUNIT("ZT2000.cpp");
|
||||
//---------------------------------------------------------------------------
|
||||
This file is used by the project manager only and should be treated like the project file
|
||||
|
||||
␍main
|
||||
@@ -0,0 +1,140 @@
|
||||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!-- C++Builder XML Project -->
|
||||
<PROJECT>
|
||||
<MACROS>
|
||||
<VERSION value="BCB.06.00"/>
|
||||
<PROJECT value="CardWriter.exe"/>
|
||||
<OBJFILES value="ZT2000.obj"/>
|
||||
<RESFILES value=""/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
<DEFFILE value=""/>
|
||||
<RESDEPEN value="$(RESFILES)"/>
|
||||
<LIBFILES value=""/>
|
||||
<LIBRARIES value="VCL50.lib"/>
|
||||
<SPARELIBS value="VCL50.lib"/>
|
||||
<PACKAGES value="rtl.bpi vcl.bpi vclx.bpi bcbsmp.bpi dbrtl.bpi vcldb.bpi adortl.bpi
|
||||
ibsmp.bpi bdertl.bpi vcldbx.bpi qrpt.bpi teeui.bpi teedb.bpi tee.bpi
|
||||
dss.bpi teeqr.bpi ibxpress.bpi dsnap.bpi vclie.bpi inetdb.bpi inet.bpi
|
||||
nmfast.bpi webdsnap.bpi bcbie.bpi dclocx.bpi bcb2kaxserver.bpi asgc5.bpi
|
||||
CabForCB.bpi CoolPack.bpi JDsoft.bpi PhantomPack.bpi RAS_Tools.bpi
|
||||
LM2000_vcl.bpi"/>
|
||||
<PATHCPP value=".;"/>
|
||||
<PATHPAS value=".;"/>
|
||||
<PATHRC value=".;"/>
|
||||
<PATHASM value=".;"/>
|
||||
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
|
||||
<RELEASELIBPATH value="$(BCB)\lib\release"/>
|
||||
<LINKER value="ilink32"/>
|
||||
<USERDEFINES value="_DEBUG"/>
|
||||
<SYSDEFINES value="NO_STRICT;_NO_VCL;USEPACKAGES"/>
|
||||
<MAINSOURCE value="CardWriter.bpf"/>
|
||||
<INCLUDEPATH value="..\checksum_gen;..\;$(BCB)\include;$(BCB)\include\vcl;..\..\VCLs\lib;..\LM2000_vcl"/>
|
||||
<LIBPATH value="..\..\..\VCLs\lib;"C:\Archivos de programa\Borland\CBuilder6\Lib\Debug";..\checksum_gen;$(BCB)\Projects\Lib;..\;..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib;..\LM2000_vcl"/>
|
||||
<WARNINGS value="-w-par"/>
|
||||
<OTHERFILES value=""/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-I..\checksum_gen -I..\. -I$(BCB)\include -I$(BCB)\include\vcl
|
||||
-I..\..\VCLs\lib -I..\LM2000_vcl -src_suffix cpp -D_DEBUG -boa"/>
|
||||
<CFLAG1 value="-Od -H=c:\ARCHIV~1\BORLAND\CBUILD~2\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8
|
||||
-b- -k -y -v -vi- -tWC -tWM -c"/>
|
||||
<PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zd"/>
|
||||
<LFLAGS value="-D"" -ap -Tpe -x -Gn -v"/>
|
||||
<OTHERFILES value=""/>
|
||||
</OPTIONS>
|
||||
<LINKER>
|
||||
<ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/>
|
||||
<ALLRES value="$(RESFILES)"/>
|
||||
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
|
||||
<OTHERFILES value=""/>
|
||||
</LINKER>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="CardWriter.bpf" FORMNAME="" UNITNAME="CardWriter" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="ZT2000.cpp" FORMNAME="" UNITNAME="ZT2000" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||
</FILELIST>
|
||||
<BUILDTOOLS>
|
||||
</BUILDTOOLS>
|
||||
|
||||
<IDEOPTIONS>
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=3082
|
||||
CodePage=1252
|
||||
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
|
||||
[HistoryLists\hlIncludePath]
|
||||
Count=4
|
||||
Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\VCLs\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
Item1=$(BCB)\include;$(BCB)\include\vcl;..\..\VCLs\lib
|
||||
Item2=$(BCB)\include;$(BCB)\include\vcl;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\lib
|
||||
Item3=$(BCB)\include;$(BCB)\include\vcl
|
||||
|
||||
[HistoryLists\hlLibraryPath]
|
||||
Count=3
|
||||
Item0=..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\CAP\LM2000_vcl
|
||||
Item1=..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib
|
||||
Item2=..\..\VCLs\lib;$(BCB)\lib\obj;$(BCB)\lib;C:\Mis documentos\Fuentes de Programacion\C++ Builder\VCLs\lib
|
||||
|
||||
[HistoryLists\hlDebugSourcePath]
|
||||
Count=1
|
||||
Item0=$(BCB)\source\vcl
|
||||
|
||||
[HistoryLists\hlConditionals]
|
||||
Count=1
|
||||
Item0=_DEBUG
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=$(BCB)\source\vcl
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
RemoteLauncher=
|
||||
RemoteCWD=
|
||||
RemoteDebug=0
|
||||
|
||||
[Compiler]
|
||||
ShowInfoMsgs=0
|
||||
LinkDebugVcl=0
|
||||
LinkCGLIB=0
|
||||
|
||||
[CORBA]
|
||||
AddServerUnit=1
|
||||
AddClientUnit=1
|
||||
PrecompiledHeaders=1
|
||||
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
</IDEOPTIONS>
|
||||
</PROJECT>
|
||||
Binary file not shown.
@@ -0,0 +1,359 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma argsused
|
||||
#include "stdio.h"
|
||||
//#include "cstring.h"
|
||||
#include "stdlib.h"
|
||||
#include "conio.h"
|
||||
#include "windows.h"
|
||||
|
||||
#define _verbose ACTIVA_EXPLICACION_PROCESOS
|
||||
|
||||
HANDLE LM_handle;
|
||||
bool LM_opened = false;
|
||||
|
||||
int AbrePuerto(LPTSTR lpszPortName)
|
||||
{
|
||||
DWORD dwError;
|
||||
DCB PortDCB;
|
||||
COMMTIMEOUTS CommTimeouts;
|
||||
|
||||
if ( LM_opened ) return true;
|
||||
|
||||
LM_opened = false;
|
||||
|
||||
// Open the serial port.
|
||||
LM_handle = CreateFile (lpszPortName, // Pointer to the name of the port
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
// Access (read/write) mode
|
||||
0, // Share mode
|
||||
NULL, // Pointer to the security attribute
|
||||
OPEN_EXISTING,// How to open the serial port
|
||||
0, // Port attributes
|
||||
NULL); // Handle to port with attribute
|
||||
// to copy
|
||||
|
||||
// If it fails to open the port, return FALSE.
|
||||
if ( LM_handle == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
dwError = GetLastError ();
|
||||
return false;
|
||||
} else {
|
||||
LM_opened = true;
|
||||
}
|
||||
|
||||
PortDCB.DCBlength = sizeof (DCB);
|
||||
|
||||
// Get the default port setting information.
|
||||
GetCommState (LM_handle, &PortDCB);
|
||||
|
||||
// Change the DCB structure settings.
|
||||
PortDCB.BaudRate = 9600; // Current baud
|
||||
PortDCB.fBinary = TRUE; // Binary mode; no EOF check
|
||||
PortDCB.fParity = TRUE; // Enable parity checking.
|
||||
PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control
|
||||
PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control
|
||||
PortDCB.fDtrControl = DTR_CONTROL_ENABLE;
|
||||
// DTR flow control type
|
||||
PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity
|
||||
PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx
|
||||
PortDCB.fOutX = FALSE; // No XON/XOFF out flow control
|
||||
PortDCB.fInX = FALSE; // No XON/XOFF in flow control
|
||||
PortDCB.fErrorChar = FALSE; // Disable error replacement.
|
||||
PortDCB.fNull = FALSE; // Disable null stripping.
|
||||
PortDCB.fRtsControl = RTS_CONTROL_ENABLE;
|
||||
// RTS flow control
|
||||
PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on
|
||||
// error.
|
||||
PortDCB.ByteSize = 7; // Number of bits/bytes, 4-8
|
||||
/*
|
||||
PortDCB.ByteSize = 8; // Number of bits/bytes, 4-8
|
||||
*/
|
||||
PortDCB.Parity = EVENPARITY; // 0-4=no,odd,even,mark,space
|
||||
PortDCB.StopBits = 0; // 0,1,2 = 1, 1.5, 2
|
||||
|
||||
// Configure the port according to the specifications of the DCB
|
||||
// structure.
|
||||
if (!SetCommState (LM_handle, &PortDCB))
|
||||
{
|
||||
// Could not configure the serial port.
|
||||
printf( "Unable to configure the serial port\n%s\n" );
|
||||
dwError = GetLastError ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Retrieve the time-out parameters for all read and write operations
|
||||
// on the port.
|
||||
GetCommTimeouts (LM_handle, &CommTimeouts);
|
||||
|
||||
// Change the COMMTIMEOUTS structure settings.
|
||||
CommTimeouts.ReadIntervalTimeout = MAXDWORD;
|
||||
|
||||
// CommTimeouts.ReadTotalTimeoutMultiplier = 0;
|
||||
CommTimeouts.ReadTotalTimeoutMultiplier = 1000;
|
||||
|
||||
CommTimeouts.ReadTotalTimeoutConstant = 1000;
|
||||
CommTimeouts.WriteTotalTimeoutMultiplier = 10;
|
||||
CommTimeouts.WriteTotalTimeoutConstant = 1000;
|
||||
|
||||
// Set the time-out parameters for all read and write operations
|
||||
// on the port.
|
||||
if (!SetCommTimeouts (LM_handle, &CommTimeouts))
|
||||
{
|
||||
// Could not set the time-out parameters.
|
||||
printf( "Unable to set the time-out parameters" );
|
||||
dwError = GetLastError ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Direct the port to perform extended functions SETDTR and SETRTS.
|
||||
// SETDTR: Sends the DTR (data-terminal-ready) signal.
|
||||
// SETRTS: Sends the RTS (request-to-send) signal.
|
||||
EscapeCommFunction (LM_handle, SETDTR);
|
||||
EscapeCommFunction (LM_handle, SETRTS);
|
||||
|
||||
return LM_opened;
|
||||
};
|
||||
|
||||
void CierraPuerto(void)
|
||||
{
|
||||
if ( LM_opened )
|
||||
{
|
||||
CloseHandle( LM_handle );
|
||||
}
|
||||
};
|
||||
|
||||
// ObtenerRespuesta
|
||||
// Lee del puerto los datos pendientes del buffer
|
||||
// (solo lee lo que expulse el LM)
|
||||
//
|
||||
//
|
||||
char *ObtenerRespuesta( char *rcv )
|
||||
{
|
||||
bool waitingResp = true;
|
||||
DWORD CHK, chkF = 0;
|
||||
int i = 0;
|
||||
DWORD dwCommModemStatus;
|
||||
|
||||
if ( LM_opened )
|
||||
{
|
||||
/*
|
||||
// Specify a set of events to be monitored for the port.
|
||||
SetCommMask (LM_handle, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD | EV_RING);
|
||||
// Wait for an event to occur for the port.
|
||||
WaitCommEvent (LM_handle, &dwCommModemStatus, 0);
|
||||
// Re-specify the set of events to be monitored for the port.
|
||||
SetCommMask (LM_handle, EV_RXCHAR | EV_CTS | EV_DSR | EV_RING);
|
||||
*/
|
||||
// Recogemos la respuesta del lector
|
||||
while( i < 75 )
|
||||
{
|
||||
ReadFile( LM_handle, &(rcv[i]), 1, &CHK, NULL );
|
||||
if ( CHK == 1 )
|
||||
{
|
||||
if ( waitingResp )
|
||||
{
|
||||
if ( rcv[i] != 0x06) waitingResp = false;
|
||||
// ACK
|
||||
// printf( "Esperando a la tarjeta\n" );
|
||||
}
|
||||
|
||||
if ( rcv[i] == 13 ) break; else {
|
||||
if ( !waitingResp || i==0 ) i++;
|
||||
}
|
||||
} else
|
||||
if ( CHK == 0 )
|
||||
{
|
||||
chkF++;
|
||||
if ( chkF == 20 )
|
||||
{
|
||||
sprintf( rcv, "ERROR: Respuesta fuera de tiempo" );
|
||||
return rcv;
|
||||
}
|
||||
}
|
||||
}
|
||||
rcv[i+1] = '\0';
|
||||
|
||||
} else {
|
||||
sprintf( rcv, "ERROR: LM no abierto" );
|
||||
}
|
||||
|
||||
#ifdef _verbose
|
||||
printf( "Recibido: %s\n", rcv );
|
||||
#endif
|
||||
|
||||
return rcv;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// EnviarComando
|
||||
// Envia el comando CMD al lector ID, devolviendo la respuesta 'rcv'
|
||||
//
|
||||
//
|
||||
//
|
||||
char *EnviaCMD1( char *CMD, char *rcv, char mlen )
|
||||
{
|
||||
DWORD CHK;
|
||||
if ( LM_opened )
|
||||
{
|
||||
|
||||
#ifdef _verbose
|
||||
printf( "Enviado: %s\n", CMD );
|
||||
#endif
|
||||
WriteFile( LM_handle, CMD, strlen(CMD)+mlen, &CHK, NULL );
|
||||
|
||||
ObtenerRespuesta( rcv );
|
||||
} else
|
||||
sprintf( rcv, "ERROR: LM no abierto" );
|
||||
|
||||
return rcv;
|
||||
}
|
||||
char *EnviaCMD( char *CMD, char *rcv )
|
||||
{
|
||||
EnviaCMD1( CMD, rcv, 0 );
|
||||
return rcv;
|
||||
}
|
||||
|
||||
#define ZT_ClearCommand "/CL0/"
|
||||
// #define ZT_ReadCommand "/RD3/"
|
||||
#define ZT_ReadCommand "/RD1/"
|
||||
#define ZT_WriteCommand "/WR1/"
|
||||
#define ACK 0x06
|
||||
#define STX 0x02
|
||||
#define NAK 0x15
|
||||
#define ETX 0x03
|
||||
#define EOT 0x04
|
||||
#define CR 0x0D
|
||||
|
||||
|
||||
char CalculaBCC( char *cadena )
|
||||
{
|
||||
int i, dev=0;
|
||||
for ( i=0; cadena[i] != ETX; i++ )
|
||||
{
|
||||
dev ^= cadena[i];
|
||||
}
|
||||
dev ^= cadena[i];
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
char *LeeTarjeta( char *rcv )
|
||||
{
|
||||
// Leemos una tarjeta
|
||||
char buff[3];
|
||||
EnviaCMD( ZT_ReadCommand, rcv );
|
||||
if ( rcv[0] == ACK && rcv[1] == 0x0D )
|
||||
{
|
||||
// Ahora si se ha recibido <ACK><CR> Leemos la tarjeta que pasemos
|
||||
ObtenerRespuesta( rcv );
|
||||
// Vemos si es la tarjeta o un error
|
||||
if ( rcv[0] == STX && rcv[1] == '/' && rcv[2] == 'E' && rcv[3] == 'R' )
|
||||
{
|
||||
//es un error
|
||||
#ifdef _verbose
|
||||
printf( "Error: %d", rcv[1] );
|
||||
#endif
|
||||
} else {
|
||||
char len = 0;
|
||||
while( rcv[len]!=CR )len++;
|
||||
|
||||
char BCC = CalculaBCC( &rcv[1] ),
|
||||
BCCr = rcv[ len-1 ];
|
||||
if ( BCC != BCCr )
|
||||
{
|
||||
printf( "Error: BCC recibido es incorrecto BCC(%x) != R(%x)\n", BCC, BCCr );
|
||||
}
|
||||
}
|
||||
buff[0] = ACK; buff[1] = '\0';
|
||||
EnviaCMD( buff, rcv );
|
||||
} else {
|
||||
sprintf( rcv, "ERROR: Commando no aceptado\n");
|
||||
}
|
||||
return rcv;
|
||||
}
|
||||
|
||||
char *EscribeTarjeta( char *datos, char *rcv )
|
||||
{
|
||||
// Leemos una tarjeta
|
||||
char env[140], buff[140], BCC;
|
||||
EnviaCMD( ZT_WriteCommand, rcv );
|
||||
if ( rcv[0] == ACK && rcv[1] == CR )
|
||||
{
|
||||
sprintf( env, "%s%c", datos, ETX );
|
||||
BCC = CalculaBCC( env );
|
||||
sprintf( buff, "%c%s%c", STX, env, BCC );
|
||||
if ( BCC )
|
||||
EnviaCMD( buff, rcv );
|
||||
else
|
||||
EnviaCMD1( buff, rcv, 1 );
|
||||
|
||||
if ( rcv[0] == ACK && rcv[1] == CR )
|
||||
{
|
||||
// Ahora si se ha recibido <ACK><CR> Leemos la tarjeta que pasemos
|
||||
ObtenerRespuesta( rcv );
|
||||
// Vemos si es la tarjeta o un error
|
||||
if ( !(rcv[0] == EOT && rcv[1] == CR) )
|
||||
{
|
||||
//es un error
|
||||
sprintf( rcv, "Error: %s\n", rcv );
|
||||
#ifdef _verbose
|
||||
printf( "Error: %s\n", rcv );
|
||||
#endif
|
||||
}
|
||||
buff[0] = ACK; buff[1] = CR; buff[2] = '\0';
|
||||
EnviaCMD( buff, rcv );
|
||||
} else {
|
||||
sprintf( rcv, "ERROR: No se recibio respuesta despues de los datos\n" );
|
||||
}
|
||||
} else {
|
||||
sprintf( rcv, "ERROR: Commando no aceptado\n");
|
||||
}
|
||||
return rcv;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Pruebas con LM2000 JD soft (c)\n");
|
||||
printf("------------------\n");
|
||||
|
||||
AbrePuerto("COM1:");
|
||||
|
||||
char rcv[80];
|
||||
|
||||
// Inicializamos el ZT-2300
|
||||
EnviaCMD( ZT_ClearCommand, rcv );
|
||||
if ( rcv[0] == 'E' )
|
||||
{
|
||||
printf( "\nError durante la comunicación" );
|
||||
} else {
|
||||
/*
|
||||
do{
|
||||
LeeTarjeta( rcv );
|
||||
} while ( getch() != 13 );
|
||||
*/
|
||||
LeeTarjeta( rcv );
|
||||
printf("\n\n\n%s\n\n", rcv );
|
||||
// EscribeTarjeta( "123456789123465789765132156484513216", rcv );
|
||||
}
|
||||
printf( "\n\n FIN DEL PROGRAMA \n\n" );
|
||||
getch();
|
||||
|
||||
CierraPuerto();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
[CAP_c]
|
||||
PuertoLego=0
|
||||
IDsLegoE=1;
|
||||
IDsLegoS=1;
|
||||
historial=1
|
||||
|
||||
[CAP_w]
|
||||
PuertoEscritor=1
|
||||
|
||||
[CAP_g]
|
||||
ImporteMensual=10,00
|
||||
ImporteBimestral=20,00
|
||||
ImporteTrimestral=30,00
|
||||
ImporteAnual=40,00
|
||||
|
||||
precioMinuto=0,13
|
||||
precioInicial=0,30
|
||||
|
||||
|
||||
[parking]
|
||||
Capacidad=1000
|
||||
MsgParking_lleno=El parking esta lleno
|
||||
|
||||
[db]
|
||||
host=.
|
||||
login=NO_ES_SQL
|
||||
pwd=NO_ES_SQL
|
||||
|
||||
[horas]
|
||||
sobrecargar=1
|
||||
verL=0
|
||||
desdeL=00:00
|
||||
hastaL=00:00
|
||||
verM=1
|
||||
desdeM=00:00
|
||||
hastaM=00:00
|
||||
verX=1
|
||||
desdeX=00:00
|
||||
hastaX=00:00
|
||||
verJ=1
|
||||
desdeJ=13:00
|
||||
hastaJ=13:15
|
||||
verV=1
|
||||
desdeV=12:45
|
||||
hastaV=00:00
|
||||
verS=0
|
||||
desdeS=00:00
|
||||
hastaS=21:54
|
||||
verD=0
|
||||
desdeD=00:00
|
||||
hastaD=00:00
|
||||
|
||||
|
||||
|
||||
# Leyendas
|
||||
# -------------------- - - - -
|
||||
# [fechaE] Fecha Entrada
|
||||
# [fechaS] Fecha Salida
|
||||
# [idt] Número de ticket
|
||||
# [pvp] PVP
|
||||
# [mm] Minutos facturados
|
||||
#
|
||||
# [r] Empieza la linea en ROJO
|
||||
# [n] Empieza la linea en NEGRO
|
||||
# [L] Alineación a la izquierda
|
||||
# [R] Alineación a la derecha
|
||||
# [C] Centrado
|
||||
# [F] Doble tamaño de fuente
|
||||
# [F1] Doble Doble tamaño de fuente
|
||||
# [f] Tamaño sencillo de fuente
|
||||
# [fd] Avance y Corte del ticket (si esta disponible)
|
||||
|
||||
[ticketE]
|
||||
cab1={F}Control Acceso{f}
|
||||
cab2={r}Parking de prueba
|
||||
cab3={n}--------------------------
|
||||
cab4=
|
||||
cab5={R}Fecha: {fechaE}
|
||||
cab6={L}Num Ticket:
|
||||
cab7={r}{F1}{C}{idt}
|
||||
cab8={f}{L}{n}
|
||||
cab9=--------------------------
|
||||
cab10={C}Recuerde que la presentación
|
||||
cab11=de este ticket es imprescindible
|
||||
cab12=para realizar la retirada de su
|
||||
cab13=vehiculo.
|
||||
cab14=
|
||||
|
||||
|
||||
[ticketS]
|
||||
cab1={F}{C}Control Acceso
|
||||
cab2={r}{f}Parking de prueba
|
||||
cab3={n}--------------------------
|
||||
cab4=Ticket: {idt}
|
||||
cab5=Entrada: {fechaE}
|
||||
cab6=Salida: {fechaS}
|
||||
cab7=Tiempo Facturado:
|
||||
cab8={r}{R}{mm} minutos
|
||||
cab9={L}{n}Total:
|
||||
cab10={R}{F}{pvp} Euros
|
||||
cab11={f}{C}{n}--------------------------
|
||||
cab12={C}Gracias por su visita.
|
||||
cab13=
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
23/06/2005 21:00:39 :: Fin de sesión
|
||||
23/06/2005 21:00:39 :: E( 1)-ERROR: Respuesta fuera de tiempo
|
||||
23/06/2005 20:59:38 :: Inicio de la sesión
|
||||
22/06/2005 21:24:39 :: Fin de sesión
|
||||
22/06/2005 21:24:39 :: E( 1)-ERROR: Respuesta fuera de tiempo
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 165 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 252 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user