NerfUS / HardwareInterface

Dependents:   NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator

source/EthernetMagJack.cpp

Committer:
Eric Matte
Date:
2017-02-28
Revision:
4:e17cc31660ad

File content as of revision 4:e17cc31660ad:

/**
@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();
}