Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
117:e9facba9db27
Parent:
116:39a41ebb675c
Child:
119:ee6a53069455
--- a/call.cpp	Thu Apr 23 20:24:09 2015 +0000
+++ b/call.cpp	Thu Apr 23 21:53:28 2015 +0000
@@ -8,7 +8,9 @@
     this->rtp_server_port = rtp_server_port;
     this->rtp_server.set_address( __RTP_SEVER_IP__, rtp_server_port );
     rtp_sock.set_blocking( false, 0 );
+    debug_msg("primeiro");
     this->rtp_sock.bind( cb_port ); // rtp port
+    debug_msg("segundo");
     this->rtp_sock.init();
     this->rtp = new RTP( this->cb_ext );
     
@@ -32,8 +34,6 @@
 
 char * VZ_call::get_eth_message( int * length ){
     uint8_t * pkg;
-    Endpoint rtp_from;
-    
     *length = rtp_sock.receiveFrom( rtp_server, server2cb, sizeof( server2cb ) );
     t.reset();
     
@@ -54,20 +54,25 @@
     return NULL;
 }
 
-int VZ_call::send_message ( char * buffer  )
-{
-    this->t.reset();
-    int send = this->rtp_sock.sendTo( this->rtp_server, buffer, __CB_AUDIO_DATA_SIZE__ + this->rtp->header_size() );
-    if( send != __CB_AUDIO_DATA_SIZE__ + this->rtp->header_size() )
-    {
-        if( debug_reconnect )
-        {
-            send_msg("Reconnect RTP");
-            miss_ftp_udp_send_pkg++;
-        }
-        reconnect();
-    }
-    return( send );
+int VZ_call::send_message( char * buffer  ){
+    t.reset();
+    return( this->rtp_sock.sendTo( this->rtp_server, buffer, __CB_AUDIO_DATA_SIZE__ + this->rtp->header_size() ) );
+    
+    /*
+    //FIXME verificar como fica se eu esperar o sendTo chegar em != 0
+    int8_t sent = 0;
+    do{
+        sent = this->rtp_sock.sendTo( this->rtp_server, buffer, __CB_AUDIO_DATA_SIZE__ + this->rtp->header_size() ) );
+    }while( sent == 0 );
+    return( sent );
+    */
+}
+
+uint8_t * VZ_call::build_cb_package( void ){
+    // return __build_cb_package__( cb_ext, cb_port, __AUDIO__, server2cb, buffer );
+    // colocar esta funcao novamente pra envio de msg, assim como encapsular melhor a funcao
+    // de criacao dos pacotes pro cb em algumas funcoes.
+    return 0x00;
 }
 
 char * VZ_call::build_eth_package( uint8_t * buffer ){
@@ -91,7 +96,7 @@
     return ( finish.read() > __MAX_CALL_TIME__ ) ? true : false;
 }
 
-uint16_t VZ_call::get_elapsed_time( void ){
+int VZ_call::get_elapsed_time( void ){
     return ( finish.read_ms() );
 }
 
@@ -131,11 +136,4 @@
 int VZ_call::rtp_print_yourself ( void )
 {
     return rtp -> print_yourself ();
-}
-
-void VZ_call::reconnect ( void )
-{
-    this->rtp_sock.close();
-    this->rtp_sock.set_blocking( false, 0 );
-    this->rtp_sock.bind( cb_port );
 }
\ No newline at end of file