WiFiSTA - method setDNS as in WiFi libraries by Arduino (#8854)
https://www.arduino.cc/reference/en/libraries/wifi/wifi.setdns/
This commit is contained in:
parent
0b6d20ed65
commit
fbfcb802b6
2 changed files with 14 additions and 0 deletions
|
|
@ -431,6 +431,19 @@ bool WiFiSTAClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subne
|
|||
return err == ESP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change DNS server for static IP configuration
|
||||
* @param dns1 Static DNS server 1
|
||||
* @param dns2 Static DNS server 2 (optional)
|
||||
*/
|
||||
bool WiFiSTAClass::setDNS(IPAddress dns1, IPAddress dns2)
|
||||
{
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL)
|
||||
return false;
|
||||
esp_err_t err = set_esp_interface_dns(ESP_IF_WIFI_STA, dns1, dns2);
|
||||
return err == ESP_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* is STA interface connected?
|
||||
* @return true if STA is connected to an AP
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public:
|
|||
wl_status_t begin();
|
||||
|
||||
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);
|
||||
bool setDNS(IPAddress dns1, IPAddress dns2 = (uint32_t)0x00000000); // sets DNS IP for all network interfaces
|
||||
|
||||
bool reconnect();
|
||||
bool disconnect(bool wifioff = false, bool eraseap = false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue