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

ethGetPhyMedium

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

byte ethGetPhyMedium(ethernetPort port, EthernetPhyMedium& phyMedium);

Description

Gets the PHY medium. Only supported for network-based configurations and physical measurement ports.

Parameters

  • port: Ethernet port.
  • phyMedium:
    • 0: kEthernetPhyMediumUnknown
    • 1: kEthernetPhyMediumIEEE_802_3
    • 2: kEthernetPhyMedium100BASE_T1
    • 3: kEthernetPhyMedium1GB_COAX
    • 4: kEthernetPhyMedium1000BASE_T1
    • 5: kEthernetPhyMedium2500BASE_T1
    • 6: kEthernetPhyMedium5000BASE_T1
    • 7: kEthernetPhyMedium10000BASE_T1
    • 8: kEthernetPhyMedium10BASE_T1S

Return Values

  • 0: Failure
  • 1: Success

Example

void print()
{
  stack ethernetPort port = ethernetPort::Ethernet1::Port1;
  stack enum EthernetPhyMedium medium;

  if (ethGetPhyMedium(port, medium) != 0)
  {
    printMedium(medium);
  }
}

void printMedium(enum EthernetPhyMedium medium)
{
  char str[64];

  switch (medium)
  {
    case kEthernetPhyMediumUnknown:
      strncpy(str, "kEthernetPhyMediumUnknown", elcount(str));
      break;
    case kEthernetPhyMediumIEEE_802_3:
      strncpy(str, "kEthernetPhyMediumIEEE_802_3", elcount(str));
      break;
    case kEthernetPhyMediumBroadR_Reach:
      strncpy(str, "kEthernetPhyMediumBroadR_Reach", elcount(str));
      break;
    case kEthernetPhyMedium1GB_COAX:
      strncpy(str, "kEthernetPhyMedium1GB_COAX", elcount(str));
      break;
    case kEthernetPhyMedium1000BASE_T1:
      strncpy(str, "kEthernetPhyMedium1000BASE_T1", elcount(str));
      break;
    case kEthernetPhyMedium2500BASE_T1:
      strncpy(str, "kEthernetPhyMedium2500BASE_T1", elcount(str));
      break;
    case kEthernetPhyMedium5000BASE_T1:
      strncpy(str, "kEthernetPhyMedium5000BASE_T1", elcount(str));
      break;
    case kEthernetPhyMedium10000BASE_T1:
      strncpy(str, "kEthernetPhyMedium10000BASE_T1", elcount(str));
      break;
    case kEthernetPhyMedium10BASE_T1S:
      strncpy(str, "kEthernetPhyMedium10BASE_T1S", elcount(str));
      break;
    default:
      write("error");
      return;
  }

  write("medium: %s", str);
}