NerfUS / HardwareInterface

Dependents:   NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WSRequest.hpp Source File

WSRequest.hpp

Go to the documentation of this file.
00001 /**
00002 @file WSRequest.hpp
00003 
00004 @brief Allow communication with a server using a specific websocket.
00005 
00006 @poject NerfUS, Team P5
00007 */
00008 #ifndef ETHERNET_MAGJACK
00009 #define ETHERNET_MAGJACK
00010 
00011 #include "WSRequestInterface.hpp"
00012 #include "mbed.h"
00013 #include "EthernetInterface.h"
00014 #include "Websocket.h"
00015 
00016 #define WS_BUFFER_SIZE 32
00017 
00018 class WSRequest : public WSRequestInterface
00019 {
00020     public:
00021         /**
00022         * Initialize the communication interface
00023         *
00024         * @param url The url to the websocket server (eg. "ws://192.168.137.1:8000/")
00025         */
00026         WSRequest(char *url);
00027 
00028         // From the interface
00029         virtual int send(char *buffer);
00030         virtual bool onMessage(char *buffer);
00031         ~WSRequest();
00032         
00033     private:
00034         EthernetInterface eth;
00035         Websocket ws;
00036 };
00037 
00038 #endif