REMOVE DLLCHR.Add TCP/IP COMM.

This commit is contained in:
TAO Cheng
2014-10-29 16:55:31 +08:00
parent d9932e709c
commit 02f1c7e503
12 changed files with 524 additions and 47 deletions
@@ -6,7 +6,7 @@
//--------------------------------------------------------------------
cAcqEasy::cAcqEasy(MCHR_ID SensorID)
{
#ifdef _DEBUG
#ifndef _REMOVE_DLLCHR
DWORD dwThreadId = 0;
int nIndex = 0, idx = 0, jdx = 0;
@@ -62,7 +62,7 @@ cAcqEasy::cAcqEasy(MCHR_ID SensorID)
//--------------------------------------------------------------------
cAcqEasy::~cAcqEasy()
{
#ifdef _DEBUG
#ifndef _REMOVE_DLLCHR
int nIndex = 0;
@@ -99,7 +99,7 @@ cAcqEasy::~cAcqEasy()
#endif //_DEBUG
}
#ifdef _DEBUG
#ifndef _REMOVE_DLLCHR
//-------------------------------------------------------------------------------------------------
void cAcqEasy::_ReleaseAcqBuffer(int NumberOfBuffers)
{
@@ -134,6 +134,7 @@ void CSTIL_CCS_PRIMA_Laser::ResetParam()
}
BOOL CSTIL_CCS_PRIMA_Laser::InitChrLib()
{
#ifndef _REMOVE_DLLCHR
char szVersion[MAX_CHAR];
//DLL initialization
@@ -151,10 +152,14 @@ BOOL CSTIL_CCS_PRIMA_Laser::InitChrLib()
}
TRACE1("DLL CHR V%s\n", szVersion);
return(TRUE);
#else
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::OpenCom (enChrConnection connectionType, int comPort, int baudrate)
{
#ifndef _REMOVE_DLLCHR
TRACE ("Init Chr Lib\n");
m_ErrorCode = SPARKSHI_ERROR_NONE;
m_nBaudrate = static_cast<WORD>(baudrate);
@@ -208,11 +213,18 @@ BOOL CSTIL_CCS_PRIMA_Laser::OpenCom (enChrConnection connectionType, int comPort
{
return(FALSE);
}
#else
UNREFERENCED_PARAMETER(connectionType);
UNREFERENCED_PARAMETER(comPort);
UNREFERENCED_PARAMETER(baudrate);
return FALSE;
#endif
}
//-----------------------------------------------------------------------------------------
BOOL CSTIL_CCS_PRIMA_Laser::CreateEvents(cAcqEasy *pAcquisitionEasy, HANDLE *pAcquisitionEvent)
{
#ifndef _REMOVE_DLLCHR
m_ErrorCode = SPARKSHI_ERROR_NONE;
if (pAcquisitionEasy == NULL)
{
@@ -231,6 +243,11 @@ BOOL CSTIL_CCS_PRIMA_Laser::CreateEvents(cAcqEasy *pAcquisitionEasy, HANDLE *pAc
}
m_ErrorCode = SPARKSHI_ERROR_CREATE_EVENT;
return (FALSE);
#else
UNREFERENCED_PARAMETER(pAcquisitionEasy);
UNREFERENCED_PARAMETER(pAcquisitionEvent);
return FALSE;
#endif
}
//-----------------------------------------------------------------------------------------
BOOL CSTIL_CCS_PRIMA_Laser::ReleaseEvents(HANDLE *pAcquisitionEvent)
@@ -246,6 +263,7 @@ BOOL CSTIL_CCS_PRIMA_Laser::ReleaseEvents(HANDLE *pAcquisitionEvent)
BOOL CSTIL_CCS_PRIMA_Laser::InitAcquisition (eAcqEasyFunc selectedFunction, enTriggerType selectedTrigger, int numberOfPointTRE)
{
#ifndef _REMOVE_DLLCHR
DWORD readLong;
m_ErrorCode = SPARKSHI_ERROR_NONE;
@@ -336,11 +354,18 @@ BOOL CSTIL_CCS_PRIMA_Laser::InitAcquisition (eAcqEasyFunc selectedFunction, enTr
else
return (FALSE);
return (TRUE);
#else
UNREFERENCED_PARAMETER(selectedFunction);
UNREFERENCED_PARAMETER(selectedTrigger);
UNREFERENCED_PARAMETER(numberOfPointTRE);
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::ReleaseAcquisition ()
{
#ifndef _REMOVE_DLLCHR
if (m_pAcqEasy)
{
m_pAcqEasy->StopAcquisition();
@@ -378,6 +403,9 @@ BOOL CSTIL_CCS_PRIMA_Laser::ReleaseAcquisition ()
m_pAcqEasy = NULL;
}
return (TRUE);
#else
return FALSE;
#endif
}
WORD CSTIL_CCS_PRIMA_Laser::GetLastError ()
@@ -387,6 +415,7 @@ WORD CSTIL_CCS_PRIMA_Laser::GetLastError ()
BOOL CSTIL_CCS_PRIMA_Laser::CloseCom ()
{
#ifndef _REMOVE_DLLCHR
BOOL bStatus(FALSE);
m_ErrorCode = SPARKSHI_ERROR_NONE;
if (m_SensorId != 0)
@@ -409,11 +438,15 @@ BOOL CSTIL_CCS_PRIMA_Laser::CloseCom ()
bStatus=(FALSE);
}
return bStatus;
#else
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::GetDistanceValue(double &dblDistance, double &dblIntensity, bool bSoftTrigger)
{
#ifndef _REMOVE_DLLCHR
int DataCount = 0;
m_ErrorCode = SPARKSHI_ERROR_NONE;
if (m_pAcqEasy == NULL)
@@ -479,11 +512,18 @@ BOOL CSTIL_CCS_PRIMA_Laser::GetDistanceValue(double &dblDistance, double &dblInt
return(SPARKSHI_ERROR);
else
return (SPARKSHI_ERROR_NONE);
#else
UNREFERENCED_PARAMETER(dblDistance);
UNREFERENCED_PARAMETER(dblIntensity);
UNREFERENCED_PARAMETER(bSoftTrigger);
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::GetThicknessValue(double &dblThickness, double &dblDistance1, double &dblDistance2, double &dblIntensity1, double &dblIntensity2, bool bSoftTrigger)
{
{
#ifndef _REMOVE_DLLCHR
int DataCount = 0;
m_ErrorCode = SPARKSHI_ERROR_NONE;
if (m_pAcqEasy == NULL)
@@ -586,12 +626,21 @@ BOOL CSTIL_CCS_PRIMA_Laser::GetThicknessValue(double &dblThickness, double &dblD
return(SPARKSHI_ERROR);
else
return (SPARKSHI_ERROR_NONE);
#else
UNREFERENCED_PARAMETER(dblThickness);
UNREFERENCED_PARAMETER(dblDistance1);
UNREFERENCED_PARAMETER(dblDistance2);
UNREFERENCED_PARAMETER(dblIntensity1);
UNREFERENCED_PARAMETER(dblIntensity2);
UNREFERENCED_PARAMETER(bSoftTrigger);
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::SetRefractiveIndex (double indice)
{
#ifndef _REMOVE_DLLCHR
if (MCHR_SetRefractiveIndex (m_SensorId, (float) indice) == MCHR_ERROR)
{
m_ErrorCode = MCHR_GetLastError (m_SensorId);
@@ -602,12 +651,17 @@ BOOL CSTIL_CCS_PRIMA_Laser::SetRefractiveIndex (double indice)
m_RefractiveIndex = (float) indice;
return (SPARKSHI_ERROR_NONE);
}
#else
UNREFERENCED_PARAMETER(indice);
return FALSE;
#endif
}
BOOL CSTIL_CCS_PRIMA_Laser::GetRefractiveIndex (double &indice)
{
#ifndef _REMOVE_DLLCHR
float convParam = (float) indice;
if (MCHR_GetRefractiveIndex (m_SensorId, &convParam) == MCHR_ERROR)
{
@@ -620,6 +674,9 @@ BOOL CSTIL_CCS_PRIMA_Laser::GetRefractiveIndex (double &indice)
indice = convParam;
return (SPARKSHI_ERROR_NONE);
}
#else
UNREFERENCED_PARAMETER(indice);
return FALSE;
#endif
}
#endif //_DEBUG