NerfUS / HardwareInterface

Dependents:   NerfUS_cmake_add_library_from_mbed NerfUS NerfUSGameCoordinator

Committer:
Eric Matte
Date:
Tue Feb 28 21:37:11 2017 -0500
Revision:
4:e17cc31660ad
Added Ethernet to library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Eric Matte 4:e17cc31660ad 1 /**
Eric Matte 4:e17cc31660ad 2 @file EthernetInterface.hpp
Eric Matte 4:e17cc31660ad 3
Eric Matte 4:e17cc31660ad 4 @brief Allow communication with a server using a specific websocket.
Eric Matte 4:e17cc31660ad 5
Eric Matte 4:e17cc31660ad 6 @poject NerfUS, Team P5
Eric Matte 4:e17cc31660ad 7 */
Eric Matte 4:e17cc31660ad 8 class EthernetInterface
Eric Matte 4:e17cc31660ad 9 {
Eric Matte 4:e17cc31660ad 10 /**
Eric Matte 4:e17cc31660ad 11 * Allow to send a buffer of information to the server
Eric Matte 4:e17cc31660ad 12 *
Eric Matte 4:e17cc31660ad 13 * @param buffer The data to send
Eric Matte 4:e17cc31660ad 14 * @returns the number of bytes sent
Eric Matte 4:e17cc31660ad 15 */
Eric Matte 4:e17cc31660ad 16 virtual int send(char *buffer) = 0;
Eric Matte 4:e17cc31660ad 17
Eric Matte 4:e17cc31660ad 18 /**
Eric Matte 4:e17cc31660ad 19 * Blocking method to get message back from the server
Eric Matte 4:e17cc31660ad 20 *
Eric Matte 4:e17cc31660ad 21 * @param buffer Must be a pointer to the buffer to write the message
Eric Matte 4:e17cc31660ad 22 * @return true if a websocket frame has been read
Eric Matte 4:e17cc31660ad 23 */
Eric Matte 4:e17cc31660ad 24 virtual bool onMessage(char *buffer) = 0;
Eric Matte 4:e17cc31660ad 25
Eric Matte 4:e17cc31660ad 26 virtual ~EthernetInterface() {}
Eric Matte 4:e17cc31660ad 27 };