Skip to main content
Open topic with navigation CAPL Functions » Ethernet » Function Overview » ethGetEthernetPortInfos

ethGetEthernetPortInfos

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

long ethGetEthernetPortInfos (ethernetportinfo portInfos[]);

Description

Retrieves port related information of all connected network-based Ethernet devices. You must provide an array of ethernetPortInfo elements of sufficient size for all available hardware ports.

Parameters

  • portInfos: Array of type <ethernetPortInfo>, which contains the retrieved hardware info as a struct with the following members:
    • char PortName[32]
    • char NetworkName[32]
    • char SegmentName[32]
    • uint32_t IsPhysical

Return Values

Number of valid ethernetPortInfo elements (0 in case of any error).

Example

on key 'C'  // retrieve complete hardware info
{
  ethernetportinfo  allPorts[128];
  long numPorts, j;
  numPorts = ethGetEthernetPortInfos(allPorts);
  write("Found hardware info of %d ports ", numPorts);
  for (j=0; j < numPorts; j++)
  {
    write("#%d %s::%s::%s isPhy:%d", j,
          allPorts[j].NetworkName,
          allPorts[j].SegmentName,
          allPorts[j].PortName,
          allPorts[j].IsPhysical);
  }
}