#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
{
int c;
while ( (c = getchar()) != '\n' && c != EOF );
fprintf( stderr, "\nPress enter to exit.\n");
while( getchar() != '\n');
sleep(1);
}
{
if (NULL == pstInterfaceInfo)
{
printf("The Pointer of pstInterfaceInfo is NULL!\n");
return false;
}
printf(
"model name: %s\n",pstInterfaceInfo->
chModelName);
printf("\n");
return true;
}
{
if (NULL == pstMVDevInfo)
{
printf("The Pointer of pstMVDevInfo is NULL!\n");
return false;
}
{
}
{
}
else
{
printf("Not support.\n");
}
return true;
}
{
while(true)
{
{
printf("Quick Software Trigger once failed! %#x\n", nRet);
}
else
{
printf("Quick Software Trigger once success!\n");
}
{
printf("Get Image Buffer: Width[%d], Height[%d], FrameNum[%d]\n",
{
printf("Free Image Buffer fail! nRet [0x%x]\n", nRet);
}
}
else
{
printf("Get Image fail! nRet [0x%x]\n", nRet);
}
{
break;
}
}
return 0;
}
{
void* hDevice = NULL;
do
{
{
printf("Initialize SDK fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Enum Interfaces fail! nRet [0x%x]\n", nRet);
break;
}
{
for (
unsigned int i = 0; i < stInterfaceInfoList.
nInterfaceNum; i++)
{
printf("[Interface %d]:\n", i);
if (NULL == pstInterfaceInfo)
{
break;
}
}
printf("Enum Interfaces success!\n\n");
}
else
{
printf("Find No Interface!\n");
break;
}
printf(
"Please Input Interfaces index(0-%d):", stInterfaceInfoList.
nInterfaceNum-1);
unsigned int nIndex = 0;
scanf("%d", &nIndex);
{
printf("Input error!\n");
break;
}
{
printf("Create Interface success!\n");
}
else
{
printf("Create Interface Handle fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Open Interface success!\n");
}
else
{
printf("Open Interface fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Set StreamTriggerSource fail! nRet [0x%x], maybe firmware not support Quick Software Trigger\n", nRet);
break;
}
else
{
printf("Set StreamTriggerSource = QuickSoftwareTrigger0 Success!\n");
}
{
printf("Set StreamTriggerActivation Fail! nRet [0x%x]\n", nRet);
break;
}
else
{
printf("Set StreamTriggerActivation = RisingEdge Success!\n");
}
{
printf("Enum Interfaces Devices fail! nRet [0x%x]\n", nRet);
break;
}
int nDeviceNum = 0;
{
for (
unsigned int i = 0; i < stDeviceList.
nDeviceNum; i++)
{
if (NULL == pDeviceInfo)
{
break;
}
{
{
printf("[device %d]:\n", nDeviceNum);
nDeviceIndex[nDeviceNum] = i;
nDeviceNum++;
}
}
else
{
{
printf("[device %d]:\n", nDeviceNum);
nDeviceIndex[nDeviceNum] = i;
nDeviceNum++;
}
}
}
}
else
{
printf("Find No Devices!\n");
break;
}
if (0 == nDeviceNum)
{
printf("Find No Devices!\n");
break;
}
printf("Please Input camera index(0-%d):", nDeviceNum - 1);
nIndex = 0;
scanf("%d", &nIndex);
if (nIndex >= nDeviceNum)
{
printf("Input error!\n");
break;
}
{
printf("Create Handle fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Open Device fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Set Trigger Mode fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Start Grabbing fail! nRet [0x%x]\n", nRet);
break;
}
pthread_t nThreadID;
nRet = pthread_create(&nThreadID, NULL ,
WorkThread , hDevice);
if (nRet != 0)
{
printf("thread create failed.ret = %d\n",nRet);
break;
}
printf("Press a key to stop grabbing.\n");
{
printf("Stop Grabbing fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("ClosDevice fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Destroy Handle fail! nRet [0x%x]\n", nRet);
break;
}
hDevice = NULL;
{
printf("Close Interface success!\n");
}
else
{
printf("Close Interface Handle fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Destroy Interface success!\n");
}
else
{
printf("Destroy Interface Handle fail! nRet [0x%x]\n", nRet);
break;
}
} while (0);
if (hDevice != NULL)
{
hDevice = NULL;
}
{
}
printf("Press a key to exit.\n");
return 0;
}