2.74
Fork of ExperimentServer by
Diff: ExperimentServer.h
- Revision:
- 0:85e387719efd
- Child:
- 2:bb4b95f37896
- Child:
- 5:195f5f47b56f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ExperimentServer.h Tue Aug 11 21:11:10 2015 +0000 @@ -0,0 +1,30 @@ +#include "EthernetInterface.h" +#include "mbed.h" + +#define _MAX_BUFFER_SIZE 200 + +typedef void (*p_handler)(float[]); + +class ExperimentServer +{ +public: + ExperimentServer(); + void attachTerminal( Serial & terminal); + void init(const char * addr, const char * subnet, const char * host, unsigned int port); + + int getParams(float params[], int num_params); + void sendData(float data_output[], int data_size); + void setExperimentComplete(); + +private: + + void flushBuffer(); + + EthernetInterface _eth; + Endpoint _client; + UDPSocket _server; + Serial * _terminal; + + float _buffer[_MAX_BUFFER_SIZE]; + int _data_cnt; +}; \ No newline at end of file