Commit 3e4bb324 authored by Rossa, Lutz's avatar Rossa, Lutz
Browse files

log camera start/stop, do not log binning nor file path

parent 3f2d3ee7
...@@ -368,7 +368,10 @@ int XenethCamera::Shutdown() ...@@ -368,7 +368,10 @@ int XenethCamera::Shutdown()
if (m_bInitialized) if (m_bInitialized)
{ {
if (XC_IsCapturing(m_hCamera)) if (XC_IsCapturing(m_hCamera))
XC_StopCapture(m_hCamera); {
int iResult(ConvertXenethResult(XC_StopCapture(m_hCamera)));
LOG(("XenethCamera::Shutdown(%p) stopped camera, iResult=%d\n", this, iResult));
}
XC_CloseCamera(m_hCamera); XC_CloseCamera(m_hCamera);
m_bInitialized = false; m_bInitialized = false;
} }
...@@ -665,9 +668,14 @@ unsigned XenethCamera::GetImageBytesPerPixel() const ...@@ -665,9 +668,14 @@ unsigned XenethCamera::GetImageBytesPerPixel() const
int XenethCamera::SnapImage() int XenethCamera::SnapImage()
{ {
static int g_iSnapCount(0); static int g_iSnapCount(0);
m_abyImage.resize(XC_GetFrameSize(m_hCamera), 0); if (g_iSnapCount < 1000)
LOG(("XenethCamera::SnapImage(%p) trigger\n", this));
m_abyImage.resize(XC_GetFrameSize(m_hCamera), 0);
if (!XC_IsCapturing(m_hCamera)) if (!XC_IsCapturing(m_hCamera))
XC_StartCapture(m_hCamera); {
int iResult(ConvertXenethResult(XC_StartCapture(m_hCamera)));
LOG(("XenethCamera::SnapImage(%p) started camera, iResult=%d\n", this, iResult));
}
int iResult(ConvertXenethResult(XC_GetFrame(m_hCamera, FT_NATIVE, XGF_Blocking, int iResult(ConvertXenethResult(XC_GetFrame(m_hCamera, FT_NATIVE, XGF_Blocking,
static_cast<void*>(m_abyImage.data()), static_cast<int>(m_abyImage.size())))); static_cast<void*>(m_abyImage.data()), static_cast<int>(m_abyImage.size()))));
if (g_iSnapCount < 1000) if (g_iSnapCount < 1000)
...@@ -683,7 +691,7 @@ int XenethCamera::SnapImage() ...@@ -683,7 +691,7 @@ int XenethCamera::SnapImage()
int XenethCamera::StartSequenceAcquisition(long numImages, double interval_ms, bool stopOnOverflow) int XenethCamera::StartSequenceAcquisition(long numImages, double interval_ms, bool stopOnOverflow)
{ {
int iResult(ConvertXenethResult(XC_StartCapture(m_hCamera))); int iResult(ConvertXenethResult(XC_StartCapture(m_hCamera)));
LOG(("XenethCamera::StartSequenceAcquisition(%p) iResult=%d\n", this, iResult)); LOG(("XenethCamera::StartSequenceAcquisition(%p) started camera, iResult=%d\n", this, iResult));
if (iResult != DEVICE_OK) if (iResult != DEVICE_OK)
return iResult; return iResult;
return CCameraBase::StartSequenceAcquisition(numImages, interval_ms, stopOnOverflow); return CCameraBase::StartSequenceAcquisition(numImages, interval_ms, stopOnOverflow);
...@@ -692,7 +700,7 @@ int XenethCamera::StartSequenceAcquisition(long numImages, double interval_ms, b ...@@ -692,7 +700,7 @@ int XenethCamera::StartSequenceAcquisition(long numImages, double interval_ms, b
int XenethCamera::StopSequenceAcquisition() int XenethCamera::StopSequenceAcquisition()
{ {
int iResult(ConvertXenethResult(XC_StopCapture(m_hCamera))); int iResult(ConvertXenethResult(XC_StopCapture(m_hCamera)));
LOG(("XenethCamera::StopSequenceAcquisition(%p) iResult=%d\n", this, iResult)); LOG(("XenethCamera::StopSequenceAcquisition(%p) stopped camera, iResult=%d\n", this, iResult));
if (iResult != DEVICE_OK) if (iResult != DEVICE_OK)
return iResult; return iResult;
return CCameraBase::StopSequenceAcquisition(); return CCameraBase::StopSequenceAcquisition();
...@@ -703,7 +711,10 @@ void XenethCamera::OnThreadExiting() throw() ...@@ -703,7 +711,10 @@ void XenethCamera::OnThreadExiting() throw()
bool bCapturing(XC_IsCapturing(m_hCamera) != 0); bool bCapturing(XC_IsCapturing(m_hCamera) != 0);
LOG(("XenethCamera::OnThreadExiting(%p) capturing=%d\n", this, bCapturing)); LOG(("XenethCamera::OnThreadExiting(%p) capturing=%d\n", this, bCapturing));
if (bCapturing) if (bCapturing)
XC_StopCapture(m_hCamera); {
int iResult(ConvertXenethResult(XC_StopCapture(m_hCamera)));
LOG(("XenethCamera::OnThreadExiting(%p) stopped camera, iResult=%d\n", this, iResult));
}
CCameraBase::OnThreadExiting(); CCameraBase::OnThreadExiting();
} }
...@@ -785,11 +796,9 @@ int XenethCamera::OnBinning(MM::PropertyBase* pProp, MM::ActionType eAct) ...@@ -785,11 +796,9 @@ int XenethCamera::OnBinning(MM::PropertyBase* pProp, MM::ActionType eAct)
{ {
if (eAct == MM::BeforeGet) if (eAct == MM::BeforeGet)
{ {
LOG(("XenethCamera::OnBinning(%p) GET\n", this));
pProp->Set(1L); pProp->Set(1L);
return DEVICE_OK; return DEVICE_OK;
} }
LOG(("XenethCamera::OnBinning(%p) failed\n", this));
return DEVICE_ERR; return DEVICE_ERR;
} }
...@@ -1034,7 +1043,17 @@ static void LogLine(const char* szFileInfo, std::string&& szLine) ...@@ -1034,7 +1043,17 @@ static void LogLine(const char* szFileInfo, std::string&& szLine)
szTmp.resize(strlen(szTmp.c_str())); szTmp.resize(strlen(szTmp.c_str()));
// file info // file info
if (!szFileInfo || !*szFileInfo) szFileInfo = "?"; if (!szFileInfo || !*szFileInfo)
szFileInfo = "?";
else
{
// keep file name only
for (const char* p(szFileInfo); *p != '\0'; ++p)
{
if ((p[0] == '/' || p[0] == '\\') && p[1])
szFileInfo = p + 1;
}
}
szTmp.append(szFileInfo); szTmp.append(szFileInfo);
// content // content
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment