Camera IP address

When using GenApi.NMGetNode(..) , what is the correct string for the nodeName, so that the camera’s IP address could be queried ?

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

Hi @parsd

Thank you for the info, I can get the IP now.
Where would I be able to get a list of he strings which can be used for GenICam and Device TL ?

Thanks.

An easy way would be to use one of our camera configuration GUIs like the GenICam Browser which list all feature nodes (meaning the nodes intended to be used).

With the Stemmer.Cvb.dll you can query all features nodes like this:

var nodeMap = device.NodeMaps[NodeMapNames.Device];
nodeMap.Where(entry => entry.Value.IsFeature)
       .Select(entry => entry.Key);

Or with the old wrappers:

GenApi.NMNodeCount(nodeMap, out int nodeCount);
var featureNames = new List<string>();
for (int i = 0; i < nodeCount; i++)
{
  GenApi.NMListNode(nodeMap, i, out string nodeName);
  if (GenApi.NMGetNode(nodeMap, nodeName, out SharedNode node) >= 0)
  {
    GenApi.NInfoAsInteger(node, (GenApi.TNodeInfo)20, out long isFeature);
    if (isFeature != 0)
      featureNames.Add(nodeName);
				
    node.Dispose();
  }
}

Hi @pasrsd

Thank you for the information.