24/33
Sentech GigE Vision Camera StGigE SDK
Sample Guide Rev.1.00
2.2 Obtain the NIC and the camera information
This sample shows how to obtain the NIC and the camera information without the PvDeviceFinderWnd class
The most of the sample program use the PvDeviceFinderWnd class to selects and connects the camera.
The following code of the program can selects and connects the camera without the PvDeviceFinderWnd dialog.
Also, please check the PvDeviceFindingSample sample.
// Displays the MAC Address, IP Address and Subnet Mask information for each NIC and each camera.
BOOL PrintNICandDeviceInformation(void)
{
PvSystem lSystem;
PvResult lResult;
PvDeviceInfo *lDeviceInfo = 0;
lSystem.SetDetectionTimeout( 2000 );
lResult= lSystem.Find();
if( !lResult.IsOK() )
{
printf( "PvSystem::Find Error: %s\n", lResult.GetCodeString() );
}else{
PvUInt32 lInterfaceCount = lSystem.GetInterfaceCount();
for( PvUInt32 x = 0; x < lInterfaceCount; x++ )
{
// get pointer to each of interface
PvInterface * lInterface = lSystem.GetInterface( x );
printf( "Interface %i MAC Address: %s IP Address: %s Subnet Mask: %s\n",
x,
lInterface->GetMACAddress().GetUnicode(),
lInterface->GetIPAddress().GetUnicode(),
lInterface->GetSubnetMask().GetUnicode() );
// Get the number of GEV devices that were found using GetDeviceCount.
PvUInt32 lDeviceCount = lInterface->GetDeviceCount();
for( PvUInt32 y = 0; y < lDeviceCount ; y++ )
{
lDeviceInfo = lInterface->GetDeviceInfo( y );
printf( "Device %i MAC Address: %s IP Address: %s \n",
y,
lDeviceInfo->GetMACAddress().GetUnicode(),
lDeviceInfo->GetIPAddress().GetUnicode()
);
}
}
}
return (BOOL)lResult.IsOK();
}
//IP Address, Subnet Mask and Default gateway can be changeable with the MAC Address information before