Please enable JavaScript to view this site.

IDS peak 2.10.0 / uEye+ firmware 3.34

IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.

In this example, the IP address and subnet mask of an unopened GigE camera are identified and changed.

With the comfortSDK, the camera remains closed and is addressed via the camera ID, that can be obtained from the camera descriptor.
The camera is automatically restarted, which invalidates the ID. The camera list must be updated via peak_CameraList_Update and you must search for the camera again.

With the genericSDK, you need the device descriptor (see Opening a camera (API)). This allows you to reconfigure a misconfigured camera so that the camera can be opened and operated again. m_deviceDescriptor is the device descriptor in the following examples.

Querying the IP address and subnet mask of the connected network adapter

comfortC

peak_status status = PEAK_STATUS_SUCCESS;
peak_ethernet_info ethInfo;
 
status = peak_EthernetConfig_GetInfo(camID, &ethInfo);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
 
// Pull host adapter IP address and subnet mask
peak_ip_address ipAddress = ethInfo.hostIP.address;
peak_ip_address subnetMask = ethInfo.hostIP.subnetMask;

genericC++

try
{
  int64_t ipAddress = 0;
  int64_t subnetMask = 0;
 
  // Get the NodeMap of the parent interface
  auto nodemap = m_deviceDescriptor->ParentInterface()->NodeMaps().at(0);
  if (nodemap)
  {
      ipAddress = nodemap->FindNode<peak::core::nodes::IntegerNode>("GevInterfaceSubnetIPAddress")->Value();
      subnetMask = nodemap->FindNode<peak::core::nodes::IntegerNode>("GevInterfaceSubnetMask")->Value();
  }
}
catch (const std::exception& e)
{
  // ...
}

Querying the current IP address and subnet mask

With the comfortSDK, this information can be read out easily.

Procedure for the genericSDK:

1.First determine the associated network adapter via the device descriptor: m_deviceDescriptor->ParentInterface()

2.Get the NodeMap of the network adapter. The network adapter has a selector that can be used to select all connected cameras.

3.Iterate over all entries of the selector.

4.Check the serial numbers of the selector entries until the desired camera is found.

5.Get the IP address and subnet mask of the selector entry. This corresponds to the IP address and subnet mask of the camera you are looking for.

Setting the temporary IP address and subnet mask

comfortSDK: Temporary setting is not necessary, as this is handled automatically within the comfortSDK.

genericSDK: If the camera is not on the same subnet as the network card, you will not be able to open the camera. In this case, you need to set a temporary IP address and subnet mask to open the camera. When the camera is open, you can change the persistent IP address.

genericC++

try
{
  int64_t ipAddress; // set correct value here
  int64_t subnetMask; // set correct value here
 
  // Get the NodeMap of the parent interface that contains all connected cameras
  auto nodemapInterface = m_deviceDescriptor->ParentInterface()->NodeMaps().at(0);
 
  // Get node to select the device
  auto nodeDeviceSelector = nodemapInterface->FindNode<peak::core::nodes::IntegerNode>("DeviceSelector");
 
  // Get node with the serial number
  auto nodeSerialNumber = nodemapInterface->FindNode<peak::core::nodes::StringNode>("DeviceSerialNumber");
 
  // Iterate through all selectors and find selected serial number
  for (int i = 0; i <= nodeDeviceSelector->Maximum(); i++)
  {
      nodeDeviceSelector->SetValue(i);
 
      // This is the correct camera
      if (nodeSerialNumber->Value() == m_deviceDescriptor->SerialNumber())
      {
          nodemapInterface->FindNode<peak::core::nodes::IntegerNode>("GevDeviceForceIPAddress")->SetValue(ipAddress);
          nodemapInterface->FindNode<peak::core::nodes::IntegerNode>("GevDeviceForceSubnetMask")->SetValue(subnetMask);
          nodemapInterface->FindNode<peak::core::nodes::CommandNode>("GevDeviceForceIP")->Execute();
           // Note: The "WaitUntilDone" function must not be used here, as the camera reconnects after setting the IP address.
          break;
      }
  }
}
catch (const std::exception& e)
{
  // ...
}

Setting a persistent IP address and subnet mask

Prerequisite comfortSDK: The camera is not open.
Note: The camera is automatically restarted, which invalidates the ID. The camera list must be updated via peak_CameraList_Update and you must search for the camera again.

comfortC

peak_ip_config newCameraIPConfig;
 
// IP address to be set
newCameraIPConfig.address.parts[0] = 192;
newCameraIPConfig.address.parts[1] = 168;
newCameraIPConfig.address.parts[2] = 10;
newCameraIPConfig.address.parts[3] = 42;
 
// Subnet mask to be set
newCameraIPConfig.subnetMask.parts[0] = 255;
newCameraIPConfig.subnetMask.parts[1] = 255;
newCameraIPConfig.subnetMask.parts[2] = 255;
newCameraIPConfig.subnetMask.parts[3] = 0;
 
// Set camera to use given persistent IP address and subnet mask
status = peak_EthernetConfig_PersistentIP_Set(camID, newCameraIPConfig);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
 
// Camera will now reboot with new IP settings. Camera ID is no longer valid!
// => Call peak_CameraList_Update, wait for camera to return and get new camID.

Prerequisite genericSDK: The camera is open.

genericC++

// Set IP address use to persistent
m_nodemapRemoteDevice->FindNode<peak::core::nodes::BooleanNode>("GevCurrentIPConfigurationPersistentIP")->SetValue(true);
 
// Set persistent IP address
m_nodemapRemoteDevice->FindNode<peak::core::nodes::IntegerNode>("GevPersistentIPAddress")->SetValue(ipAddress);
m_nodemapRemoteDevice->FindNode<peak::core::nodes::IntegerNode>("GevPersistentSubnetMask")->SetValue(subnetMask);

Activating DHCP

Prerequisite comfortSDK: The camera is not open.
Note: The camera is automatically restarted, which invalidates the ID. The camera list must be updated via peak_CameraList_Update and you must search for the camera again.

comfortC

// Set IP address to use DHCP
status = peak_EthernetConfig_DHCP_Enable(camID, PEAK_TRUE);
if (PEAK_ERROR(status)) { /* Error handling ... */ }
 
// Camera will now reboot with new IP settings. Camera ID is no longer valid!
// => Call peak_CameraList_Update, wait for camera to return and get new camID.

Prerequisite genericSDK: The camera is open.

genericC++

// Set IP address use to DHCP
m_nodemapRemoteDevice->FindNode<peak::core::nodes::BooleanNode>("GevCurrentIPConfigurationDHCP")->SetValue(true);

© 2024 IDS Imaging Development Systems GmbH