#include <X11/Xlib.h>
#include <assert.h>
#include "math.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#define NIL (0)
{
int c;
while ( (c = getchar()) != '\n' && c != EOF );
fprintf( stderr, "\nPress enter to exit.\n");
while( getchar() != '\n');
sleep(1);
}
{
if (NULL == pstMVDevInfo)
{
printf("The Pointer of pstMVDevInfo is NULL!\n");
return false;
}
{
printf("CurrentIp: %d.%d.%d.%d\n" , nIp1, nIp2, nIp3, nIp4);
}
{
}
{
}
{
}
{
}
{
}
else
{
printf("Not support.\n");
}
return true;
}
{
while(1)
{
{
{
}
{
printf("Free Image Buffer fail! nRet [0x%x]\n", nRet);
}
}
else
{
printf("Get Image fail! nRet [0x%x]\n", nRet);
}
{
break;
}
}
return 0;
}
{
Display *dpy;
memset(&
g_hwnd, 0,
sizeof(Window));
dpy = NULL;
if (NULL == dpy)
{
printf("please run with screan environment\n");
return -1;
}
int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
g_hwnd = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
752, 480, 0, 0xffff00ff, 0xff00ffff);
XSelectInput(dpy,
g_hwnd, StructureNotifyMask);
XSetForeground(dpy, gc, whiteColor);
for(;;)
{
XEvent e;
XNextEvent(dpy, &e);
if (e.type == MapNotify)
{
break;
}
}
do
{
{
printf("Initialize SDK fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("MV_CC_EnumDevices fail! nRet [%x]\n", nRet);
break;
}
{
{
if (NULL == pDeviceInfo)
{
break;
}
printf("[device %d]:\n", i);
}
}
else
{
printf("Find No Devices!\n");
break;
}
printf("Please Intput camera index: ");
unsigned int nIndex = 0;
scanf("%d", &nIndex);
{
printf("Intput error!\n");
break;
}
{
printf("MV_CC_CreateHandle fail! nRet [%x]\n", nRet);
break;
}
{
printf("MV_CC_OpenDevice fail! nRet [%x]\n", nRet);
break;
}
{
if (nPacketSize > 0)
{
{
printf("Warning: Set Packet Size fail nRet [0x%x]!\n", nRet);
}
}
else
{
printf("Warning: Get Packet Size fail nRet [0x%x]!\n", nPacketSize);
}
}
{
printf("MV_CC_StartGrabbing fail! nRet [%x]\n", nRet);
break;
}
pthread_t nThreadID;
if (nRet != 0)
{
printf("thread create failed.ret = %d\n",nRet);
break;
}
{
printf("MV_CC_StopGrabbing fail! nRet [%x]\n", nRet);
break;
}
{
printf("MV_CC_CloseDevice fail! nRet [%x]\n", nRet);
break;
}
{
printf("MV_CC_DestroyHandle fail! nRet [%x]\n", nRet);
break;
}
}while (0);
{
}
printf("exit.\n");
return 0;
}