This commit is contained in:
2025-08-29 19:17:09 +02:00
parent d630a7ea5f
commit 8a76e869cb
10 changed files with 70 additions and 44 deletions

View File

@@ -38,6 +38,17 @@ std::string Network::getHostname() const {
return WiFi.getHostname();
}
const std::string Network::getMacAddress() const {
std::string mac = WiFi.macAddress().c_str(); // format: "AA:BB:CC:DD:EE:FF"
std::string hexMac = "0x";
for (size_t i = 0; i < mac.size(); ++i) {
if (mac[i] != ':') {
hexMac += mac[i];
}
}
return hexMac;
}
bool Network::setHostname(const std::string_view &hostname) {
this->hostname = std::string(hostname);
return WiFi.setHostname(this->hostname.c_str());