Skip to content

Commit 7efe3ce

Browse files
authored
Update WiFiSTA.cpp
1 parent c5ef3eb commit 7efe3ce

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ bool WiFiSTAClass::enableIpV6()
733733
}
734734

735735
/**
736-
* Get the station interface IPv6 address.
736+
* Get the station interface local link IPv6 address.
737737
* @return IPv6Address
738738
*/
739739
IPv6Address WiFiSTAClass::localIPv6()
@@ -748,6 +748,22 @@ IPv6Address WiFiSTAClass::localIPv6()
748748
return IPv6Address(addr.addr);
749749
}
750750

751+
/**
752+
* Get the station interface local link IPv6 address.
753+
* @return IPv6Address
754+
*/
755+
IPv6Address WiFiSTAClass::globalIPv6()
756+
{
757+
esp_ip6_addr_t addr;
758+
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
759+
return IPv6Address();
760+
}
761+
if(esp_netif_get_ip6_global(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr)) {
762+
return IPv6Address();
763+
}
764+
return IPv6Address(addr.addr);
765+
}
766+
751767

752768
bool WiFiSTAClass::_smartConfigStarted = false;
753769
bool WiFiSTAClass::_smartConfigDone = false;

0 commit comments

Comments
 (0)