Machine Vision Camera SDK (C) Developer Guide
int nMillisec = 0;
bool bDevConnected = false;
do
{
//Whether the device is connected to
// Enumerate devices
MV_CC_DEVICE_INFO_LIST stDeviceList;
memset(&stDeviceList, 0, sizeof(MV_CC_DEVICE_INFO_LIST));
nRet = MV_CC_EnumDevices(MV_CAMERALINK_DEVICE, &stDeviceList);
if (MV_OK != nRet)
{
printf("Enum Devices fail! nRet [0x%x]\n", nRet);
break;
}
if (m_stDevList.nDeviceNum == 0)
{
printf("no camera found!\n");
return;
}
// Select a device and create a device handle
nRet = MV_CC_CreateHandle(&handle, stDeviceList.pDeviceInfo[0]);
if (MV_OK != nRet)
{
printf("Create Handle fail! nRet [0x%x]\n", nRet);
break;
}
// Set the waiting time of serial port operation
nRet = MV_CAML_SetGenCPTimeOut(handle, nMillisec);
if (MV_OK != nRet)
{
printf("Set Device Bauderate fail! nRet [0x%x]\n", nRet);
break;
}
// Open specified device
nRet = MV_CC_OpenDevice(handle);
if (MV_OK != nRet)
{
printf("Open Device fail! nRet [0x%x]\n", nRet);
break;
}
bDevConnected = true;
printf("Current device bauderate [0x%x]\n", nCurrentBaudrate);
// Shut down device
nRet = MV_CC_CloseDevice(handle);
if (MV_OK != nRet)
{
printf("ClosDevice fail! nRet [0x%x]\n", nRet);
break;
85
    "