#include <stdio.h>
#include <string.h>
#include "MvCameraControl.h"
void PressEnterToExit(void)
{
int c;
while ( (c = getchar()) != '\n' && c != EOF );
fprintf( stderr, "\nPress enter to exit.\n");
while( getchar() != '\n');
}
{
if (NULL == pstMVDevInfo)
{
printf("The Pointer of pstMVDevInfo is NULL!\n");
return false;
}
{
printf("CurrentIp: %d.%d.%d.%d\n" , nIp1, nIp2, nIp3, nIp4);
}
{
}
else
{
printf("Not support.\n");
}
return true;
}
int main()
{
void* handle = NULL;
do
{
if (MV_OK != nRet)
{
printf("MV_CC_EnumDevices fail! nRet [%x]\n", nRet);
break;
}
{
{
printf("[device %d]:\n", i);
if (NULL == pDeviceInfo)
{
break;
}
PrintDeviceInfo(pDeviceInfo);
}
}
else
{
printf("Find No Devices!\n");
break;
}
printf("Please Intput camera index: ");
unsigned int nIndex = 0;
scanf("%d", &nIndex);
{
printf("Intput error!\n");
break;
}
if (MV_OK != nRet)
{
printf("MV_CC_CreateHandle fail! nRet [%x]\n", nRet);
break;
}
if (MV_OK != nRet)
{
printf("MV_CC_OpenDevice fail! nRet [%x]\n", nRet);
break;
}
if (MV_OK == nRet)
{
printf(
"height current value:%d\n", stHeight.
nCurValue);
printf(
"height max value:%d\n", stHeight.
nMax);
printf(
"height min value:%d\n", stHeight.
nMin);
printf(
"height increment value:%d\n\n", stHeight.
nInc);
}
else
{
printf("get height failed! nRet [%x]\n\n", nRet);
}
unsigned int nHeightValue = 0;
printf("please input the height to set:");
scanf("%d", &nHeightValue);
if (MV_OK == nRet)
{
printf("set height OK!\n\n");
}
else
{
printf("set height failed! nRet [%x]\n\n", nRet);
}
if (MV_OK == nRet)
{
printf(
"exposure time current value:%f\n", stExposureTime.
fCurValue);
printf(
"exposure time max value:%f\n", stExposureTime.
fMax);
printf(
"exposure time min value:%f\n\n", stExposureTime.
fMin);
}
else
{
printf("get exposure time failed! nRet [%x]\n\n", nRet);
}
float fExposureTime = 0.0f;
printf("please input the exposure time to set: ");
scanf("%f", &fExposureTime);
if (MV_OK == nRet)
{
printf("set exposure time OK!\n\n");
}
else
{
printf("set exposure time failed! nRet [%x]\n\n", nRet);
}
if (MV_OK == nRet)
{
printf(
"TriggerMode current value:%d\n", stTriggerMode.
nCurValue);
printf(
"supported TriggerMode number:%d\n", stTriggerMode.
nSupportedNum);
{
printf(
"supported TriggerMode [%d]:%d\n", i, stTriggerMode.
nSupportValue[i]);
}
printf("\n");
}
else
{
printf("get TriggerMode failed! nRet [%x]\n\n", nRet);
}
unsigned int nTriggerMode = 0;
printf("please input the TriggerMode to set:");
scanf("%d", &nTriggerMode);
if (MV_OK == nRet)
{
printf("set TriggerMode OK!\n\n");
}
else
{
printf("set TriggerMode failed! nRet [%x]\n\n", nRet);
}
bool bGetBoolValue = false;
if (MV_OK == nRet)
{
if (0 != bGetBoolValue)
{
printf("ReverseX current is true\n\n");
}
else
{
printf("ReverseX current is false\n\n");
}
}
int nSetBoolValue;
bool bSetBoolValue;
printf("please input the ReverseX to set(bool): ");
scanf("%d", &nSetBoolValue);
if (0 != nSetBoolValue)
{
bSetBoolValue = true;
}
else
{
bSetBoolValue = false;
}
if (MV_OK == nRet)
{
printf("Set ReverseX OK!\n\n");
}
else
{
printf("Set ReverseX Failed! nRet = [%x]\n\n", nRet);
}
if (MV_OK == nRet)
{
printf(
"Get DeviceUserID [%s]\n\n", stStringValue.
chCurValue);
}
else
{
printf("Get DeviceUserID Failed! nRet = [%x]\n\n", nRet);
}
unsigned char strValue[256];
printf("please input the DeviceUserID to set(string):");
scanf("%s", strValue);
if (MV_OK == nRet)
{
printf("Set DeviceUserID OK!\n\n");
}
else
{
printf("Set DeviceUserID Failed! nRet = [%x]\n\n", nRet);
}
if (MV_OK != nRet)
{
printf("MV_CC_CloseDevice fail! nRet [%x]\n", nRet);
break;
}
if (MV_OK != nRet)
{
printf("MV_CC_DestroyHandle fail! nRet [%x]\n", nRet);
break;
}
} while (0);
if (nRet != MV_OK)
{
if (handle != NULL)
{
handle = NULL;
}
}
printf("exit\n");
return 0;
}