#ifdef _MSC_VER
# if _MSC_VER < 1300
# pragma warning( disable : 4786 )
# endif
#endif
#include <apps/Common/exampleHelper.h>
#include <iostream>
#include <mvIMPACT_CPP/mvIMPACT_acquire_GenICam.h>
#ifdef _WIN32
# include <process.h>
# include <mvDisplay/Include/mvIMPACT_acquire_display.h>
# define USE_DISPLAY
#endif
using namespace std;
static bool s_boTerminated = false;
struct ThreadParameter
{
#ifdef _WIN32
explicit ThreadParameter(
Device* p ) : pDev( p ), displayWindow(
"mvIMPACT_acquire sample, Device " + pDev->
serial.
read() ) {}
#else
explicit ThreadParameter(
Device* p ) : pDev( p ) {}
#endif
};
{
public:
virtual void execute(
Component& c,
void* pUserData )
{
try
{
{
}
}
{
cout <<
"An error occurred while retrieving the callback value. Error code: " << e.
getErrorCodeAsString() <<
")." << endl;
}
}
};
unsigned int __stdcall liveThread( void* pData )
{
ThreadParameter* pThreadParameter = reinterpret_cast<ThreadParameter*>( pData );
cout << "Initialising the device. This might take some time..." << endl;
try
{
pThreadParameter->pDev->interfaceLayout.write( dilGenICam );
pThreadParameter->pDev->open();
}
{
cout << "An error occurred while opening the device " << pThreadParameter->pDev->serial.read()
<< "Press [ENTER] to end the application..." << endl;
cin.get();
return 0;
}
try
{
}
{
cout << "An error occurred while setting up event control to the device " << pThreadParameter->pDev->serial.read()
}
ImageDisplay& display = pThreadParameter->displayWindow.GetImageDisplay();
while( ( result =
static_cast<TDMR_ERROR>( fi.imageRequestSingle() ) ) == DMR_NO_ERROR ) {};
if( result != DEV_NO_FREE_REQUEST_AVAILABLE )
{
cout << "'FunctionInterface.imageRequestSingle' returned with an unexpected result: " << result
}
manuallyStartAcquisitionIfNeeded( pThreadParameter->pDev, fi );
const unsigned int timeout_ms = 500;
EventCallback eventCallback( &ec );
while( !s_boTerminated )
{
int requestNr = fi.imageRequestWaitFor( timeout_ms );
pRequest = fi.isRequestNrValid( requestNr ) ? fi.getRequest( requestNr ) : 0;
if( pRequest )
{
{
}
else
{
}
if( pPreviousRequest )
{
}
pPreviousRequest = pRequest;
fi.imageRequestSingle();
}
}
manuallyStopAcquisitionIfNeeded( pThreadParameter->pDev, fi );
if( pRequest )
{
}
fi.imageRequestReset( 0, 0 );
return 0;
}
int main( void )
{
Device* pDev = getDeviceFromUserInput( devMgr );
if( !pDev )
{
cout << "Unable to continue! Press [ENTER] to end the application" << endl;
cin.get();
return 1;
}
cout << "Press [ENTER] to stop the acquisition thread" << endl << endl;
ThreadParameter threadParam( pDev );
#ifdef _WIN32
unsigned int dwThreadID;
HANDLE hThread = ( HANDLE )_beginthreadex( 0, 0, liveThread, ( LPVOID )( &threadParam ), 0, &dwThreadID );
cin.get();
s_boTerminated = true;
WaitForSingleObject( hThread, INFINITE );
CloseHandle( hThread );
#else
liveThread( &threadParam );
cin.get();
s_boTerminated = true;
#endif
return 0;
}
std::string name(void) const
Returns the name of the component referenced by this object.
Definition mvIMPACT_acquire.h:1206
A simple helper class to wrap the creation of a callback object.
Definition mvIMPACT_acquire.h:2101
A base class to implement access to internal driver components.
Definition mvIMPACT_acquire.h:1439
bool isProp(void) const
Checks if this component is of type mvIMPACT::acquire::Property or a derived type.
Definition mvIMPACT_acquire.h:1706
Grants access to devices that can be operated by this software interface.
Definition mvIMPACT_acquire.h:7171
This class and its functions represent an actual device detected by this interface in the current sys...
Definition mvIMPACT_acquire.h:6118
PropertyS serial
A string property (read-only) containing the serial number of this device.
Definition mvIMPACT_acquire.h:6551
The function interface to devices supported by this interface.
Definition mvIMPACT_acquire.h:10758
Category that contains Event control features.
Definition mvIMPACT_acquire_GenICam.h:5644
PropertyI64 eventExposureEndFrameID
An integer property. Returns the unique Identifier of the Frame (or image) that generated the Exposur...
Definition mvIMPACT_acquire_GenICam.h:7308
PropertyI64 eventNotification
An enumerated integer property. Activate or deactivate the notification to the host application of th...
Definition mvIMPACT_acquire_GenICam.h:6963
PropertyI64 eventSelector
An enumerated integer property. Selects which Event to signal to the host application.
Definition mvIMPACT_acquire_GenICam.h:6949
PropertyI64 eventExposureEndTimestamp
An integer property. Returns the Timestamp of the Exposure End Event.
Definition mvIMPACT_acquire_GenICam.h:7303
A base class for exceptions generated by Impact Acquire.
Definition mvIMPACT_acquire.h:256
std::string getErrorCodeAsString(void) const
Returns a string representation of the error associated with the exception.
Definition mvIMPACT_acquire.h:288
std::string read(int index=0) const
Reads a value from a property.
Definition mvIMPACT_acquire.h:5323
A base class for properties.
Definition mvIMPACT_acquire.h:3134
std::string readS(int index=0, const std::string &format="") const
Reads data from this property as a string.
Definition mvIMPACT_acquire.h:3340
const Property & writeS(const std::string &value, int index=0) const
Assigns a new value to this property.
Definition mvIMPACT_acquire.h:3550
Contains information about a captured buffer.
Definition mvIMPACT_acquire.h:8640
bool isOK(void) const
Convenience function to check if a request has been processed successfully.
Definition mvIMPACT_acquire.h:9474
PropertyIRequestResult requestResult
An enumerated integer property (read-only) defining the result of this request.
Definition mvIMPACT_acquire.h:9780
int unlock(void)
Unlocks the request for the driver again.
Definition mvIMPACT_acquire.h:9614
A class that can be used to display images in a window.
Definition mvIMPACT_acquire_display.h:606
A class that can be used for displaying images within existing windows or GUI elements that can provi...
Definition mvIMPACT_acquire_display.h:176
void RemoveImage(void)
Removes the current image from the display.
Definition mvIMPACT_acquire_display.h:395
void SetImage(const void *pData, int width, int height, int bitsPerPixel, int pitch)
Sets the next image to display.
Definition mvIMPACT_acquire_display.h:316
void Update(void) const
Immediately redraws the current image.
Definition mvIMPACT_acquire_display.h:405
TDMR_ERROR
Errors reported by the device manager.
Definition mvDriverBaseEnums.h:2601
@ DMR_NO_ERROR
The function call was executed successfully.
Definition mvDriverBaseEnums.h:2603
This namespace contains classes and functions belonging to the GenICam specific part of the image acq...
Definition mvIMPACT_acquire.h:23830
This namespace contains classes and functions that can be used to display images.
This namespace contains classes and functions belonging to the image acquisition module of this SDK.
Definition mvCommonDataTypes.h:34