Wrapper of the mbed hardware
Dependents: NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator
Diff: include/WSRequest.hpp
- Revision:
- 5:0a7810520b9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/WSRequest.hpp Wed Mar 01 03:53:01 2017 +0000 @@ -0,0 +1,38 @@ +/** +@file WSRequest.hpp + +@brief Allow communication with a server using a specific websocket. + +@poject NerfUS, Team P5 +*/ +#ifndef ETHERNET_MAGJACK +#define ETHERNET_MAGJACK + +#include "WSRequestInterface.hpp" +#include "mbed.h" +#include "EthernetInterface.h" +#include "Websocket.h" + +#define WS_BUFFER_SIZE 32 + +class WSRequest : public WSRequestInterface +{ + public: + /** + * Initialize the communication interface + * + * @param url The url to the websocket server (eg. "ws://192.168.137.1:8000/") + */ + WSRequest(char *url); + + // From the interface + virtual int send(char *buffer); + virtual bool onMessage(char *buffer); + ~WSRequest(); + + private: + EthernetInterface eth; + Websocket ws; +}; + +#endif \ No newline at end of file