[136] | 1 | /*
|
---|
| 2 | modified 12 Aug 2013
|
---|
| 3 | by Soohwan Kim (suhwan@wiznet.co.kr)
|
---|
| 4 |
|
---|
| 5 | - 10 Apr. 2015
|
---|
| 6 | Added support for Arduino Ethernet Shield 2
|
---|
| 7 | by Arduino.org team
|
---|
| 8 |
|
---|
| 9 | */
|
---|
| 10 | #ifndef ethernet_h
|
---|
| 11 | #define ethernet_h
|
---|
| 12 |
|
---|
| 13 | #include <inttypes.h>
|
---|
| 14 | #include "utility/w5500.h"
|
---|
| 15 | #include "IPAddress.h"
|
---|
| 16 | #include "EthernetClient.h"
|
---|
| 17 | #include "EthernetServer.h"
|
---|
| 18 | #include "Dhcp.h"
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | class EthernetClass {
|
---|
| 23 | private:
|
---|
| 24 | IPAddress _dnsServerAddress;
|
---|
| 25 | DhcpClass* _dhcp;
|
---|
| 26 | public:
|
---|
| 27 | static uint8_t _state[MAX_SOCK_NUM];
|
---|
| 28 | static uint16_t _server_port[MAX_SOCK_NUM];
|
---|
| 29 |
|
---|
| 30 | #if defined(WIZ550io_WITH_MACADDRESS)
|
---|
| 31 | // Initialize function when use the ioShield serise (included WIZ550io)
|
---|
| 32 | // WIZ550io has a MAC address which is written after reset.
|
---|
| 33 | // Default IP, Gateway and subnet address are also writen.
|
---|
| 34 | // so, It needs some initial time. please refer WIZ550io Datasheet in details.
|
---|
| 35 | int begin(void);
|
---|
| 36 | void begin(IPAddress local_ip);
|
---|
| 37 | void begin(IPAddress local_ip, IPAddress dns_server);
|
---|
| 38 | void begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
|
---|
| 39 | void begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
|
---|
| 40 | #else
|
---|
| 41 | // Initialize the Ethernet shield to use the provided MAC address and gain the rest of the
|
---|
| 42 | // configuration through DHCP.
|
---|
| 43 | // Returns 0 if the DHCP configuration failed, and 1 if it succeeded
|
---|
| 44 | int begin(uint8_t *mac_address);
|
---|
| 45 | void begin(uint8_t *mac_address, IPAddress local_ip);
|
---|
| 46 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server);
|
---|
| 47 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
|
---|
| 48 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
|
---|
| 49 |
|
---|
| 50 | #endif
|
---|
| 51 |
|
---|
| 52 | int maintain();
|
---|
| 53 |
|
---|
| 54 | IPAddress localIP();
|
---|
| 55 | IPAddress subnetMask();
|
---|
| 56 | IPAddress gatewayIP();
|
---|
| 57 | IPAddress dnsServerIP();
|
---|
| 58 |
|
---|
| 59 | friend class EthernetClient;
|
---|
| 60 | friend class EthernetServer;
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | extern EthernetClass Ethernet;
|
---|
| 64 |
|
---|
| 65 | #endif
|
---|