26/33
Sentech GigE Vision Camera StGigE SDK
Sample Guide Rev.1.00
2.3 Sets the IP Address
This sample shows how to set the IP Address, the subnet mask and the default gateway.
The default setting of the IP Address is sets automatically.
The certain IP Address, the subnet mask and the default gateway can sets for the default camera settings.
The following sample program shows how to save the current IP Address, the subnet mask and default gateway
to the camera.
BOOL SetDefaultIPAddress( PvDevice *lDevice )
{
PvGenParameterArray *lGenDevice = lDevice->GetGenParameters();
if( !lGenDevice ) return FALSE;
PvResult lResult;
//GevCurrentIPConfigurationPersistentIP
PvGenBoolean* PersistentIPBoolean=dynamic_cast<PvGenBoolean*>(lGenDevice->Get("GevCurrentIPConfigurationPersistentIP"));
if( !lPersistentIPBoolean ) return FALSE;
lResult = lPersistentIPBoolean->SetValue(true);
if( lResult.IsFailure() ) return FALSE;
//Read Infomation
PvInt64 lIPAddress = 0;
PvInt64 lSubnetMask = 0;
PvInt64 lGateway = 0;
PvGenInteger *lIPAddressParam = dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevCurrentIPAddress"));
if( !lPersistentIPBoolean ) return FALSE;
PvGenInteger *lSubnetMaskParam = dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevCurrentSubnetMask"));
if( !lSubnetMaskParam ) return FALSE;
PvGenInteger *lGatewayParam = dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevCurrentDefaultGateway"));
if( !lSubnetMaskParam ) return FALSE;
lResult = lIPAddressParam->GetValue( lIPAddress );
if( lResult.IsFailure() ) return FALSE;
lResult = lSubnetMaskParam->GetValue( lSubnetMask );
if( lResult.IsFailure() ) return FALSE;
lResult = lGatewayParam->GetValue( lGateway );
if( lResult.IsFailure() ) return FALSE
//Set Infomation
PvGenInteger *lFlushIPAddressParam=dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevPersistentIPAddress"));
if( !lFlushIPAddressParam ) return FALSE;
lResult = lFlushIPAddressParam->SetValue( lIPAddress );
if( lResult.IsFailure() ) return FALSE;
PvGenInteger *lFlushSubnetMaskParam=dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevPersistentSubnetMask"));
if( !lFlushSubnetMaskParam ) return FALSE;
lResult = lFlushSubnetMaskParam->SetValue( lSubnetMask );
if( lResult.IsFailure() ) return FALSE;
PvGenInteger *lFlushGatewayParam=dynamic_cast<PvGenInteger *>(lGenDevice->Get("GevPersistentDefaultGateway"));
if( !lFlushGatewayParam ) return FALSE;