Skip to content

Commit f741521

Browse files
authored
LwipIntfDev - legacy Ethernet API methods moved to EthernetCompat (esp8266#9133)
1 parent 338b625 commit f741521

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

cores/esp8266/LwipIntfDev.h

+3-15
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,11 @@ class LwipIntfDev: public LwipIntf, public RawDev
8383
return &_netif;
8484
}
8585

86-
uint8_t* macAddress(uint8_t* mac) // WiFi lib way
86+
uint8_t* macAddress(uint8_t* mac)
8787
{
8888
memcpy(mac, &_netif.hwaddr, 6);
8989
return mac;
9090
}
91-
void MACAddress(uint8_t* mac) // Ethernet lib way
92-
{
93-
macAddress(mac);
94-
}
9591
IPAddress localIP() const
9692
{
9793
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr)));
@@ -104,15 +100,11 @@ class LwipIntfDev: public LwipIntf, public RawDev
104100
{
105101
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw)));
106102
}
107-
IPAddress dnsIP(int n = 0) const // WiFi lib way
103+
IPAddress dnsIP(int n = 0) const
108104
{
109105
return IPAddress(dns_getserver(n));
110106
}
111-
IPAddress dnsServerIP() const // Ethernet lib way
112-
{
113-
return dnsIP(0);
114-
}
115-
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY) // WiFi lib way
107+
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY)
116108
{
117109
if (dns1.isSet())
118110
{
@@ -123,10 +115,6 @@ class LwipIntfDev: public LwipIntf, public RawDev
123115
dns_setserver(1, dns2);
124116
}
125117
}
126-
void setDnsServerIP(const IPAddress dnsIP) // Ethernet lib way
127-
{
128-
setDNS(dnsIP);
129-
}
130118

131119
// 1. Currently when no default is set, esp8266-Arduino uses the first
132120
// DHCP client interface receiving a valid address and gateway to

libraries/lwIP_Ethernet/src/EthernetCompat.h

+15
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ class ArduinoEthernet: public LwipIntfDev<RawDev>
103103
return DHCP_CHECK_NONE;
104104
}
105105

106+
void MACAddress(uint8_t* mac)
107+
{
108+
LwipIntfDev<RawDev>::macAddress(mac);
109+
}
110+
111+
IPAddress dnsServerIP() const
112+
{
113+
return LwipIntfDev<RawDev>::dnsIP(0);
114+
}
115+
116+
void setDnsServerIP(const IPAddress dnsIP)
117+
{
118+
LwipIntfDev<RawDev>::setDNS(dnsIP);
119+
}
120+
106121
protected:
107122
HardwareStatus _hardwareStatus;
108123
};

0 commit comments

Comments
 (0)