Skip to content

Commit

Permalink
Rename IPv6 getters to clarify that they are returning LinkLocal address
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Mar 20, 2024
1 parent bf97e36 commit 7afd573
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/en/api/wifi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ Function to get the IPv6 address.

.. code-block:: arduino
IPAddress softAPIPv6();
IPAddress softAPlinkLocalIPv6();
The function will return the AP IPv6 address in ``IPAddress`` format.

Expand Down
4 changes: 2 additions & 2 deletions libraries/Networking/src/ESP_Network_Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool ESP_Network_Interface::hasIP() const {
return (getStatusBits() & ESP_NETIF_HAS_IP_BIT) != 0;
}

bool ESP_Network_Interface::hasLocalIPv6() const {
bool ESP_Network_Interface::hasLinkLocalIPv6() const {
return (getStatusBits() & ESP_NETIF_HAS_LOCAL_IP6_BIT) != 0;
}

Expand Down Expand Up @@ -645,7 +645,7 @@ uint8_t ESP_Network_Interface::subnetCIDR() const
return calculateSubnetCIDR(IPAddress(ip.netmask.addr));
}

IPAddress ESP_Network_Interface::localIPv6() const
IPAddress ESP_Network_Interface::linkLocalIPv6() const
{
if(_esp_netif == NULL){
return IPAddress(IPv6);
Expand Down
4 changes: 2 additions & 2 deletions libraries/Networking/src/ESP_Network_Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ESP_Network_Interface: public Printable {
bool started() const;
bool connected() const;
bool hasIP() const;
bool hasLocalIPv6() const;
bool hasLinkLocalIPv6() const;
bool hasGlobalIPv6() const;
bool enableIPv6(bool en=true);

Expand All @@ -63,7 +63,7 @@ class ESP_Network_Interface: public Printable {
IPAddress broadcastIP() const;
IPAddress networkID() const;
uint8_t subnetCIDR() const;
IPAddress localIPv6() const;
IPAddress linkLocalIPv6() const;
IPAddress globalIPv6() const;

size_t printTo(Print & out) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void WiFiEvent(WiFiEvent_t event){
break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
Serial.print("STA IPv6: ");
Serial.println(WiFi.localIPv6());
Serial.println(WiFi.linkLocalIPv6());
break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
Serial.print("STA IPv4: ");
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ void WiFiEvent(WiFiEvent_t event){
break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
Serial.print("STA IPv6: ");
Serial.println(WiFi.localIPv6());
Serial.println(WiFi.linkLocalIPv6());
break;
case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
Serial.print("AP IPv6: ");
Serial.println(WiFi.softAPIPv6());
Serial.println(WiFi.softAPlinkLocalIPv6());
break;
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
wifiOnConnect();
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFi/src/WiFiAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ bool WiFiAPClass::softAPenableIPv6(bool enable)
* @return IPAddress softAP IPv6
*/

IPAddress WiFiAPClass::softAPIPv6()
IPAddress WiFiAPClass::softAPlinkLocalIPv6()
{
return AP.localIPv6();
return AP.linkLocalIPv6();
}

#endif /* SOC_WIFI_SUPPORTED */
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFiAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class WiFiAPClass
uint8_t softAPSubnetCIDR();

bool softAPenableIPv6(bool enable=true);
IPAddress softAPIPv6();
IPAddress softAPlinkLocalIPv6();

const char * softAPgetHostname();
bool softAPsetHostname(const char * hostname);
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFi/src/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@ bool WiFiSTAClass::enableIPv6(bool en)
* Get the station interface link-local IPv6 address.
* @return IPAddress
*/
IPAddress WiFiSTAClass::localIPv6()
IPAddress WiFiSTAClass::linkLocalIPv6()
{
return STA.localIPv6();
return STA.linkLocalIPv6();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFiSTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class WiFiSTAClass
uint8_t subnetCIDR();

bool enableIPv6(bool en=true);
IPAddress localIPv6();
IPAddress linkLocalIPv6();
IPAddress globalIPv6();

// ----------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 7afd573

Please sign in to comment.