Unverified Commit 4f62e0a4 authored by Juraj Andrássy's avatar Juraj Andrássy Committed by GitHub

LwipIntfDev - added macAddress getter and DNS IP getter and setter (#1856)

and dnsIP(n) getter in WiFiClass too
parent dbab62c2
......@@ -326,6 +326,15 @@ IPAddress WiFiClass::gatewayIP() {
return _wifi.gatewayIP();
}
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress WiFiClass::dnsIP(uint8_t dns_no) {
return _wifi.dnsIP(dns_no);
}
/*
Return the current SSID associated with the network
......
......@@ -261,6 +261,13 @@ public:
*/
IPAddress gatewayIP();
/*
Get the DNS ip address.
return: IPAddress DNS Server IP
*/
IPAddress dnsIP(uint8_t dns_no = 0);
/*
Return the current SSID associated with the network
......
......@@ -73,6 +73,10 @@ public:
return &_netif;
}
uint8_t* macAddress(uint8_t* mac) {
memcpy(mac, &_netif.hwaddr, 6);
return mac;
}
IPAddress localIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.ip_addr)));
}
......@@ -82,6 +86,17 @@ public:
IPAddress gatewayIP() const {
return IPAddress(ip4_addr_get_u32(ip_2_ip4(&_netif.gw)));
}
IPAddress dnsIP(int n = 0) const {
return IPAddress(dns_getserver(n));
}
void setDNS(IPAddress dns1, IPAddress dns2 = INADDR_ANY) {
if (dns1.isSet()) {
dns_setserver(0, dns1);
}
if (dns2.isSet()) {
dns_setserver(1, dns2);
}
}
// 1. Currently when no default is set, esp8266-Arduino uses the first
// DHCP client interface receiving a valid address and gateway to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment