Commit b0c6bf31 authored by Roberto Arturo Homs-Regojo's avatar Roberto Arturo Homs-Regojo
Browse files

update with changes made in cmake-test (code & cmake)

parent a3538c9b
Pipeline #14390 passed with stages
in 15 minutes and 6 seconds
......@@ -114,7 +114,7 @@ Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
TabWidth: 4
UseTab: Never
...
......@@ -62,7 +62,7 @@ include(LimaTools)
include(project_version)
# Enable git hash in the version
option(WITH_GIT_VERSION "compile python binding code?" OFF)
option(WITH_GIT_VERSION "include the git commit hash" OFF)
# Enable python binding code compilation using sip generator
if (CAMERA_MASTER_PROJECT)
......@@ -143,7 +143,7 @@ target_link_libraries(pco PUBLIC limacore)
target_compile_definitions(pco PUBLIC ${PCO_DEFINITIONS})
message("PCO_INCLUDE_DIRS: ${PCO_INCLUDE_DIRS}")
message("... PCO_INCLUDE_DIRS: ${PCO_INCLUDE_DIRS}")
target_include_directories(pco
PUBLIC "$<BUILD_INTERFACE:${PCO_INCLUDE_DIRS}>"
......@@ -197,6 +197,8 @@ install(
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
message("... LIMA_ENABLE_PYTHON: [${LIMA_ENABLE_PYTHON}]")
message("... PYTHON_SITE_PACKAGES_DIR: [${PYTHON_SITE_PACKAGES_DIR}]")
if(LIMA_ENABLE_PYTHON)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/
......
......@@ -31,6 +31,9 @@ set(PCO_SDKLIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/sdkPcoLin" CACHE PATH "location
if(WIN32)
find_path(PCO_INCLUDE_DIRS "PcoSdkVersion.h" ${PCO_SDKWIN_DIR})
list(APPEND PCO_INCLUDE_DIRS
${PCO_INCLUDE_DIRS}/include
)
find_library(PCO_LIBRARIES NAMES SC2_Cam.lib HINTS ${PCO_SDKWIN_DIR}/lib64)
else()
set(PCO_SDK_LIB_DIR "${PCO_SDKLIN_DIR}/pco_common/pco_lib" CACHE PATH "location of pco sdklib-lin")
......@@ -74,10 +77,10 @@ list(APPEND PCO_INCLUDE_DIRS
endif()
message("PCO_LIBRARIES ============================================")
message("PCO_INCLUDE_DIRS: ${PCO_INCLUDE_DIRS}")
message("PCO_LIBRARIES: ${PCO_LIBRARIES}")
message("==========================================================")
message("PCO_INCLUDE_DIRS: [${PCO_INCLUDE_DIRS}]")
message("PCO_LIBRARIES: [${PCO_LIBRARIES}]")
message("PCO_DEFINITIONS: [${PCO_DEFINITIONS}]")
message("==========================================================")
include(FindPackageHandleStandardArgs)
......
#from Lima import Core
#from limapco import *
#from Lima import Core
from limapco import Pco as _P
globals().update(_P.__dict__)
......@@ -448,12 +448,12 @@ int BufferCtrlObj::_assignImage2Buffer(DWORD &dwFrameFirst, DWORD &dwFrameLast,
void *myPcoBufferPtr = m_allocBuff.pcoAllocBufferPtr[bufIdx];
#if 0
if(myPcoBufferLen != myPcoBufferLenReal)
{
DEB_ALWAYS() << "ERROR myPcoBufferLen != myPcoBufferLenReal "
<< DEB_VAR2(myPcoBufferLen, myPcoBufferLenReal);
return -1;
}
if (myPcoBufferLen != myPcoBufferLenReal)
{
DEB_ALWAYS() << "ERROR myPcoBufferLen != myPcoBufferLenReal "
<< DEB_VAR2(myPcoBufferLen, myPcoBufferLenReal);
return -1;
}
#endif
......@@ -627,7 +627,7 @@ int BufferCtrlObj::_xferImag_buff2lima(DWORD &dwFrameIdx, int &bufIdx)
memcpy(ptrDest, ptrSrc, size);
}
//----- the image dwFrameIdx is already in the buffer -> callback
//----- the image dwFrameIdx is already in the buffer -> callback
// newFrameReady
//----- lima frame (0 ... N-1) PCO frame (1 ... N)
HwFrameInfoType frame_info;
......@@ -724,11 +724,11 @@ int BufferCtrlObj::_xferImag()
m_pcoData->traceAcq.nrImgRequested = dwRequestedFrames;
# if 0
if(!m_cam->_isRunAfterAssign())
{
DEB_TRACE() << "========================= recordingState 1 - BEFORE ASSIGN";
m_cam->_pco_SetRecordingState(1, error);
}
if (!m_cam->_isRunAfterAssign())
{
DEB_TRACE() << "========================= recordingState 1 - BEFORE ASSIGN";
m_cam->_pco_SetRecordingState(1, error);
}
# endif
// cleaning the buffers
......@@ -836,8 +836,8 @@ int BufferCtrlObj::_xferImag()
}
// -----------------------------------------------------------------------------------------
// --------------- loop - process the N frames (dwFrameIdx <=
// dwRequestedFrames)
// loop - process the N frames
// (dwFrameIdx <= dwRequestedFrames)
// -----------------------------------------------------------------------------------------
bool bReadRAM = false;
......@@ -878,7 +878,7 @@ int BufferCtrlObj::_xferImag()
// -----------------------------------------------------------------------------------------
// ---------------------------------- find buffIdx associated with the
// next image dwFrameIdx
// next image dwFrameIdx PCO frame 1 ...
// -----------------------------------------------------------------------------------------
SHORT sBufNr;
DWORD dwBuffFrame;
......@@ -982,6 +982,14 @@ int BufferCtrlObj::_xferImag()
iLoopsPolled++;
} while (!(dwStatusDll & 0x00008000));
// 0x00008000 = Buffer event is set
// dwStatusDll DWORD *Pointer to a DWORD variable to get the status
// inside the SDK DLL :
// 0x80000000 = Buffer is allocated
// 0x40000000 = Buffer event created inside the SDK DLL
// 0x20000000 = Buffer is allocated externally
// 0x00008000 = Buffer event is set
if (dbgTraceFifo)
{
......@@ -1005,16 +1013,26 @@ int BufferCtrlObj::_xferImag()
dwStatusDrv, errPco, iLoopsPolled);
DEB_ALWAYS() << msg;
}
if (dwFrameIdx >= dwRequestedFrames)
{
int error;
// ------------- stop the recording and clear buffers
m_cam->_pco_SetRecordingState(0, error);
}
int xferRet = _xferImag_buff2lima(dwFrameIdx, bufIdx);
# if 0
// test code to stop the pco recording when the
// last image was acquired
// dwFrameIdx -> pco frame -> 1 ...
DWORD dwFrameIdx1 = dwFrameIdx + 1;
if ((dwFrameIdx) >= dwRequestedFrames)
{
int error;
// ------------- stop the recording and clear buffers
DEB_ALWAYS() << "\n ... _pco_SetRecordingState(0) when: "
<< DEB_VAR3(dwFrameIdx, dwFrameIdx1,
dwRequestedFrames);
m_cam->_pco_SetRecordingState(0, error);
}
# endif
int xferRet = _xferImag_buff2lima(dwFrameIdx, bufIdx);
if (dbgTraceFifo)
{
printf("---TRACE _xferImag_buff2lima sBufNr[%d] dwFrameIdx[%d]\n",
......@@ -1516,7 +1534,7 @@ int BufferCtrlObj::_xferImag_getImage()
switch (_stopReq)
{
// case stopProcessing:
// case stopProcessing:
case stopRequest:
_retStatus = pcoAcqTransferStop;
break;
......@@ -1753,7 +1771,7 @@ int BufferCtrlObj::_xferImag_getImage_edge()
switch (_stopReq)
{
// case stopProcessing:
// case stopProcessing:
case stopRequest:
_retStatus = pcoAcqTransferStop;
break;
......@@ -2013,10 +2031,10 @@ int BufferCtrlObj::_xferImagMult()
}
#if 0
DEB_TRACE()
<< "\n PCO_GetImageEx() ===>"
<< "\n " << DEB_VAR5( dwFrameIdx, dwFrameIdxFirst, dwFrameIdxLast, dwFramesPerBuffer, dwRequestedFrames)
<< "\n " << DEB_VAR5(wSegment, sBufNr, _wArmWidth, _wArmHeight, _wBitPerPixel);
DEB_TRACE()
<< "\n PCO_GetImageEx() ===>"
<< "\n " << DEB_VAR5(dwFrameIdx, dwFrameIdxFirst, dwFrameIdxLast, dwFramesPerBuffer, dwRequestedFrames)
<< "\n " << DEB_VAR5(wSegment, sBufNr, _wArmWidth, _wArmHeight, _wBitPerPixel);
#endif
usElapsedTimeSet(usStartPco);
......@@ -2098,7 +2116,7 @@ int BufferCtrlObj::_xferImagMult()
switch (_stopReq)
{
// case stopProcessing:
// case stopProcessing:
case stopRequest:
_retStatus = pcoAcqTransferStop;
break;
......@@ -2127,23 +2145,23 @@ void BufferCtrlObj::_pcoAllocBuffers(bool max)
# if 0
if(!m_allocBuff.createEventsDone){
for(bufIdx=0; bufIdx <m_cam->m_pco_buffer_nrevents; bufIdx++) {
// Create two event objects
m_allocBuff.bufferAllocEvent[bufIdx] = CreateEvent(
NULL, // default security attributes
true, // auto-reset event object = false / manual reset = true
false, // initial state is nonsignaled
NULL); // unnamed object
if (!m_allocBuff.bufferAllocEvent[bufIdx])
{
THROW_HW_ERROR(NotSupported) << "CreateEvent error";
}
}
m_allocBuff.createEventsDone = true;
}
if (!m_allocBuff.createEventsDone) {
for (bufIdx = 0; bufIdx < m_cam->m_pco_buffer_nrevents; bufIdx++) {
// Create two event objects
m_allocBuff.bufferAllocEvent[bufIdx] = CreateEvent(
NULL, // default security attributes
true, // auto-reset event object = false / manual reset = true
false, // initial state is nonsignaled
NULL); // unnamed object
if (!m_allocBuff.bufferAllocEvent[bufIdx])
{
THROW_HW_ERROR(NotSupported) << "CreateEvent error";
}
}
m_allocBuff.createEventsDone = true;
}
# endif
# ifdef USING_PCO_ALLOCATED_BUFFERS
......@@ -2228,28 +2246,28 @@ void BufferCtrlObj::_pcoAllocBuffers(bool max)
}
# if 0
//-------------- allocate 2 buffers (0,1) and received the handle, mem ptr, events
for(bufIdx = 0; bufIdx <m_cam->m_pco_buffer_nrevents ; bufIdx ++)
{
m_allocBuff.pcoAllocBufferNr[bufIdx] = -1;
m_cam->_pco_AllocateBuffer(
&m_allocBuff.pcoAllocBufferNr[bufIdx], \
_dwAllocatedBufferSize, \
&m_allocBuff.pcoAllocBufferPtr[bufIdx], \
&m_allocBuff.bufferAllocEvent[bufIdx], error);
// PRINT ERROR , error, "PCO_AllocateBuffer");
DEB_TRACE() << fnId << " " << DEB_VAR2(bufIdx, _dwAllocatedBufferSize);
if(error) {
int nrEvents =m_cam->m_pco_buffer_nrevents;
DEB_ALWAYS() << sErr << "\n"
<< DEB_VAR3(nrEvents, bufIdx,_dwAllocatedBufferSize);
THROW_HW_ERROR(NotSupported) << sErr;
}
m_allocBuff.dwPcoAllocBufferSize[bufIdx] = _dwAllocatedBufferSize;
}
//-------------- allocate 2 buffers (0,1) and received the handle, mem ptr, events
for (bufIdx = 0; bufIdx < m_cam->m_pco_buffer_nrevents; bufIdx++)
{
m_allocBuff.pcoAllocBufferNr[bufIdx] = -1;
m_cam->_pco_AllocateBuffer(
&m_allocBuff.pcoAllocBufferNr[bufIdx], \
_dwAllocatedBufferSize, \
& m_allocBuff.pcoAllocBufferPtr[bufIdx], \
& m_allocBuff.bufferAllocEvent[bufIdx], error);
// PRINT ERROR , error, "PCO_AllocateBuffer");
DEB_TRACE() << fnId << " " << DEB_VAR2(bufIdx, _dwAllocatedBufferSize);
if (error) {
int nrEvents = m_cam->m_pco_buffer_nrevents;
DEB_ALWAYS() << sErr << "\n"
<< DEB_VAR3(nrEvents, bufIdx, _dwAllocatedBufferSize);
THROW_HW_ERROR(NotSupported) << sErr;
}
m_allocBuff.dwPcoAllocBufferSize[bufIdx] = _dwAllocatedBufferSize;
}
# endif
m_pcoData->bAllocatedBufferDone = m_allocBuff.pcoAllocBufferDone = true;
......@@ -2317,29 +2335,29 @@ void BufferCtrlObj::_pcoAllocBuffersFree()
#if 0
# ifdef USING_PCO_ALLOCATED_BUFFERS
// free the pco allocated buffers
// free the pco allocated buffers
error = 0;
char *sErr;
char* sErr;
if (m_allocBuff.pcoAllocBufferDone) {
if(m_allocBuff.pcoAllocBufferDone){
//SC2_SDK_FUNC int WINAPI PCO_FreeBuffer(HANDLE ph, SHORT sBufNr)
//-------------- allocate 2 buffers (0,1) and received the handle, mem ptr, events
for(int bufIdx = 0; bufIdx <m_pco_buffer_nrevents ; bufIdx ++) {
m_cam->_pco_FreeBuffer(m_allocBuff.pcoAllocBufferNr[bufIdx], error);
if(error) {
DEB_TRACE() << sErr;
THROW_HW_ERROR(NotSupported) << sErr;
}
m_allocBuff.pcoAllocBufferNr[bufIdx]= -1;
m_allocBuff.dwPcoAllocBufferSize[bufIdx] = 0;
m_allocBuff.pcoAllocBufferPtr[bufIdx] = NULL;
}
m_allocBuff.pcoAllocBufferDone = false;
}
//SC2_SDK_FUNC int WINAPI PCO_FreeBuffer(HANDLE ph, SHORT sBufNr)
//-------------- allocate 2 buffers (0,1) and received the handle, mem ptr, events
for (int bufIdx = 0; bufIdx < m_pco_buffer_nrevents; bufIdx++) {
m_cam->_pco_FreeBuffer(m_allocBuff.pcoAllocBufferNr[bufIdx], error);
if (error) {
DEB_TRACE() << sErr;
THROW_HW_ERROR(NotSupported) << sErr;
}
m_allocBuff.pcoAllocBufferNr[bufIdx] = -1;
m_allocBuff.dwPcoAllocBufferSize[bufIdx] = 0;
m_allocBuff.pcoAllocBufferPtr[bufIdx] = NULL;
}
m_allocBuff.pcoAllocBufferDone = false;
}
# endif
#endif
}
......@@ -2406,21 +2424,21 @@ int BufferCtrlObj::_xferImagDoubleImage()
dwPcoFramesPerBuffer = m_cam->pcoGetFramesPerBuffer(); // for dimax = 1
DEB_TRACE()
<< "\n"
// << ">>> " << fnId << " (WaitForMultipleObjects) [
// ENTRY]:\n"
// << " " << DEB_VAR2(_iPcoAllocatedBuffNr,
//_dwPcoAllocatedBuffSize) << "\n"
// << " " << DEB_VAR2(_wArmWidth, _wArmHeight) << "\n"
// << " " << DEB_VAR1(roiNow) << "\n"
// << " " << DEB_VAR4(_wRoiWidth, _wRoiHeight,
//_uiBytesPerPixel, _wBitPerPixel) << "\n"
// << " " << DEB_VAR2( dwPcoFramesPerBuffer,
// dwFrameSize)
//<< "\n"
<< " "
<< DEB_VAR3(requested_nb_frames, dwPcoRequestedFrames, live_mode);
DEB_TRACE() << "\n"
// << ">>> " << fnId << " (WaitForMultipleObjects) [
// ENTRY]:\n"
// << " " << DEB_VAR2(_iPcoAllocatedBuffNr,
//_dwPcoAllocatedBuffSize) << "\n"
// << " " << DEB_VAR2(_wArmWidth, _wArmHeight) << "\n"
// << " " << DEB_VAR1(roiNow) << "\n"
// << " " << DEB_VAR4(_wRoiWidth, _wRoiHeight,
//_uiBytesPerPixel, _wBitPerPixel) << "\n"
// << " " << DEB_VAR2( dwPcoFramesPerBuffer,
// dwFrameSize)
//<< "\n"
<< " "
<< DEB_VAR3(requested_nb_frames, dwPcoRequestedFrames,
live_mode);
//----------------- traceAcq init
......@@ -3174,7 +3192,7 @@ int BufferCtrlObj::_xferImagMultDoubleImage()
switch (_stopReq)
{
// case stopProcessing:
// case stopProcessing:
case stopRequest:
_retStatus = pcoAcqTransferStop;
break;
......
......@@ -77,38 +77,37 @@ const char *_timestamp_pcocamera()
}
#ifdef WITH_GIT_VERSION
#include "PcoGitVersion.h"
# include "PcoGitVersion.h"
char * _timestamp_gitversion(char *buffVersion, int len)
char *_timestamp_gitversion(char *buffVersion, int len)
{
__sprintfSExt(buffVersion, len,
#ifdef PCO_GIT_VERSION
PCO_GIT_VERSION "\n"
#endif
#ifdef PCO_SDK_VERSION
PCO_SDK_VERSION "\n"
#endif
#ifdef PROCLIB_GIT_VERSION
PROCLIB_GIT_VERSION "\n"
#endif
#ifdef LIBCONFIG_GIT_VERSION
LIBCONFIG_GIT_VERSION "\n"
#endif
#ifdef LIMA_GIT_VERSION
LIMA_GIT_VERSION "\n"
#endif
#ifdef TANGO_GIT_VERSION
TANGO_GIT_VERSION "\n"
#endif
#ifdef SPEC_GIT_VERSION
SPEC_GIT_VERSION "\n"
#endif
"\n");
return buffVersion;
__sprintfSExt(buffVersion, len,
# ifdef PCO_GIT_VERSION
PCO_GIT_VERSION "\n"
# endif
# ifdef PCO_SDK_VERSION
PCO_SDK_VERSION "\n"
# endif
# ifdef PROCLIB_GIT_VERSION
PROCLIB_GIT_VERSION "\n"
# endif
# ifdef LIBCONFIG_GIT_VERSION
LIBCONFIG_GIT_VERSION "\n"
# endif
# ifdef LIMA_GIT_VERSION
LIMA_GIT_VERSION "\n"
# endif
# ifdef TANGO_GIT_VERSION
TANGO_GIT_VERSION "\n"
# endif
# ifdef SPEC_GIT_VERSION
SPEC_GIT_VERSION "\n"
# endif
"\n");
return buffVersion;
}
#endif
//=========================================================================================================
//=========================================================================================================
......@@ -1141,10 +1140,20 @@ void Camera::prepareAcq()
//==========================================================================================================
const char *sPcoAcqStatus[] = {
"pcoAcqIdle", "pcoAcqStart", "pcoAcqRecordStart",
"pcoAcqRecordEnd", "pcoAcqTransferStart", "pcoAcqTransferEnd",
"pcoAcqStop", "pcoAcqTransferStop", "pcoAcqRecordTimeout",
"pcoAcqWaitTimeout", "pcoAcqWaitError", "pcoAcqError",
"pcoAcqOK",
"pcoAcqIdle",
"pcoAcqStart",
"pcoAcqRecordStart",
"pcoAcqRecordEnd",
"pcoAcqRecordStop",
"pcoAcqRecordTimeout",
"pcoAcqTransferStart",
"pcoAcqTransferEnd",
"pcoAcqStop",
"pcoAcqTransferStop",
"pcoAcqWaitTimeout",
"pcoAcqWaitError",
"pcoAcqError",
"pcoAcqPcoError",
};
......
......@@ -351,7 +351,13 @@ const char *Camera::_pco_SetRecordingState(int state, int &err)
usElapsedTimeSet(usStart);
#endif
// if(wRecState_new == wRecState_actual) {error = 0; return fnId; }
if (wRecState_new == wRecState_actual)
{
DEB_TRACE() << " SetRecordingState - BYPASSED "
<< DEB_VAR2(wRecState_new, wRecState_actual);
err = 0;
return fnId;
}
// ------------------------------------------ cancel images
if (wRecState_new == 0)
......
......@@ -1075,8 +1075,6 @@ void Camera::getGeneralCAPS1(std::string &o_sn)
dwGeneralCaps1 = m_pcoData->stcPcoDescription.dwGeneralCaps1;
#endif
int nib[8];
int i, j;
......
......@@ -168,7 +168,7 @@ time_t getTimestamp()
//(..\..\..\..\src\PcoCamera.cpp) $
#define LEN_BUFF_DATE 128
#define LEN_BUFF_PATH PATH_MAX // 260 in win
#define LEN_BUFF_PATH PATH_MAX // 260 in win
#define TOKNR_DT 5
int __xlat_date(char *s1, char &ptrTo, int lenTo)
......@@ -2419,7 +2419,7 @@ void print_hex_dump_buff(void *ptr_buff, size_t len)
BYTE *ptr = (BYTE *)ptr_buff;
;
//printf("dump buff / len: %ld\n", len);
// printf("dump buff / len: %ld\n", len);
printf("dump buff / len: %zd\n", len);
while (len > 0)
......
......@@ -406,11 +406,11 @@ void _pco_acq_thread_dimax(void *argin)
m_sync->setStarted(false);
#if 0
if(requestStop == stopRequest)
{
Event *ev = new Event(Hardware,Event::Error,Event::Camera,Event::CamFault, errMsg);
m_cam->_getPcoHwEventCtrlObj()->reportEvent(ev);
}
if (requestStop == stopRequest)
{
Event* ev = new Event(Hardware, Event::Error, Event::Camera, Event::CamFault, errMsg);
m_cam->_getPcoHwEventCtrlObj()->reportEvent(ev);
}
#endif
......@@ -636,11 +636,11 @@ void _pco_acq_thread_dimax_trig_single(void *argin)
m_sync->setStarted(false);
#if 0
if(requestStop == stopRequest)
{
Event *ev = new Event(Hardware,Event::Error,Event::Camera,Event::CamFault, errMsg);
m_cam->_getPcoHwEventCtrlObj()->reportEvent(ev);
}
if (requestStop == stopRequest)
{
Event* ev = new Event(Hardware, Event::Error, Event::Camera, Event::CamFault, errMsg);
m_cam->_getPcoHwEventCtrlObj()->reportEvent(ev);
}
#endif
......@@ -689,6 +689,9 @@ void _pco_acq_thread_edge(void *argin)
m_sync->setExposing(status);
// m_sync->stopAcq();
printf("=== %s [%d]> _pco_SetRecordingState(0)\n", fnId, __LINE__);
const char *msg = m_cam->_pco_SetRecordingState(0, error);
if (error)
{
......@@ -726,15 +729,18 @@ void _pco_acq_thread_edge(void *argin)
case pcoAcqPcoError:
errMsg = "pcoAcqPcoError";
break;
default:
errMsg = NULL;
}
if (errMsg)
if (errMsg != NULL)
{
Event *ev = new Event(Hardware, Event::Error, Event::Camera,
Event::CamFault, errMsg);
m_cam->_getPcoHwEventCtrlObj()->reportEvent(ev);
}
printf("=== %s [%d]> TRACE %s\n", fnId, __LINE__, "exit thread");
_endthread();
}
......@@ -1066,19 +1072,19 @@ void Camera::startAcq()
_beginthread(_pco_acq_thread_edge, 0, (void *)this);
#if 0
AutoMutex lock(m_cond.mutex());
bool resWait;
int retry = 3;
int val, val0; val0 = pcoAcqRecordStart;
while( ((val = m_sync->getExposing()) != val0) && retry--)
{
DEB_TRACE() << "+++ getExposing / pcoAcqRecordStart - WAIT - " << DEB_VAR3(val, val0, retry);
resWait = m_cond.wait(2.);
}
DEB_TRACE() << "+++ getExposing / pcoAcqRecordStart - EXIT - " << DEB_VAR3(val, val0, retry);
lock.unlock();