Camera IP address

Hello @Farid

if the camera follows the GenICam Standard Features Naming Convention then the name would be:

Std::GevCurrentIPAddress

But this feature is optional. You can also query the Device TL nodemap for Cust::DeviceIP:

int result = Driver.INodeMapHandle2.GetNodeMap(cameraImage, "TLDevice", out SharedNodeMap deviceTLNodeMap);
if (result >= 0)
{
  result = GenApi.NMGetNode(deviceTLNodeMap, "DeviceIP", out SharedNode ipNode);
  if (result >= 0)
  {
    result = GenApi.NGetAsInteger(ipNode, out long ipValue);
    if (result >= 0)
      Console.WriteLine(IntToIPAddress((int)ipValue));

    ipNode.Dispose();
  }
  deviceTLNodeMap.Dispose();
}

with helper:

static IPAddress IntToIPAddress(int ipValue)
{
  var ipBytes = BitConverter.GetBytes(ip);
  if (BitConverter.IsLittleEndian)
    Array.Reverse(ipBytes);

  return new IPAddress(ipBytes);
}

… or with Stemmer.Cvb.dll:

Device device = ...; // see getting started to get such a device
var ipNode = device.NodeMaps[NodeMapNames.TLDevice]["DeviceIP"] as IntegerNode;
var ipAddress = IntToIPAddress((int)ipNode.Value);
1 Like