Closed
Description
Related area
WIFI IPv6Address
Hardware specification
ESP32
Is your feature request related to a problem?
Feature request
Most OLED/LCD/TFT have small width, as IPv6 can be shorted/abreviated, so its usefull to display it short as possible.
Normal IPv6 Address:
fe80:0000:0000:0000:32ae:a4ff:fe02:e488
It can be short as:
fe80::32ae:a4ff:fe02:e488
Describe the solution you'd like
I have implemented it at IPv6Address.h/cpp but it is overrited every time i update sdk, so i will apreciate if this feature can be part of SDK.
Describe alternatives you've considered
I have change IPv6Address class, includding this function, that work as expected, im a beginner, so this function can be better writed.
String IPv6Address::toShortString() const {
unsigned short val;
std::stringstream stream;
bool skip;
for(int i = 0; i < 16; i+=2) {
val = ((_address.bytes[i] << 8) | _address.bytes[i+1]);
if ( val == 0 ) {
if ( ! skip ) {
skip = true;
stream << ":";
}
} else {
if ( skip ) skip = false;
stream << std::right << std::setfill('0') << std::setw(4) << std::hex << static_cast<int>(val);
if ( i < 14 ) stream << ":";
}
}
return String( stream.str().c_str() );
}
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
- I confirm I have checked existing list of Feature requests and Contribution Guide.
Metadata
Metadata
Assignees
Type
Projects
Status
Done