Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
124:c1b6c893e1c3
Parent:
122:480c44b0e205
Child:
125:8ff4dc96ad58
--- a/call_manager.cpp	Mon May 11 19:21:39 2015 +0000
+++ b/call_manager.cpp	Wed May 13 14:25:57 2015 +0000
@@ -61,18 +61,39 @@
     //FixME pode dar problema por conta do static
     static uint8_t data[ CB_BUFFER_SIZE ], write_buffer[ CB_BUFFER_SIZE ];
     
+    bool should_remove = false;
+    
     for( register uint8_t i = 0; i < v_call->size(); i++ )
     {
+        should_remove = false;
         VZ_call * call = ( VZ_call * )v_call->get_element( i );
-        if( call->is_timetofinish() || call->cbx_pkg_is_idle() )
+        
+        /*
+        if ( call == NULL ) continue;
+        
+        if ( end_call )
         {
-            if( debug_invite ){
+            if ( end_call_ext == call -> get_cb_ext () )
+            {
+                end_call = false;
+                end_call_ext = 0;
+                should_remove = true;
+            }
+        }
+        */
+        
+        if( call->is_timetofinish() || call->cbx_pkg_is_idle() || should_remove )
+        {
+            //if( debug_invite && !should_remove )
+            if( debug_invite && !should_remove )
+            {
                 if( call->cbx_pkg_is_idle() ){ 
                     if( debug_invite ) debug_msg("[%d] Call timeout: no pkg", call->get_cb_ext () );
                 } else { 
                     if( debug_invite ) debug_msg("[%d] Call timeout", call->get_cb_ext () ); 
                 }
             }
+            
             v_call->remove_element( i );
             Call_Box * cb = find_CB ( v_cb, call->get_cb_ext() );
             if( cb != NULL ){