Machine Vision Camera SDK (C) Developer Guide
return;
}
//Select the first found online device and create device handle
int nDeviceIndex = 0;
MV_CC_DEVICE_INFO m_stDevInfo = {0};
memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex],
sizeof(MV_CC_DEVICE_INFO));
nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);
if (MV_OK != nRet)
{
printf("error: CreateHandle fail [%x]\n", nRet);
return;
}
//Connect device
nRet = MV_CC_OpenDevice(m_handle, nAccessMode, nSwitchoverKey);
if (MV_OK != nRet)
{
printf("error: OpenDevice fail [%x]\n", nRet);
return;
}
//...other processing
//Start acquiring image
nRet = MV_CC_StartGrabbing(m_handle);
if (MV_OK != nRet)
{
printf("error: StartGrabbing fail [%x]\n", nRet);
return;
}
//Get the size of one frame data
MVCC_INTVALUE stIntvalue = {0};
nRet = MV_CC_GetIntValue(m_handle, "PayloadSize", &stIntvalue);
if (nRet != MV_OK)
{
printf("Get PayloadSize failed! nRet [%x]\n", nRet);
return;
}
int nBufSize = stIntvalue.nCurValue + 2048; //One frame data size +
reserved bytes (for SDK internal processing)
unsigned int nTestFrameSize = 0;
unsigned char* g_pFrameBuf = NULL;
g_pFrameBuf = (unsigned char*)malloc(MAX_BUF_SIZE);
MV_FRAME_OUT_INFO_EX stInfo;
memset(&stInfo, 0, sizeof(MV_FRAME_OUT_INFO_EX));
166
    "