EDT PDV SDK Documentation 6.2.0

Functions

int pdv_initcam (PdvDev pdv_p, PdvDependent dd_p, int unit, Edtinfo *ei_p, const char *cfgfname, char *bitdir, int pdv_debug)
 Initializes the frame grabber and sets the expected camera configuration. This is the "guts" of the initcam CLI application that gets executed to initialize when you choose a camera. The library subroutine is provided for programmers who wish to incorporate the initialization procedure into their own applications. More...
 
int pdv_readcfg (const char *cfgfile, PdvDependent dd_p, Edtinfo *ei_p)
 Reads configuration file and fills in the dependent and edtinfo structures based on the information in the file. These structures can then be passed in to pdv_initcam() to initialize the board and camera. More...
 
PdvDependent pdv_alloc_dependent (void)
 Allocates a PdvDependent structure, for use by pdv_readcfg and pdv_initcam, and checks for and reports error conditions as a result of the alloc. More...
 

Detailed Description

Read configuration files and initialize the board and camera. Typically the external utility program initcam handles these tasks (possibly invoked by an EDT application such as vlviewer or camconfig.) initcam calls these subroutines to do the work, and they are available as well for programmers who wish to invoke them directly from a user application. See the initcam.c source code for an example of how how to use these subroutines to read configration files and initialize the board from within an application.

Function Documentation

◆ pdv_initcam()

int pdv_initcam ( PdvDev  pdv_p,
PdvDependent  dd_p,
int  unit,
Edtinfo ei_p,
const char *  cfgfname,
char *  bitdir,
int  pdv_debug 
)

Initializes the frame grabber and sets the expected camera configuration. This is the "guts" of the initcam CLI application that gets executed to initialize when you choose a camera. The library subroutine is provided for programmers who wish to incorporate the initialization procedure into their own applications.

Warning
Unlike other PDV library calls, pdv_initcam() requires an EDT device pointer returned from edt_open() or edt_open_channel(). After initializing, close the device with edt_close() before reopening with pdv_open_channel() or pdv_open() for further use.
dd_p is used by the library until it is either freed by edt_close(), or no longer used by later calls to this function; this means that if you call pdv_initcam() again you should free() pdv_p->dd_p first to avoid memory leaks.

For a complete example of initializing

  • an EDT Simulator (CLS) board, see clsiminit CLI application.
  • an EDT frame grabber board, see initcam CLI application.
Note
The following is simplified example code. Normally, we would check the return values and handle error conditions.

Example

PdvDependent dd_p;
Edtinfo ei_p;
PdvDev edt_p;
int unit, channel;
char* unitstr = argv[1];
pdv_readcfg(cfgfname, dd_p, &edtinfo);
unit = edt_parse_unit_channel(unitstr, edt_devname, "pdv", &channel);
edt_p = edt_open_channel(edt_devname, unit, channel);
pdv_initcam(edt_p, dd_p, unit, &ei_p, cfgfname, bitdir, 0);
edt_close(edt_p);
free(dd_p);

◆ pdv_readcfg()

int pdv_readcfg ( const char *  cfgfile,
PdvDependent  dd_p,
Edtinfo ei_p 
)

Reads configuration file and fills in the dependent and edtinfo structures based on the information in the file. These structures can then be passed in to pdv_initcam() to initialize the board and camera.

See also
pdv_initcam() within pdv_initcam.c and pdv_initcam.h

◆ pdv_alloc_dependent()

PdvDependent pdv_alloc_dependent ( void  )

Allocates a PdvDependent structure, for use by pdv_readcfg and pdv_initcam, and checks for and reports error conditions as a result of the alloc.

The structure should be deallocated with free() later.

Returns
Pointer to a PdvDependent structure, or NULL if there was an error.
See also
pdv_initcam, pdv_readcfg