|
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;
} 变量名 | 类 型 | 静态 | 数组 | 备 注 | DEVICE_INFO_LIST | MV_CC_DEVICE_INFO_LIST | | | pDeviceInfo | MV_CC_DEVICE_INFO | | | i | 整数型 | | | n | 整数型 | | | 句柄 | 整数型 | | | 调试输出 (“sdk”, 获取SDK版本号 ()) 如果 (枚举设备 (位或 ( #MV_USB_DEVICE, #MV_GIGE_DEVICE ), DEVICE_INFO_LIST ) = #MV_OK )变量循环首 (1, DEVICE_INFO_LIST.nDeviceNum, 1, i )pDeviceInfo = DEVICE_INFO_LIST.pDeviceInfo [i ]调试输出 (i, pDeviceInfo.nMajorVer, pDeviceInfo.nMinorVer, pDeviceInfo.nReserved, pDeviceInfo.nMacAddrLow, pDeviceInfo.nTLayerType, pDeviceInfo.nMacAddrHigh )调试输出 (pDeviceInfo.SpecialInfo.stUsb3VInfo.nbcdUSB, DEVICE_INFO_LIST.pDeviceInfo [i ].nTLayerType )变量循环尾 ()信息框 (“枚举设备失败”, 0, , ) nRet = MV_CC_OpenDevice(handle);
if (MV_OK != nRet)
{
printf("Camera;%s->MV_CC_OpenDevice fail! nRet %x\n",ccdName,nRet);
return nRet;
}
转换到e以后一直无法获取到nTLayerType的值与设备信息
|
|