Ethernet
Interface to get the MAC address of the first ethernet adapter.
File information
Logging
To enable logging for IEthernet, the flag LOG_ETHERNET must be set in the managers diagnostic settings.
Classes
IEthernet
class IEthernet {
public:
static bool GetMACAddress(byte * mac, class IInstanceLog * const log);
static bool GetIpAddress(char * buffer, size_t bufferLen, bool ipv6, class IInstanceLog * const log);
};
Public functions
GetMACAddress (static function)
-
The function writes the MAC address of the first ethernet adapter into the byte array of size MAC_ADDRESS_SIZE.
Parameters
byte * mac | A byte pointer to store the MAC address bytes. It needs to be of size MAC_ADDRESS_SIZE (6 bytes) |
IInstanceLog * log | An IInstanceLog pointer to the logging interface. |
byte mac[MAC_ADDRESS_SIZE];
IEthernet::GetMACAddress(mac, log);
GetMACAddress (static function)
-
The function writes the IP address of the first ethernet adapter into the char array of size IP_ADDRESS_SIZE.
Parameters
char * buffer | A byte pointer to store the IP address. It needs to be of size IP_ADDRESS_SIZE (46 bytes) |
size_t bufferLen | The length of the char pointer. |
bool ipv6 | If true, the IPv6 address is fetched. |
IInstanceLog * log | An IInstanceLog pointer to the logging interface. |
Data types
MAC_ADDRESS_SIZE
#define MAC_ADDRESS_SIZE 6
Overview
The #define MAC_ADDRESS_SIZE
is used to define the size of the byte * mac array.
IP_ADDRESS_SIZE
#define IP_ADDRESS_SIZE 46
Overview
The #define IP_ADDRESS_SIZE
is used to define the maximum length of the char array for an IP address.