Download Frame Grabber Integration Programmer`s Manual
Transcript
APPENDIX C. INTERFACE TEMPLATE CIOFGTEMPLATE.C
74
/*
examples:
BoardInfo
HBOOL
INT
INT4_8
INT
*/
*board;
/*
/*
busy;
/*
/*
instance; /*
/*
/*
timeout;
/*
/*
currBuffer;/*
/*
#ifdef WIN32
struct _timeb
the 'physical' board this instance is
attached to
useful, if you plan to support asynchr.
grabbing (is the last grab still running?)
a useful backreference to the general HALCON
instance information: The instance index
(0 to FG_MAX_INST-1 )
useful for async grabbing: timeout threshold
for "images too old"
you probably use more than one buffer: Index
of the active buffer
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
grabStarted;/* just to check the timeout: the timestamp */
/* when the last grab was started
*/
#else
struct timeval grabStarted;/* the same for UNIX systems ...
*/
struct timezone tzp;
#endif
HBYTE
*InstFrameBuffer[MAX_BUFFERS]; /* buffers assigned to this
*/
/* instance
*/
HBOOL
allocBuffer; /* TRUE <=> buffers are allocated per instance, */
/* not only references to the buffers in "board"*/
HBOOL
volatileMode;/* TRUE <=> pass buffer memory directly to a
*/
/* HALCON image (possibly "overwriting" older
*/
/* images)
*/
} TFGInstance;
/**************************************************************************/
/***
We recommend that you leave these untouched:
***/
/**************************************************************************/
static FGClass
*fgClass; /* a pointer to the frame grabber class struct */
static TFGInstance FGInst[FG_MAX_INST];
static INT numInstance = 0;
/* all possible instances
/* # current instances
/* Some useful general-purpose buffers (e.g., for status messages):
static char errMsg[512];
/*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
======================================================================
HBOOL KillAllOtherJobs (...)
======================================================================
Terminates jobs (pending asynchronous grabs) started on the same
physical board (another board is no problem, since that usually has
its own memory).
Note that if the board has more than one A/D converter the other jobs
in general won't have to be killed.
This routine might be useful for FGOpen(); please see the FGopen()
routine prior to studying this one here ...
================================================================== */
static HBOOL KillAllOtherJobs(FGInstance *fginst)
{
TFGInstance *currInst = (TFGInstance *)fginst->gen_pointer;
INT
i;
HBOOL
killedSomebody=FALSE;
if (numInstance > 1)
{
for (i=0; i < FG_MAX_INST; i++)
{
if (FGInst[i].board && (currInst->instance != i))
Frame Grabber Integration / 2000-11-16
*/
*/
*/