Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move recently added legacy Ethernet API methods from LwipIntfDev to EthernetCompat #9133

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions cores/esp8266/LwipIntfDev.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,11 @@ class LwipIntfDev: public LwipIntf, public RawDev
return &_netif;
}

uint8_t* macAddress(uint8_t* mac) // WiFi lib way
uint8_t* macAddress(uint8_t* mac)
{
memcpy(mac, &_netif.hwaddr, 6);
return mac;
}
void MACAddress(uint8_t* mac) // Ethernet lib way
{
macAddress(mac);
}
IPAddress localIP() const
{
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr)));
Expand All @@ -104,15 +100,11 @@ class LwipIntfDev: public LwipIntf, public RawDev
{
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw)));
}
IPAddress dnsIP(int n = 0) const // WiFi lib way
IPAddress dnsIP(int n = 0) const
{
return IPAddress(dns_getserver(n));
}
IPAddress dnsServerIP() const // Ethernet lib way
{
return dnsIP(0);
}
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY) // WiFi lib way
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY)
{
if (dns1.isSet())
{
Expand All @@ -123,10 +115,6 @@ class LwipIntfDev: public LwipIntf, public RawDev
dns_setserver(1, dns2);
}
}
void setDnsServerIP(const IPAddress dnsIP) // Ethernet lib way
{
setDNS(dnsIP);
}

// 1. Currently when no default is set, esp8266-Arduino uses the first
// DHCP client interface receiving a valid address and gateway to
Expand Down
15 changes: 15 additions & 0 deletions libraries/lwIP_Ethernet/src/EthernetCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ class ArduinoEthernet: public LwipIntfDev<RawDev>
return DHCP_CHECK_NONE;
}

void MACAddress(uint8_t* mac)
{
LwipIntfDev<RawDev>::macAddress(mac);
}

IPAddress dnsServerIP() const
{
return LwipIntfDev<RawDev>::dnsIP(0);
}

void setDnsServerIP(const IPAddress dnsIP)
{
LwipIntfDev<RawDev>::setDNS(dnsIP);
}

protected:
HardwareStatus _hardwareStatus;
};
Expand Down