adds getMACAddress() like getIPAddress(). Initializes in constructor.
Dependencies: Socket lwip-eth lwip-sys lwip
Dependents: EtherTest2 SmartLight
Fork of EthernetInterface by
Diff: EthernetInterface.h
- Revision:
- 26:132037eec2ba
- Parent:
- 24:c9bb345dcc65
diff -r a0ee3ae75cfa -r 132037eec2ba EthernetInterface.h --- a/EthernetInterface.h Mon Aug 13 09:38:08 2012 +0000 +++ b/EthernetInterface.h Sat Sep 01 11:15:56 2012 +0000 @@ -16,7 +16,7 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - + #ifndef ETHERNETINTERFACE_H_ #define ETHERNETINTERFACE_H_ @@ -27,40 +27,49 @@ #include "rtos.h" #include "lwip/netif.h" - /** Interface using Ethernet to connect to an IP-based network - * - */ -class EthernetInterface { +/** Interface using Ethernet to connect to an IP-based network +* +*/ +class EthernetInterface +{ public: - /** Initialize the interface with DHCP. - * Initialize the interface and configure it to use DHCP (no connection at this point). - * \return 0 on success, a negative number on failure - */ - static int init(); //With DHCP + + /* + * Constructor + */ + EthernetInterface(); + + /** Initialize the interface with DHCP. + * Initialize the interface and configure it to use DHCP (no connection at this point). + * \return 0 on success, a negative number on failure + */ + static int init(); //With DHCP - /** Initialize the interface with a static IP address. - * Initialize the interface and configure it with the following static configuration (no connection at this point). - * \param ip the IP address to use - * \param mask the IP address mask - * \param gateway the gateway to use - * \return 0 on success, a negative number on failure - */ - static int init(const char* ip, const char* mask, const char* gateway); + /** Initialize the interface with a static IP address. + * Initialize the interface and configure it with the following static configuration (no connection at this point). + * \param ip the IP address to use + * \param mask the IP address mask + * \param gateway the gateway to use + * \return 0 on success, a negative number on failure + */ + static int init(const char* ip, const char* mask, const char* gateway); - /** Connect - * Bring the interface up, start DHCP if needed. - * \param timeout_ms timeout in ms (default: (12)s). - * \return 0 on success, a negative number on failure - */ - static int connect(unsigned int timeout_ms=12000); - - /** Disconnect - * Bring the interface down - * \return 0 on success, a negative number on failure - */ - static int disconnect(); - - static char* getIPAddress(); + /** Connect + * Bring the interface up, start DHCP if needed. + * \param timeout_ms timeout in ms (default: (12)s). + * \return 0 on success, a negative number on failure + */ + static int connect(unsigned int timeout_ms=12000); + + /** Disconnect + * Bring the interface down + * \return 0 on success, a negative number on failure + */ + static int disconnect(); + + static char* getIPAddress(); + + static char* getMACAddress(); }; #include "TCPSocketConnection.h"