Versao com problema no socket rx

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
klauss
Date:
Wed Sep 10 12:50:57 2014 +0000
Parent:
0:4d17cd9c8f9d
Commit message:
This is a test

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
NTPClient.lib Show annotated file Show diff for this revision Revisions of this file
call_box.cpp Show annotated file Show diff for this revision Revisions of this file
call_box.h Show annotated file Show diff for this revision Revisions of this file
debug.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
sip.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetInterface.lib	Wed Sep 10 12:50:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/EthernetInterface/#5887ae6c0c2c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NTPClient.lib	Wed Sep 10 12:50:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/VZTECH/code/NTPClient/#1114d8054150
--- a/call_box.cpp	Tue Sep 09 20:01:24 2014 +0000
+++ b/call_box.cpp	Wed Sep 10 12:50:57 2014 +0000
@@ -137,4 +137,10 @@
     }else{
         sip->send_bye();
     }
+}
+
+void Call_Box::reset_sip( void ){
+    if( this->sip != NULL ) delete( this->sip );
+    
+    this->sip = new Sip( ext, port );
 }
\ No newline at end of file
--- a/call_box.h	Tue Sep 09 20:01:24 2014 +0000
+++ b/call_box.h	Wed Sep 10 12:50:57 2014 +0000
@@ -51,6 +51,7 @@
         int listen_SIP_server( void );
         void unregistry( void );
         void send_bye( void );
+        void reset_sip( void );
 };
 
 #endif
\ No newline at end of file
--- a/debug.cpp	Tue Sep 09 20:01:24 2014 +0000
+++ b/debug.cpp	Wed Sep 10 12:50:57 2014 +0000
@@ -11,5 +11,5 @@
     strcpy( debug_msg1, "Pkg " );
     memcpy( debug_msg1+5, pkg, size );
     debug_msg1[ 4 ] = i++;
-//    debug.sendTo( debug_server, debug_msg1, size+5 );
+    debug.sendTo( debug_server, debug_msg1, size+5 );
 }
\ No newline at end of file
--- a/main.cpp	Tue Sep 09 20:01:24 2014 +0000
+++ b/main.cpp	Wed Sep 10 12:50:57 2014 +0000
@@ -7,7 +7,6 @@
 #include "debug.h"
 #include "utils.h"
 
-
 // for aditional debugs
 #define on_work
 
@@ -102,8 +101,7 @@
     reset_leds();
     reboot.start();
     debug_msg( " Ready " );
-    
-    
+    /*
     char test_buffer[400];
     UDPSocket test_sock;
     Endpoint test_server;
@@ -116,9 +114,9 @@
     test_sock.sendTo( test_server, test_buffer, sizeof( test_buffer ) );
     Timer reconnect;
     reconnect.start();
-    
-    while( true ){
-        
+    */
+    while( true ){    
+        /*
         n  = test_sock.receiveFrom( test_server, test_buffer, sizeof( test_buffer ) );
         if( n > 0 ){
             test_sock.sendTo( test_server, test_buffer, n );
@@ -130,8 +128,7 @@
             reconnect.reset();
             test_sock.sendTo( test_server, test_buffer, n );
             led4 = !led4;
-        }
-    
+        }*/
         if( status != __WAITING__ ){
             __read_cb_buffer__( buffer, buffer_from_cb_ptr );     
             status = __WAITING__;
@@ -222,6 +219,7 @@
             }break;
             
             case __INVITE__ : {
+                debug_msg("ok -- recebido o invite pelo menos");
                 #ifndef on_work
                 // invite de uma ligacao em andamento ?
                 Call_Box * cb = __find_CB__( v_cb, ext );
@@ -431,6 +429,7 @@
                 }
                 __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, 
                     ( char * )buffer, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
+                cb->reset_sip();
                 set_status( cb->sip->status, sip_idle );
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Wed Sep 10 12:50:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#bd07334df5b1
--- a/sip.cpp	Tue Sep 09 20:01:24 2014 +0000
+++ b/sip.cpp	Wed Sep 10 12:50:57 2014 +0000
@@ -221,11 +221,9 @@
                         char ans[ 1024 ];
                         build_ack_package( ans, ( unsigned char *)buffer_eth_invite );
                         sock.sendTo( sip_server, ans, sizeof( ans ) );
-                        
-                        debug_msg("Call nao alocada -- Sip::status::%d -- loop_times :: %d :: received_loop_times :: %d", status, loop_times, received_loop_times );
+                        debug_msg("Call alocada -- Sip::status::%d -- loop_times :: %d :: received_loop_times :: %d", status, loop_times, received_loop_times );
                         set_status( status, sip_on_call );
                         return( call );
-                        
                     }
                 }
             }