Commit d94e552b authored by Yuelong Yu's avatar Yuelong Yu
Browse files

added timeout for GetImageData

parent a798a619
......@@ -328,8 +328,9 @@ namespace PcoNS
* @param image data
* @param image width
* @param image height
* @param timeout in milliseconds
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY) = 0;
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout) = 0;
};
}
\ No newline at end of file
......@@ -283,9 +283,9 @@ namespace PcoNS
return m_uptrPcoCamera->StopAcq();
}
int PcoCLHSImpl::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY)
int PcoCLHSImpl::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout)
{
return m_uptrPcoCamera->GetImageData(vImg,nX,nY);
return m_uptrPcoCamera->GetImageData(vImg,nX,nY, timeout);
}
}
......@@ -98,7 +98,7 @@ namespace PcoNS
int StopAcq();
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
private:
shared_ptr<CPco_com> m_sptrCamera;
......
......@@ -202,7 +202,7 @@ namespace PcoNS
return OK;
}
int PcoEdgeCLHS::GetImageData(vector<unsigned short>& vImg,int& /* nX */,int& /* nY */)
int PcoEdgeCLHS::GetImageData(vector<unsigned short>& vImg,int& /* nX */,int& /* nY */, int timeout)
{
//cout<<"getdata"<<endl;
......@@ -219,8 +219,7 @@ namespace PcoNS
if(shTrig1 == 0x0001)//software trigger
if(ForceTrigger(shTrig2) != OK)
return START_ERROR;
if(m_uptrGrabber->Wait_For_Next_Image(&m_vImg[0],10000) != OK)
if(m_uptrGrabber->Wait_For_Next_Image(&m_vImg[0],timeout) != OK)
{
return RECORD_ERROR;
}
......
......@@ -37,7 +37,7 @@ namespace PcoNS
int StartAcq(int nFrameNumbers);
int StopAcq();
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
private:
int PreAcq();
......
......@@ -352,7 +352,7 @@ namespace PcoNS
}
int PcoProduct::GetImageData(vector<unsigned short>& /* vImg */,
int& /* nX */,int& /* nY */)
int& /* nX */,int& /* nY */, int)
{
return DOES_NOT_SUPPORT;
}
......
......@@ -93,7 +93,7 @@ namespace PcoNS
virtual int StartAcq(int nFrameNumbers);
virtual int StopAcq();
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
virtual ~PcoProduct();
......
......@@ -251,7 +251,7 @@ namespace PcoNS
return OK;
}
int Pco4000::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY)
int Pco4000::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout)
{
int nPicNum = 1;
void* ptrAddr;
......@@ -265,8 +265,10 @@ namespace PcoNS
if(shTrig1 == 0x0001)//software trigger
if(ForceTrigger(shTrig2) != OK)
return START_ERROR;
if(m_sptrGrabber->Wait_For_Next_Image(&nPicNum,10) != OK)
timeout = timeout/1000; // ms->seconds
if(timeout == 0)
timeout = 1;
if(m_sptrGrabber->Wait_For_Next_Image(&nPicNum,timeout) != OK)
return RECORD_ERROR;
if(m_sptrGrabber->Check_DMA_Length(nPicNum) != OK)
......
......@@ -50,7 +50,7 @@ namespace PcoNS
int StartAcq(int nFrameNumbers);
int StopAcq() override;
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
private:
int PreAcq();
int ChangeTimeBaseToUS();
......
......@@ -267,7 +267,7 @@ namespace PcoNS
}
int PcoDimaxHS4::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY)
int PcoDimaxHS4::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout)
{
//cout<<"get image data"<<endl;
......
......@@ -36,7 +36,7 @@ namespace PcoNS
int SetRecorderMode(short shRecorderMode) override;
int StartAcq(int nFrameNumbers) override;
int StopAcq() override;
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY) override;
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY ,int timeout) override;
private:
int PreAcq() override;
......
......@@ -416,7 +416,7 @@ namespace PcoNS
return OK;
}
int PcoEdgeProduct::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY)
int PcoEdgeProduct::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout)
{
//cout<<__func__<<endl;
......@@ -434,7 +434,10 @@ namespace PcoNS
if(ForceTrigger(shTrig2) != OK)
return START_ERROR;
if(m_sptrGrabber->Wait_For_Next_Image(&nPicNum,10) != OK)
timeout = timeout/1000; // ms->seconds
if(timeout == 0)
timeout = 1;
if(m_sptrGrabber->Wait_For_Next_Image(&nPicNum,timeout) != OK)
return RECORD_ERROR;
if(m_sptrGrabber->Get_Framebuffer_adr(nPicNum,(void**)&ptrAddr) != OK)
return RECORD_ERROR;
......
......@@ -64,7 +64,7 @@ namespace PcoNS
int ForceTrigger(short& shTrigger);
int StartAcq(int nFrameNumbers);
int StopAcq();
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY,int timeout);
protected:
int GetTransferParameter(stTransferParams& stTP);
......
......@@ -313,9 +313,9 @@ namespace PcoNS
return m_uptrPcoCamera->StopAcq();
}
int PcoMe4Impl::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY)
int PcoMe4Impl::GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout)
{
return m_uptrPcoCamera->GetImageData(vImg,nX,nY);
return m_uptrPcoCamera->GetImageData(vImg,nX,nY, timeout);
}
}
......@@ -99,7 +99,7 @@ namespace PcoNS
int StartAcq(int nFrameNumbers);
int StopAcq();
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
private:
shared_ptr<CPco_com> m_sptrCamera;
......
......@@ -340,7 +340,7 @@ namespace PcoNS
}
int PcoProduct::GetImageData(vector<unsigned short>& /* vImg */,
int& /* nX */,int& /* nY */)
int& /* nX */,int& /* nY */, int)
{
return DOES_NOT_SUPPORT;
}
......
......@@ -97,7 +97,7 @@ namespace PcoNS
virtual int StartAcq(int nFrameNumbers);
virtual int StopAcq();
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
virtual ~PcoProduct();
......
......@@ -352,7 +352,7 @@ namespace PcoNS
}
int PcoProduct::GetImageData(vector<unsigned short>& /* vImg */,
int& /* nX */,int& /* nY */)
int& /* nX */,int& /* nY */, int)
{
return DOES_NOT_SUPPORT;
}
......
......@@ -93,7 +93,7 @@ namespace PcoNS
virtual int StartAcq(int nFrameNumbers);
virtual int StopAcq();
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY);
virtual int GetImageData(vector<unsigned short>& vImg,int& nX,int& nY, int timeout);
virtual ~PcoProduct();
......
......@@ -165,7 +165,7 @@ namespace PcoNS
return OK;
}
int PcoUSB::GetImageData(vector<unsigned short>& vImg,int& /* nX */,int& /* nY */)
int PcoUSB::GetImageData(vector<unsigned short>& vImg,int& /* nX */,int& /* nY */, int timeout)
{
//cout<<"getdata"<<endl;
......
Supports Markdown
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