/**************************************************************************
<MODULE NAME>
<FILENAME></FILENAME>
<HISTORY>
	<MODIFICATION>
		<DATE>04/01/2006</DATE>
		<AUTHOR>DRO</AUTHOR>
		<DESCRIPTION>
		</DESCRIPTION>
	</MODIFICATION>
</HISTORY>
</MODULE NAME>
**************************************************************************/
#ifndef __CDRDuDIG_H__
#define __CDRDuDIG_H__

/**************************************************************************
INCLUDE FILE
**************************************************************************/
#include "..\comp\UrnCrd\CDRDMGUR.h"
#include "..\comp\cardread\CdRdIDig.h"


/**************************************************************************
<CLASS>
	<NAME>CCardReaderValidatorDig</NAME>
	<MOTHERS>
		<MOTHER></MOTHER>
	</MOTHERS>
	<DESCRIPTION>
	</DESCRIPTION>
</CLASS>
**************************************************************************/
class CCardReaderValidatorDig : public CCardReaderUrneManager
{
public:
	CCardReaderValidatorDig(void);
	virtual ~CCardReaderValidatorDig(void);

	virtual int  LecteurInit(s_Parameters* shParm);
	virtual int  LecteurInit(void);
	virtual int  WaitCard(void);

	virtual int  SendReadCommande(char* pzLectBuffer);
	virtual int  ReadCommande(char* pzLectBuffer);

	virtual int  SendWriteCommande(const char* pzString);
	virtual int  WriteCommande(char* pzString);

	virtual int  SendEjectCommande(unsigned char ucDirection);
	virtual int  EjectCommande(char* pzString);

	virtual int  SendStatusCommande(void);
	virtual int  StatusCommande(char* pzString);

	virtual int  SendDeblock(void);
	virtual int  Deblock(char* pzString);

	virtual int  Tempo(char* pzString);
	virtual void CheckQueue(void);

	virtual int GetVersionCommande(char* pzLectBuffer)
	{return m_cReaderValidator.GetVersionCommande(pzLectBuffer);}

	virtual int GetProtocol(char* pzLectBuffer)
	{return m_cReaderValidator.GetProtocol(pzLectBuffer);}

	virtual int CloseConnection(void)
	{return m_cReaderValidator.CloseConnection();}

	/*PMD*/
	virtual int CardPosition(void)
	{return m_cReaderValidator.CardPosition();}

	static CCardReaderUrneManager* Instance(void);

	virtual void SetType(uchar _ucType) {m_ucType = _ucType;}
	virtual uchar GetType(void) {return m_ucType;}

protected:
	void ResetTransation(void) {m_ucTransation = 0;}
	void SetTransation(void) {m_ucTransation = 1;}
	uchar GetTransation(void) {return m_ucTransation;}

private:
	virtual int TestRetour(int etat, char* pzRetourString);

	CCardReaderDig m_cReaderValidator;

	uchar m_ucRxData[128];
	int m_iStatus;
	uchar m_ucTransation;

	uchar m_ucType; /* '1' -> validator, '2' -> ballot box */
};

#endif /*__CDRDuDIG_H__*/