Added toString() for esp_ip_addr_t
This commit is contained in:
@@ -235,4 +235,16 @@ std::string toString(ip_addr_t val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string toString(const esp_ip_addr_t &val)
|
||||||
|
{
|
||||||
|
switch (val.type)
|
||||||
|
{
|
||||||
|
case IPADDR_TYPE_V4: return toString(val.u_addr.ip4);
|
||||||
|
case IPADDR_TYPE_V6: return toString(val.u_addr.ip6);
|
||||||
|
default:
|
||||||
|
ESP_LOGW(TAG, "Unknown ipv%hhu", val.type);
|
||||||
|
return fmt::format("Unknown ipv{}", val.type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace wifi_stack
|
} // namespace wifi_stack
|
||||||
|
@@ -106,5 +106,6 @@ inline std::string toString(const esp_ip4_addr_t &val)
|
|||||||
{ return toString(*reinterpret_cast<const ip4_addr_t *>(&val)); }
|
{ return toString(*reinterpret_cast<const ip4_addr_t *>(&val)); }
|
||||||
inline std::string toString(const esp_ip6_addr_t &val)
|
inline std::string toString(const esp_ip6_addr_t &val)
|
||||||
{ return toString(*reinterpret_cast<const ip6_addr_t *>(&val)); }
|
{ return toString(*reinterpret_cast<const ip6_addr_t *>(&val)); }
|
||||||
|
std::string toString(const esp_ip_addr_t &val);
|
||||||
|
|
||||||
} // namespace wifi_stack
|
} // namespace wifi_stack
|
||||||
|
Reference in New Issue
Block a user