forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ESPEasy-Now] Improve p2p NodeStruct + extend for ESPEasy-Now
Also added the webserver port in PR letscontrolit#3053
- Loading branch information
Showing
13 changed files
with
164 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "NodeStruct.h" | ||
|
||
#include "../Globals/Settings.h" | ||
#include "../../ESPEasy-Globals.h" | ||
|
||
void NodeStruct::setLocalData() { | ||
WiFi.macAddress(mac); | ||
WiFi.softAPmacAddress(ap_mac); | ||
{ | ||
IPAddress localIP = WiFi.localIP(); | ||
for (byte i = 0; i < 4; ++i) { | ||
ip[i] = localIP[i]; | ||
} | ||
} | ||
|
||
unit = Settings.Unit; | ||
build = Settings.Build; | ||
memcpy(nodeName, Settings.Name, 25); | ||
nodeType = NODE_TYPE_ID; | ||
|
||
// webserverPort = Settings.WebserverPort; // PR #3053 | ||
} | ||
|
||
|
||
String NodeStruct::getNodeTypeDisplayString() const { | ||
switch (nodeType) | ||
{ | ||
case NODE_TYPE_ID_ESP_EASY_STD: return F("ESP Easy"); | ||
case NODE_TYPE_ID_ESP_EASYM_STD: return F("ESP Easy Mega"); | ||
case NODE_TYPE_ID_ESP_EASY32_STD: return F("ESP Easy 32"); | ||
case NODE_TYPE_ID_RPI_EASY_STD: return F("RPI Easy"); | ||
case NODE_TYPE_ID_ARDUINO_EASY_STD: return F("Arduino Easy"); | ||
case NODE_TYPE_ID_NANO_EASY_STD: return F("Nano Easy"); | ||
} | ||
return ""; | ||
} | ||
|
||
String NodeStruct::getNodeName() const { | ||
String res; | ||
size_t length = strnlen(reinterpret_cast<const char*>(nodeName), sizeof(nodeName)); | ||
res.reserve(length); | ||
for (size_t i = 0; i < length; ++i) { | ||
res += static_cast<char>(nodeName[i]); | ||
} | ||
return res; | ||
} | ||
|
||
IPAddress NodeStruct::IP() const { | ||
return IPAddress(ip[0], ip[1], ip[2], ip[3]); | ||
} |
Oops, something went wrong.