Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Networking/Network.cpp')
-rw-r--r--src/Networking/Network.cpp60
1 files changed, 53 insertions, 7 deletions
diff --git a/src/Networking/Network.cpp b/src/Networking/Network.cpp
index f80f18bf..c8fd283a 100644
--- a/src/Networking/Network.cpp
+++ b/src/Networking/Network.cpp
@@ -21,29 +21,32 @@
#include "NetworkInterface.h"
#if HAS_LWIP_NETWORKING
-#include "LwipEthernet/LwipEthernetInterface.h"
+# include "LwipEthernet/LwipEthernetInterface.h"
#endif
#if HAS_W5500_NETWORKING
-#include "W5500Ethernet/W5500Interface.h"
+# include "W5500Ethernet/W5500Interface.h"
#endif
#if HAS_WIFI_NETWORKING
-#include "ESP8266WiFi/WiFiInterface.h"
+# include "ESP8266WiFi/WiFiInterface.h"
#endif
#if HAS_RTOSPLUSTCP_NETWORKING
-#include "RTOSPlusTCPEthernet/RTOSPlusTCPEthernetInterface.h"
+# include "RTOSPlusTCPEthernet/RTOSPlusTCPEthernetInterface.h"
#endif
#if SUPPORT_HTTP
-#include "HttpResponder.h"
+# include "HttpResponder.h"
#endif
#if SUPPORT_FTP
-#include "FtpResponder.h"
+# include "FtpResponder.h"
#endif
#if SUPPORT_TELNET
-#include "TelnetResponder.h"
+# include "TelnetResponder.h"
+#endif
+#if SUPPORT_MULTICAST_DISCOVERY
+# include "MulticastDiscovery/MulticastResponder.h"
#endif
#ifdef __LPC17xx__
@@ -250,6 +253,11 @@ GCodeResult Network::DisableProtocol(unsigned int interface, NetworkProtocol pro
break;
#endif
+#if SUPPORT_MULTICAST_DISCOVERY
+ case MulticastDiscoveryProtocol:
+ break;
+#endif
+
default:
break;
}
@@ -435,6 +443,10 @@ void Network::Activate() noexcept
}
# endif
+#if SUPPORT_MULTICAST_DISCOVERY
+ MulticastResponder::Init();
+#endif
+
// Finally, create the network task
networkTask.Create(NetworkLoop, "NETWORK", nullptr, TaskPriority::SpinPriority);
#endif
@@ -519,6 +531,9 @@ void Network::Spin() noexcept
if (nr == nullptr)
{
nr = responders; // 'responders' can't be null at this point
+#if SUPPORT_MULTICAST_DISCOVERY
+ MulticastResponder::Spin();
+#endif
}
doneSomething = nr->Spin();
nr = nr->GetNext();
@@ -572,6 +587,10 @@ void Network::Diagnostics(MessageType mtype) noexcept
iface->Diagnostics(mtype);
}
#endif
+
+#if SUPPORT_MULTICAST_DISCOVERY
+ MulticastResponder::Diagnostics(mtype);
+#endif
}
int Network::EnableState(unsigned int interface) const noexcept
@@ -607,6 +626,33 @@ IPAddress Network::GetIPAddress(unsigned int interface) const noexcept
IPAddress();
}
+IPAddress Network::GetNetmask(unsigned int interface) const noexcept
+{
+ return
+#if HAS_NETWORKING
+ (interface < NumNetworkInterfaces) ? interfaces[interface]->GetNetmask() :
+#endif
+ IPAddress();
+}
+
+IPAddress Network::GetGateway(unsigned int interface) const noexcept
+{
+ return
+#if HAS_NETWORKING
+ (interface < NumNetworkInterfaces) ? interfaces[interface]->GetGateway() :
+#endif
+ IPAddress();
+}
+
+bool Network::UsingDhcp(unsigned int interface) const noexcept
+{
+#if HAS_NETWORKING
+ return interface < NumNetworkInterfaces && interfaces[interface]->UsingDhcp();
+#else
+ return false;
+#endif
+}
+
void Network::SetHostname(const char *name) noexcept
{
#if HAS_NETWORKING