| | |
| | | |
| | | BOOL CSapLineGrab::CreateAcq(char *camFile) |
| | | { |
| | | if (SapManager::Open() == FALSE) |
| | | { |
| | | g_pLog->DisplayMessage(_T("Error: SapManager::Open.")); |
| | | if (SapManager::Open() == FALSE) { |
| | | //g_pLog->DisplayMessage(_T("Error: SapManager::Open.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | // Get actual server count and ensure m_nBoardID is within range |
| | | int nCount = SapManager::GetServerCount(SapManager::ResourceAcq); |
| | | if (m_nBoardID < 0 || m_nBoardID >= nCount) { |
| | | g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | //g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | SapLocation loc(serverName, 0); |
| | | nCount = SapManager::GetResourceCount(loc, SapManager::ResourceAcq); |
| | | if (nCount < 0) { |
| | | g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | //g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | |
| | | if (CreateAcq(m_Param.cDCFPath) == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEACQ; |
| | | g_pLog->DisplayMessage(_T("Error: CreateAcq fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: CreateAcq fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (CreateBuffer(0) == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEBUFFER; |
| | | g_pLog->DisplayMessage(_T("Error: CreateBuffer fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: CreateBuffer fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (ActivateObjects() == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEXFER; |
| | | g_pLog->DisplayMessage(_T("Error: ActivateObjects fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: ActivateObjects fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (m_pXfer->Connect() == FALSE) { |
| | | g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | |
| | | m_pFrameBuffer = new CFrameBufferController; |
| | | |
| | | if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount)) |
| | | { |
| | | g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount)) { |
| | | //g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | } |
| | | else |
| | | { |
| | | g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | else { |
| | | //g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | if (m_pSapAcq && !*m_pSapAcq) { |
| | | if (!m_pSapAcq->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | } |
| | |
| | | if (m_pSapBuffers && !*m_pSapBuffers) { |
| | | if (!m_pSapBuffers->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | m_pSapBuffers->Clear(); |
| | |
| | | m_pXfer->SetAutoEmpty(TRUE); |
| | | if (!m_pXfer->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | } |