![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: utils.cpp
- Revision:
- 55:2f5e7374af9d
- Parent:
- 54:448d57291be6
- Child:
- 56:c64bcbaa621a
--- a/utils.cpp Wed Oct 22 13:53:49 2014 +0000 +++ b/utils.cpp Wed Oct 22 22:32:26 2014 +0000 @@ -225,7 +225,16 @@ char tmp[ 6 ]; strcpy( aux, itoa( ext, tmp, 10 ) ); strcat( aux, " " ); - strncat( aux, (char * )data, __TELEMETRY_SIZE__ ); + + //strncat( aux, (char * )data, __TELEMETRY_SIZE__ ); + + //pulando os bytes do clock + data += __CLOCK_SYNC_SIZE__; + //pulando o byte de id ( sequence number ) + data += __SEQ_NUM_SIZE__; + for( register uint16_t i = strlen( aux ); i < __TELEMETRY_SIZE__; i++ ) aux[ i ] = data[ i ]; + + for( register uint16_t i = __TELEMETRY_SIZE__; i < __CB_BUFFER_SIZE__; i++ ) aux[ i ] = 0; if( debug_telemetry ){ pc.printf("\n\r 1. "); @@ -236,7 +245,7 @@ } pc.printf("\n\r"); - if( tcp_session ) tcp_client.send_all( ( char *)aux, strlen( (char * )aux ) ); + if( tcp_session ) tcp_client.send_all( ( char *)aux, __CB_BUFFER_SIZE__ ); } UDPSocket t_sock; @@ -252,7 +261,8 @@ //int init = t_sock.init(); //if( debug_telemetry ) send_msg("Valor de retorno init -- %d", init ); - int ret = t_sock.sendTo( t_server, aux, strlen( aux ) ); + //int ret = t_sock.sendTo( t_server, aux, strlen( aux ) ); + int ret = t_sock.sendTo( t_server, aux, __CB_BUFFER_SIZE__ ); if( debug_telemetry ) send_msg("Valor de retorno sent-- %d", ret ); int close = t_sock.close();