WIZNet W5500 with additional enhancements

Fork of WIZnetInterface by WIZnet

Revision:
36:0ba2e8d5274a
Parent:
35:fe3028eda085
Child:
38:67e763cdde02
--- a/EthernetInterface.cpp	Tue Oct 10 20:56:13 2017 +0200
+++ b/EthernetInterface.cpp	Wed Oct 11 11:18:41 2017 +0200
@@ -26,6 +26,7 @@
     ip_set = false;
     domainName = NULL;
     leaseStart = 0;
+    _hostname = NULL;
 }
 
 EthernetInterface::EthernetInterface(SPI* spi, PinName cs, PinName reset) :
@@ -34,6 +35,7 @@
     ip_set = false;
     domainName = NULL;
     leaseStart = 0;
+    _hostname = NULL;
 }
 #endif
 
@@ -85,8 +87,10 @@
 }
 
 // Connect Bring the interface up, start DHCP if needed.
-int EthernetInterface::connect()
+int EthernetInterface::connect(const char *hostname)
 {
+    if (hostname)
+        _hostname = hostname;
     if (dhcp) {
         int r = IPrenew();
         if (r < 0) {
@@ -164,7 +168,7 @@
 int EthernetInterface::IPrenew(int timeout_ms)
 {
     DHCPClient dhcp;
-    int err = dhcp.setup(timeout_ms);
+    int err = dhcp.setup(_hostname, timeout_ms);
     if (err == (-1)) {
         return -1;
     }