Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator
Diff: source/EthernetMagJack.cpp
- Revision:
- 4:e17cc31660ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/EthernetMagJack.cpp Tue Feb 28 21:37:11 2017 -0500 @@ -0,0 +1,34 @@ +/** +@file EthernetMagJack.cpp + +@brief Allow communication with a server using a specific websocket. + +@poject NerfUS, Team P5 +*/ +#include "EthernetMagJack.hpp" + + +EthernetMagJack::EthernetMagJack(char *url) : ws(url) +{ + eth.init(); //Use DHCP + eth.connect(); + printf("IP Address is %s\n\r", eth.getIPAddress()); + + ws.connect(); +} + +void EthernetMagJack::send(char *buffer) +{ + return ws.send(buffer); +} + +void EthernetMagJack::onMessage(char *buffer) +{ + return ws.read(buffer); +} + +EthernetMagJack::~EthernetInterface() +{ + ws.close(); + eth.disconnect(); +} \ No newline at end of file