1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

LwipIntfDev - legacy Ethernet API methods moved to EthernetCompat (#9133)

This commit is contained in:
Juraj Andrássy 2024-06-15 21:06:29 +02:00 committed by GitHub
parent 338b62577e
commit f741521abc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 15 deletions

View File

@ -83,15 +83,11 @@ public:
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)));
@ -104,15 +100,11 @@ public:
{
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())
{
@ -123,10 +115,6 @@ public:
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

View File

@ -103,6 +103,21 @@ public:
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;
};