Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
109:a5b8264ffbbc
Parent:
108:18a3702650f3
Child:
112:6ae726539ab9
--- a/call.cpp	Wed Mar 18 13:33:54 2015 +0000
+++ b/call.cpp	Tue Apr 07 14:27:44 2015 +0000
@@ -7,8 +7,10 @@
     this->rtp_server_ext = rtp_server_ext;
     this->rtp_server_port = rtp_server_port;
     this->rtp_server.set_address( __RTP_SEVER_IP__, rtp_server_port );
-    this->rtp_sock.set_blocking( false, 0 );
-    this->rtp_sock.bind( cb_port );
+    //rtp_sock.set_blocking( false, 3 );
+    rtp_sock.set_blocking( false, 0 );
+    this->rtp_sock.bind( cb_port ); // rtp port
+    this->rtp_sock.init();
     this->rtp = new RTP( this->cb_ext );
     
     if( rtp == NULL )
@@ -31,9 +33,7 @@
 
 char * VZ_call::get_eth_message( int * length ){
     uint8_t * pkg;
-    Endpoint rtp_from;
-    
-    *length = rtp_sock.receiveFrom( rtp_from, server2cb, sizeof( server2cb ) );
+    *length = rtp_sock.receiveFrom( rtp_server, server2cb, sizeof( server2cb ) );
     t.reset();
     
     rtpbuf_next( &rtpbuf );
@@ -55,25 +55,24 @@
 
 int VZ_call::send_message( char * buffer  ){
     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 );
+    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 );
+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;
-//}
+    return 0x00;
+}
 
 char * VZ_call::build_eth_package( uint8_t * buffer ){
     return this->rtp->build_eth_package( ( char * )buffer );    
@@ -112,9 +111,28 @@
     cbx_pkg_idle_timer.start();
 }
 
-void VZ_call::reconnect( void )
+
+int VZ_call::print_yourself ( void )
 {
-    this->rtp_sock.close();
-    this->rtp_sock.set_blocking( false, 0 );
-    this->rtp_sock.bind( cb_port );
+    send_msg("t :: %d", ( int  ) t.read () );
+    send_msg("finish :: %d", ( int ) finish.read () );
+    send_msg("cbx_pkg_idle_timer :: %d", ( int ) cbx_pkg_idle_timer.read () );
+    send_msg("cb_port :: %d", cb_port );
+    send_msg("cb2server :: %p", ( void * ) cb2server );
+    send_msg("server2cb :: %p", ( void * ) server2cb );
+    send_msg("buffer :: %p", ( void * ) buffer );
+    send_msg("rtp_sock :: %p", ( void * )&rtp_sock );
+    send_msg("rtp_server_ext :: %d", rtp_server_ext );
+    send_msg("rtp_server_port :: %d", rtp_server_port );
+    send_msg("rtp_server :: %p", &rtp_server );
+    send_msg("rtp :: %p", ( void * ) rtp );
+    send_msg("rtpbuf :: %p", ( void * ) &rtpbuf );
+    return ( sizeof( VZ_call ) );
+}
+
+void * VZ_call::check_rtp ( void ) { return rtp; }
+
+int VZ_call::rtp_print_yourself ( void )
+{
+    return rtp -> print_yourself ();
 }
\ No newline at end of file