|
int nRet = 0;
char* ccdName={"CCDName"};
int nDeviceNum = -1;
unsigned int VersionSDK = MV_CC_GetSDKVersion();
MV_CC_DEVICE_INFO_LIST stDeviceList;
memset(&stDeviceList, 0, sizeof(MV_CC_DEVICE_INFO_LIST));
nRet = MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, &stDeviceList);
if (MV_OK != nRet)
{
printf("MV_CC_EnumDevices fail! nRet %x\n", nRet);
return nRet;
}
if (stDeviceList.nDeviceNum < 0)
{
return -1;
}
for (unsigned int i = 0; i < stDeviceList.nDeviceNum; i++)
{
if (stDeviceList.pDeviceInfo->nTLayerType == MV_GIGE_DEVICE)
{
if (strcmp((const char*)stDeviceList.pDeviceInfo->SpecialInfo.stGigEInfo.chUserDefinedName, ccdName)==0)
{
nDeviceNum = i;
printf("Gige_devicen_nDeviceNum %d\n", nDeviceNum);
}
}
else if (stDeviceList.pDeviceInfo->nTLayerType == MV_USB_DEVICE)
{
if (strcmp((const char*)stDeviceList.pDeviceInfo->SpecialInfo.stUsb3VInfo.chUserDefinedName, ccdName)==0)
{
nDeviceNum = i;
printf("USB_devicen_DeviceNum %d\n", nDeviceNum);
}
}
continue;
}
if (nDeviceNum < 0)
{
return -1;
}
nRet = MV_CC_CreateHandle(&handle, stDeviceList.pDeviceInfo[nDeviceNum]);
if (MV_OK != nRet)
{
printf("Camera;%s->MV_CC_CreateHandle fail! nRet %x\n", ccdName, nRet);
return nRet;
}
转换到e以后一直无法获取到nTLayerType的值与设备信息
|
|