Skip to content

Commit e81ca46

Browse files
Ethernet lib: add disconnect fun
1 parent 24fdbf0 commit e81ca46

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

libraries/SocketWrapper/Ethernet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ EthernetHardwareStatus EthernetClass::hardwareStatus() {
6666
}
6767
}
6868

69+
int EthernetClass::disconnect() {
70+
return NetworkInterface::disconnect();
71+
}
72+
73+
void EthernetClass::end() {
74+
disconnect();
75+
}
76+
6977
void EthernetClass::setMACAddress(const uint8_t *mac_address) {
7078
if (mac_address != nullptr) {
7179
NetworkInterface::setMACAddress(mac_address);

libraries/SocketWrapper/Ethernet.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ class EthernetClass: public NetworkInterface
2121
EthernetClass() {}
2222
virtual ~EthernetClass() {}
2323

24-
int begin(uint8_t *mac = nullptr, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
24+
int begin(uint8_t *mac = nullptr, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
2525
int maintain();
2626
EthernetLinkStatus linkStatus();
2727
EthernetHardwareStatus hardwareStatus();
2828

29-
// Manual configuration
29+
// Manual configuration
3030
int begin(uint8_t *mac, IPAddress ip);
3131
int begin(uint8_t *mac, IPAddress ip, IPAddress dns);
3232
int begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway);
33-
int begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
34-
33+
int begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet, unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
34+
3535
void init(uint8_t sspin = 10);
3636

37-
void MACAddress(uint8_t *mac_address);
37+
int disconnect(void);
38+
void end(void);
39+
40+
void MACAddress(uint8_t *mac_address);
3841
IPAddress localIP();
3942
IPAddress subnetMask();
4043
IPAddress gatewayIP();
@@ -45,7 +48,7 @@ class EthernetClass: public NetworkInterface
4548
void setSubnetMask(const IPAddress subnet);
4649
void setGatewayIP(const IPAddress gateway);
4750
void setDnsServerIP(const IPAddress dns_server);
48-
51+
4952
void setRetransmissionTimeout(uint16_t milliseconds);
5053
void setRetransmissionCount(uint8_t num);
5154
};

0 commit comments

Comments
 (0)