simplest_take.c

Go to the documentation of this file.
00001 
00023 #include "edtinc.h"
00024 
00025 /*
00026  * main
00027  */
00028 main(int argc, char **argv)
00029 {
00030     int     unit = 0, channel = 0;
00031     char    edt_devname[128];
00032     char    errstr[64];
00033     u_char *image_p;
00034     PdvDev *pdv_p;
00035     char osn[32];
00036 
00037     if (argc > 3)
00038     {
00039         printf("usage: %s -u [unit]\n", argv[0]);
00040         exit(1);
00041     }
00042 
00043     if ((argc > 1) && ((strcmp(argv[1], "-u") == 0)))
00044     {
00045         unit = atoi(argv[2]);
00046     }
00047 
00048     /*
00049      * open the interface
00050      * 
00051      * EDT_INTERFACE is defined in edtdef.h (included via edtinc.h).
00052      * With one EDT PCI DV board in the chassis it's uddressed as
00053      * unit 0; the first channel (bottom connector) on multi-channel
00054      * boards such as the PCI DV C-Link, is channel 0
00055      *
00056      */
00057     if ((pdv_p = pdv_open_channel(EDT_INTERFACE, unit, channel)) == NULL)
00058     {
00059         sprintf(errstr, "pdv_open_channel(%s%d_%d)", edt_devname, unit, channel);
00060         pdv_perror(errstr);
00061         return (1);
00062     }
00063 
00064     /*
00065      * acquire an image
00066      */
00067     image_p = pdv_image(pdv_p);
00068 
00069     /* 
00070      * optional (but recommended) -- check for timeouts (missing data)
00071      */
00072     if (pdv_timeouts(pdv_p) > 0)
00073         printf("got timeout, check camera and cables\n");
00074     else printf("got one image\n");
00075 
00076     /*
00077      * add your code to process the image (save, display, etc) here.
00078      * image_p points to the image data. Data format is determined by the
00079      * config file in use; use calls such as pdv_get_width, pdv_get_depth
00080      * to determine image characteristics.
00081      */
00082 
00083     pdv_close(pdv_p);
00084 
00085     exit(0);
00086 }
00087 
00088 

Generated on 19 Jun 2015 by  doxygen 1.4.7