Webserver only w/o any other functions, single thread. Running on STM32F013+W5500
Dependencies: NTPClient W5500Interface Watchdog device_configuration eeprom_flash mbed-rpc-nucleo mbed-rtos mbed
Fork of F103-Serial-to-Ethernet by
Revision 32:db2e8ea06ee1, committed 2015-01-25
- Comitter:
- olympux
- Date:
- Sun Jan 25 11:49:44 2015 +0000
- Parent:
- 31:2e4b6de6c2f3
- Child:
- 33:c906ccc220ba
- Commit message:
- TCP client processes RPC command, similar to TCP/UDP server
Changed in this revision
--- a/main.cpp Sat Jan 24 20:49:24 2015 +0000 +++ b/main.cpp Sun Jan 25 11:49:44 2015 +0000 @@ -296,7 +296,9 @@ /* * UI threads */ - Thread t2(auto_update_timer_thread); + if (auto_transmit_flag == 0xA5A5) { + Thread t2(auto_update_timer_thread); + } Thread t3(wdt_reset_thread); /* @@ -362,7 +364,23 @@ if (n > 0) { // got some data, test it DBG("TCP client received %d bytes: %s", n, tcp_receiving_buffer); - process_control_command(tcp_receiving_buffer, n); + n = process_control_command(tcp_receiving_buffer, n); + // send reply back to client, NNIO protocol always returns 0 + // RPC-style protocol + if (n > 0) { + network_output_buffer[n] = '\0'; + tcp_sock.send_all(network_output_buffer, strlen(network_output_buffer)); + } // RPC-style protocol + else if (n == 0) { + // then, check query status command and sending protocol if required + if (tcp_receiving_buffer[RECEIVING_PROTOCOL_COMMAND_POS] == QUERY_STATUS_COMMAND) { + DBG("Requested to send device status through TCP"); + // sending protocol + update_sending_frame(network_output_buffer); + tcp_sock.send_all(network_output_buffer, SENDING_PROTOCOL_LENGTH); + DBG("Sent"); + } + } // NNIO protocol } } } // if tcp client enabled && auto transmit @@ -462,7 +480,7 @@ udp_server.sendTo(ep_udp_client, network_output_buffer, SENDING_PROTOCOL_LENGTH); DBG("Sent"); } - } + } // NNIO protocol } #endif } // network processor
--- a/mbed-rtos.lib Sat Jan 24 20:49:24 2015 +0000 +++ b/mbed-rtos.lib Sun Jan 25 11:49:44 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#28712e303960 +http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#444020d511f5
--- a/readme.txt Sat Jan 24 20:49:24 2015 +0000 +++ b/readme.txt Sun Jan 25 11:49:44 2015 +0000 @@ -16,4 +16,5 @@ v1.1 (24/01/2015) + Modified: control command is able to be processed by both TCP and UDP. - Only one network output buffer is used for RPC-style and NNIO protocols. \ No newline at end of file + Only one network output buffer is used for RPC-style and NNIO protocols. + + Modified: process RPC-style command in tcp client, similar to TCP/UDP server. \ No newline at end of file