/**************************************************************************
<MODULE NAME>
<FILENAME></FILENAME>
<HISTORY>
	<MODIFICATION>
		<DATE></DATE>
		<ATHOR>DRO</ATHOR>
		<DESCRIPTION>
		</DESCRIPTION>
	</MODIFICATION>
</HISTORY>
</MODULE NAME>
**************************************************************************/


/**************************************************************************
INCLUDE FILE
**************************************************************************/
#include <stdio.h>
#include <PROCESS.H>
#include "harddetc.h"
#include "..\comp\PcDetec\PcDetec.h"
#include "..\comp\drv\drv.h"
#include "..\comp\lcd\lcd.h"
#include "..\comp\File\CFile.h"


/**************************************************************************
LOCAL VARIABLES
Always start with « static »-keyword
**************************************************************************/

/**************************************************************************
<METHOD>
	<CLASS>CHardDetecPc</CLASS>
	<NAME>CHardDetecPc</NAME>
	<TYPE > LOCAL  GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CHardDetecPc::CHardDetecPc()
{
    //ctor
}

/**************************************************************************
<METHOD>
	<CLASS>CHardDetecPc</CLASS>
	<NAME>~CHardDetecPc</NAME>
	<TYPE > LOCAL | GLOBAL </TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
</METHOD>
**************************************************************************/
CHardDetecPc::~CHardDetecPc()
{
    //dtor
}

/**************************************************************************
<METHOD>
	<CLASS>CHardDetecPc</CLASS>
	<NAME>DiscoverTypeOfPc</NAME>
	<TYPE>GLOBAL</TYPE>
	<DESCRIPTION></DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME></NAME>
			<TYPE></TYPE>
			<IO> IN | OUT | INOUT</ IO >
			<DESCRIPTION>
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
	<RETURNS>
		<TYPE></TYPE>
		<DESCRIPTION>
		</DESCRIPTION>
	</RETURNS>
</METHOD>
**************************************************************************/
int CHardDetecPc::DiscoverTypeOfPc()
{
	int iResult = 0;
	CDetecPC hPcDetec;
	CTypePc::e_PcType ehTypePc;

	ehTypePc = hPcDetec.TypeOfPc();
	m_hPcType.SetPcType(ehTypePc);

	iResult = (int)ehTypePc;
/*
	switch (ehTypePc)
	{
	case CTypePc::eJiteMavVer1:
	case CTypePc::eJiteMavVer2:
		{
			if(spawnl(P_WAIT, "a:\\drvjites\\DZINE.COM", NULL) == -1)
			{
				;
			}
			drv();
			break;
		}
	case CTypePc::eJiteUrneVer1:
	case CTypePc::eJiteUrneVer2:
		{
			break;
		}
	case CTypePc::eDigivotMav1:
		{
			if(spawnl(P_WAIT, "A:\\PEN\\PXL-BIOS.COM ", "@A:\\PEN\\PXL-BIOS.DTA", NULL) == -1)
			{
				;
			}
			drv();
			break;
		}
	case CTypePc::eDigivotUrne1:
		{
			break;
		}
	default:
		{
			iResult = -1;
			break;
		}
	}
*/
	if(iResult >= 0)
	{
		/* Save the Pc type into the config file*/
		if(CreateDefinitionFile() < 0)
		{
			iResult = -1;
		}
	}
	return iResult;
}


/**************************************************************************
<METHOD>
	<CLASS>CHardDetecPc</CLASS>
	<NAME>CreateDefinitionFile</NAME>
	<TYPE>LOCAL</TYPE>
	<DESCRIPTION>
        Create one image of the class into one file of configuration.
    </DESCRIPTION>
	<PARAMETERS>
		<PARAMETER>
			<NAME>htype</NAME>
			<TYPE>CTypePc</TYPE>
			<IO> IN </IO>
			<DESCRIPTION>
                This class contain the type of machine
                (lightpen, keyboard, ...)
			</DESCRIPTION>
		</PARAMETER>
	</PARAMETERS>
	<RETURNS>
		<TYPE>int</TYPE>
		<DESCRIPTION>
            Returns, 0 if succes.
		</DESCRIPTION>
	</RETURNS>
</METHOD>
**************************************************************************/
int CHardDetecPc::CreateDefinitionFile(void)
{
    int iResult = 0;
    CFile hFile("c:\\PcType.dat","w");
    iResult = hFile.Write((void*) &m_hPcType, sizeof(m_hPcType));
    return iResult;
}
