/**************************************************************************
<MODULE NAME>
<FILENAME></FILENAME>
<HISTORY>
	<MODIFICATION>
		<DATE></DATE>
		<AUTHOR></AUTHOR>
		<DESCRIPTION>
		</DESCRIPTION>
	</MODIFICATION>
</HISTORY>
</MODULE NAME>
**************************************************************************/


/**************************************************************************
INCLUDE FILE
**************************************************************************/
#include "..\comp\CardRead\StMchDig\StCmdDig.h"
#include "..\comp\CardRead\StMchDig\StTmODig.h"

/**************************************************************************
LOCAL VARIABLES
Always start with « static »-keyword
**************************************************************************/
CStateMachineDigCard* CStTimOutDig::m_pcInstance = NULL;

/**************************************************************************
<METHOD>
	<CLASS>CStTimOutDig</CLASS>
	<NAME>CStTimOutDig</NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CStTimOutDig::CStTimOutDig()
{
#ifdef STESUD_TRACE
	CTrace::Instance()->Show("CStTimOutDig()");
#endif
}

/**************************************************************************
<METHOD>
	<CLASS>CStTimOutDig</CLASS>
	<NAME>CStTimOutDig</NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CStTimOutDig::~CStTimOutDig()
{
#ifdef STESUD_TRACE
	CTrace::Instance()->Show("~CStTimOutDig()");
#endif
}

/**************************************************************************
<METHOD>
	<CLASS>CStTimOutDig</CLASS>
	<NAME></NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
int CStTimOutDig::ReceiveTimeOut(CCardReaderDig* pcParent)
{
	int iResult;
#ifdef STESUD_TRACE
	CTrace::Instance()->Show("CStTimOutDig::ReceiveTimeOut");
#endif
	iResult = ChangeState(pcParent, CStCommandDig::Instance());
	if(iResult >=0 )
		iResult = pcParent->CloseConnection();
	if(iResult >=0 )
		iResult = pcParent->LecteurInit();

	if(iResult >=0 )
		iResult = ERROR_TIMEOUT;
	return iResult;
}

/**************************************************************************
<METHOD>
	<CLASS>CStTimOutDig</CLASS>
	<NAME></NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CStateMachineDigCard* CStTimOutDig::Instance(void)
{
#ifdef STESUD_TRACE
	CTrace::Instance()->Show("CStTimOutDig::Instance");
#endif
	if(m_pcInstance == NULL)
		m_pcInstance = new CStTimOutDig();
	return m_pcInstance;
}
 #pragma argsused
/**************************************************************************
<METHOD>
	<CLASS>CStTimOutDig</CLASS>
	<NAME></NAME>
	<TYPE> LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
int CStTimOutDig::SendCommand(CCardReaderDig* pcParent, char* szCommand)
{
	int iResult = ERROR_NONE_AVAILABLE;
#ifdef STESUD_TRACE
	CTrace::Instance()->Show("CStateMachineDigCard::SendCommand");
#endif
	iResult = ChangeState(pcParent, CStCommandDig::Instance());
	if(iResult >=0 )
		iResult = ERROR_TIMEOUT;
	return iResult;
}