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.
Fork of ExperimentServer by
Revision 9:5a1f3abfca66, committed 2015-09-14
- Comitter:
- pwensing
- Date:
- Mon Sep 14 14:28:07 2015 +0000
- Parent:
- 8:2b31ae3c14ef
- Child:
- 10:47927a20c04d
- Commit message:
- windows newlines; input data size bug
Changed in this revision
| ExperimentServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ExperimentServer.cpp Thu Aug 13 20:10:30 2015 +0000
+++ b/ExperimentServer.cpp Mon Sep 14 14:28:07 2015 +0000
@@ -21,50 +21,50 @@
void ExperimentServer::init(const char * ip_addr, const char * subnet_mask, const char * gateway, unsigned int port) {
if(_terminal!=NULL) {
- _terminal->printf("\n==============================\nStarting Server\n");
- _terminal->printf("...Intializing Ethernet\n");
+ _terminal->printf("\r\n==============================\r\nStarting Server\r\n");
+ _terminal->printf("...Intializing Ethernet\r\n");
}
_eth.init(ip_addr,subnet_mask,gateway);
if(_terminal!=NULL)
- _terminal->printf("...Connecting\n");
+ _terminal->printf("...Connecting\r\n");
_eth.connect();
if(_terminal!=NULL)
- _terminal->printf("...Ethernet IP Address is %s\n", _eth.getIPAddress());
+ _terminal->printf("...Ethernet IP Address is %s\r\n", _eth.getIPAddress());
_server.bind(port);
if(_terminal!=NULL)
- _terminal->printf("...Listening on Port %d\n", port);
+ _terminal->printf("...Listening on Port %d\r\n", port);
}
int ExperimentServer::getParams(float params[], int num_params) {
if(_terminal!=NULL) {
- _terminal->printf("\n========================\nNew Experiment\n");
- _terminal->printf("...Waiting for parameters...\n");
+ _terminal->printf("\r\n========================\r\nNew Experiment\r\n");
+ _terminal->printf("...Waiting for parameters...\r\n");
}
- int n = _server.receiveFrom(_client,(char *) params, sizeof(params)*sizeof(float));
+ int n = _server.receiveFrom(_client,(char *) params, num_params*sizeof(float));
if ( (n% 4) > 0 ) {
if(_terminal!=NULL) {
- _terminal->printf("ERROR: input data bad size\n");
- _terminal->printf("ERROR: Expected %d got %d\n",4*num_params,n);
+ _terminal->printf("ERROR: input data bad size\r\n");
+ _terminal->printf("ERROR: Expected %d got %d\r\n",4*num_params,n);
}
return false;
}
if ( n / 4 != num_params) {
if(_terminal!=NULL) {
- _terminal->printf("ERROR: input data bad size\n");
- _terminal->printf("ERROR: Expected %d got %d\n",4*num_params,n);
+ _terminal->printf("ERROR: input data bad size\r\n");
+ _terminal->printf("ERROR: Expected %d got %d\r\n",4*num_params,n);
}
return false;
}
if(_terminal!=NULL) {
- _terminal->printf("...Received input from: %s\n", _client.get_address());
- _terminal->printf("...Parameters: \n");
+ _terminal->printf("...Received input from: %s\r\n", _client.get_address());
+ _terminal->printf("...Parameters: \r\n");
for ( int j = 0 ; j < n/sizeof(float) ; j++) {
- _terminal->printf(" %d) %f\n",j+1,params[j]);
+ _terminal->printf(" %d) %f\r\n",j+1,params[j]);
}
}
return true;
