2.74
Fork of ExperimentServer by
ExperimentServer.h@5:195f5f47b56f, 2015-08-13 (annotated)
- Committer:
- pwensing
- Date:
- Thu Aug 13 17:00:25 2015 +0000
- Revision:
- 5:195f5f47b56f
- Parent:
- 0:85e387719efd
- Child:
- 7:405d66abdedf
added some documentation;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pwensing | 0:85e387719efd | 1 | #include "EthernetInterface.h" |
pwensing | 0:85e387719efd | 2 | #include "mbed.h" |
pwensing | 0:85e387719efd | 3 | |
pwensing | 0:85e387719efd | 4 | #define _MAX_BUFFER_SIZE 200 |
pwensing | 0:85e387719efd | 5 | |
pwensing | 0:85e387719efd | 6 | typedef void (*p_handler)(float[]); |
pwensing | 0:85e387719efd | 7 | |
pwensing | 0:85e387719efd | 8 | class ExperimentServer |
pwensing | 0:85e387719efd | 9 | { |
pwensing | 0:85e387719efd | 10 | public: |
pwensing | 5:195f5f47b56f | 11 | /** |
pwensing | 5:195f5f47b56f | 12 | * Constructor. |
pwensing | 5:195f5f47b56f | 13 | * |
pwensing | 5:195f5f47b56f | 14 | * Constructs an empty experiment server. Server objects require further |
pwensing | 5:195f5f47b56f | 15 | * initialization before use. |
pwensing | 5:195f5f47b56f | 16 | */ |
pwensing | 0:85e387719efd | 17 | ExperimentServer(); |
pwensing | 5:195f5f47b56f | 18 | |
pwensing | 5:195f5f47b56f | 19 | /** |
pwensing | 5:195f5f47b56f | 20 | * |
pwensing | 5:195f5f47b56f | 21 | * Links a serial terminal with the server for debugging. |
pwensing | 5:195f5f47b56f | 22 | * |
pwensing | 5:195f5f47b56f | 23 | * @param terminal Serial terminal to be used for debug messages |
pwensing | 5:195f5f47b56f | 24 | */ |
pwensing | 0:85e387719efd | 25 | void attachTerminal( Serial & terminal); |
pwensing | 5:195f5f47b56f | 26 | |
pwensing | 0:85e387719efd | 27 | void init(const char * addr, const char * subnet, const char * host, unsigned int port); |
pwensing | 0:85e387719efd | 28 | |
pwensing | 0:85e387719efd | 29 | int getParams(float params[], int num_params); |
pwensing | 0:85e387719efd | 30 | void sendData(float data_output[], int data_size); |
pwensing | 0:85e387719efd | 31 | void setExperimentComplete(); |
pwensing | 0:85e387719efd | 32 | |
pwensing | 0:85e387719efd | 33 | private: |
pwensing | 0:85e387719efd | 34 | |
pwensing | 0:85e387719efd | 35 | void flushBuffer(); |
pwensing | 0:85e387719efd | 36 | |
pwensing | 0:85e387719efd | 37 | EthernetInterface _eth; |
pwensing | 0:85e387719efd | 38 | Endpoint _client; |
pwensing | 0:85e387719efd | 39 | UDPSocket _server; |
pwensing | 0:85e387719efd | 40 | Serial * _terminal; |
pwensing | 0:85e387719efd | 41 | |
pwensing | 0:85e387719efd | 42 | float _buffer[_MAX_BUFFER_SIZE]; |
pwensing | 0:85e387719efd | 43 | int _data_cnt; |
pwensing | 0:85e387719efd | 44 | }; |