Skip to content

Commit f233296

Browse files
committed
Ethernet - getter macAddress and dnsIP and settter setDNS
1 parent 3088294 commit f233296

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Ethernet.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ EthernetHardwareStatus UIPEthernetClass::hardwareStatus()
145145
return EthernetENC28J60;
146146
}
147147

148+
uint8_t* UIPEthernetClass::macAddress(uint8_t* mac)
149+
{
150+
memcpy(mac, uip_ethaddr.addr, 6);
151+
return mac;
152+
}
153+
148154
IPAddress UIPEthernetClass::localIP()
149155
{
150156
IPAddress ret;
@@ -174,6 +180,10 @@ IPAddress UIPEthernetClass::dnsServerIP()
174180
return _dnsServerAddress;
175181
}
176182

183+
IPAddress UIPEthernetClass::dnsIP(int n) {
184+
return (n == 0) ? _dnsServerAddress : IPAddress();
185+
}
186+
177187
void
178188
UIPEthernetClass::tick()
179189
{

src/Ethernet.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,17 @@ class UIPEthernetClass
9292

9393
EthernetLinkStatus linkStatus();
9494
EthernetHardwareStatus hardwareStatus();
95+
96+
uint8_t* macAddress(uint8_t* mac);
9597

9698
IPAddress localIP();
9799
IPAddress subnetMask();
98100
IPAddress gatewayIP();
99101
IPAddress dnsServerIP();
102+
IPAddress dnsIP(int n = 0);
100103

101104
void setDnsServerIP(const IPAddress dns_server) { _dnsServerAddress = dns_server; }
105+
void setDNS(IPAddress dns_server) { _dnsServerAddress = dns_server; }
102106

103107
private:
104108
static bool initialized;

0 commit comments

Comments
 (0)