Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Bezier_Trajectory_Follower Dolphin 2_131TEST Jerby ... more
ExperimentServer Class Reference
Experiment Server. More...
#include <ExperimentServer.h>
Public Member Functions | |
ExperimentServer () | |
Constructor. | |
void | attachTerminal (Serial &terminal) |
Link a serial terminal to the server for debugging purposes. | |
void | init () |
Initialize the server. | |
void | init (const char *addr, const char *subnet, const char *gateway, unsigned int port) |
Initialize the server with supplied configuration. | |
int | getParams (float params[], int num_params) |
Listen for parameters passed to the server. | |
void | sendData (float data_output[], int data_size) |
Send data back to host machine. | |
void | setExperimentComplete () |
Inform the host that the experiment is complete. |
Detailed Description
Experiment Server.
Definition at line 10 of file ExperimentServer.h.
Constructor & Destructor Documentation
ExperimentServer | ( | ) |
Constructor.
Constructs an empty experiment server. Server objects require additional initialization before being used. Constructs an empty experiment server. Server objects require further initialization before use.
Definition at line 4 of file ExperimentServer.cpp.
Member Function Documentation
void attachTerminal | ( | Serial & | terminal ) |
Link a serial terminal to the server for debugging purposes.
- Parameters:
-
terminal Serial terminal to be used for debugging messages
Definition at line 9 of file ExperimentServer.cpp.
int getParams | ( | float | params[], |
int | num_params | ||
) |
Listen for parameters passed to the server.
This operation blocks until any data is recieved.
- Parameters:
-
params Float array of size num_params used to store incoming data num_params Expected length of incoming data (# of floats)
- Returns:
- Success of the operation (0 - Failure, 1 - Success) The operation is considered failure if the correct number of floats is not recieved.
Definition at line 61 of file ExperimentServer.cpp.
void init | ( | ) |
Initialize the server.
Following initialization, the getParams, sendData, and setExperimentComplete methods may be used.
Applies default server configuration with ip 192.168.1.100
, subnet 255.255.255.0
, gateway 192.168.1.1
, port 11223
.
Definition at line 13 of file ExperimentServer.cpp.
void init | ( | const char * | addr, |
const char * | subnet, | ||
const char * | gateway, | ||
unsigned int | port | ||
) |
Initialize the server with supplied configuration.
Following initialization, the getParams, sendData, and setExperimentComplete methods may be used.
- Parameters:
-
addr IP address of the server subnet Subnet mask of the IP address gateway Gateway/router IP address port Port to listen on for connections from MATLAB.
Definition at line 22 of file ExperimentServer.cpp.
void sendData | ( | float | data_output[], |
int | data_size | ||
) |
Send data back to host machine.
To alleviate the processing burden on the host machine, data is actually buffered on the chip and sent to the host in batches.
- Parameters:
-
data_output Float array of size data_size containing data to send to host data_size Length of outgoing data (# of floats)
Definition at line 99 of file ExperimentServer.cpp.
void setExperimentComplete | ( | ) |
Inform the host that the experiment is complete.
This function also sends any final buffered output data that has yet to be relayed to the host.
Definition at line 107 of file ExperimentServer.cpp.
Generated on Tue Jul 26 2022 03:30:18 by
