
Machine Vision Camera SDK (C) Developer Guide
unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
if (MV_OK != nRet)
{
printf("error: EnumDevices fail [%x]\n", nRet);
return;
}
int i = 0;
if (m_stDevList.nDeviceNum == 0)
{
printf("no camera found!\n");
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 to device
nRet = MV_CC_OpenDevice(m_handle, nAccessMode, nSwitchoverKey);
if (MV_OK != nRet)
{
printf("error: OpenDevice fail [%x]\n", nRet);
return;
}
//...other processing
//Starting 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)
162



































































































































































































































































































































































































