//-----------------------------------------------------------------------------
#ifndef CaptureThreadH
#define CaptureThreadH CaptureThreadH
//-----------------------------------------------------------------------------
#include <mvIMPACT_CPP/mvIMPACT_acquire.h>
#include <wx/thread.h>
#include <wx/string.h>

class wxEvtHandler;
class wxWindow;

//------------------------------------------------------------------------------
class CaptureThread : public wxThread
//------------------------------------------------------------------------------
{
	static unsigned int						m_activeInstance;
	volatile bool							m_boLive;
	volatile bool							m_boRunning;
	mutable wxCriticalSection				m_critSect;
	mutable int								m_currentRequest;
	int										m_discardedImages;
	static unsigned int						m_instanceCnt;
	unsigned int							m_instanceNr;
	wxString								m_lastErrorMessage;
	mutable int								m_nextPendingRequest;
	int										m_parentWindowID;
	mvIMPACT::acquire::Device*				m_pDev;
	mvIMPACT::acquire::FunctionInterface*	m_pFuncInterface;	
	wxEvtHandler*							m_pParentWindowEventHandler;
	int										RequestImages( void );
	int										ExchangeLastSnapResult( int newResult ) const;
protected:
	void*									Entry( void );
public:
	CaptureThread( mvIMPACT::acquire::FunctionInterface* pFuncInterface, mvIMPACT::acquire::Device* pDev, wxWindow* pParentWindow );
	~CaptureThread();
	mvIMPACT::acquire::TRequestResult		GetImageData( mvIMPACT::acquire::ImageBufferDesc* pImgBufDesc, mvIMPACT::acquire::RequestInfo* pReqInfo, wxString& pixelFormat ) const;
	int										GetLastSnapResult( void ) const;
	int										SetLiveMode( bool boOn );
	bool 									GetLiveMode( void ) const { return m_boLive;}
	void									SetActive( void );
};

#endif // CaptureThreadH
