Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
133:3d136f5ffd66
Parent:
132:05cd37f7e007
Child:
134:395678c651d8
--- a/call_box_manager.cpp	Tue Sep 01 17:21:11 2015 +0000
+++ b/call_box_manager.cpp	Tue Sep 01 19:33:11 2015 +0000
@@ -22,7 +22,7 @@
 
 int refresh ( Vector * v_cb )
 {
-    if ( v_cb not_eq NULL)
+    if ( v_cb not_eq NULL )
     {
         static int list_index = 0;
             
@@ -39,13 +39,23 @@
             if ( ( cb not_eq NULL ) and ( cb -> get_status () == cb_idle ) )
             {
                 int local_ext = cb -> get_ext ();
+                
+                if ( dont_refresh_5000 ) if ( local_ext == 5000 ) return 5000;
+                if ( dont_refresh_5001 ) if ( local_ext == 5001 ) return 5001;
+                
                 if ( local_ext % 2 == 1 )
                 { 
                     // if ( ! list_exception_ext -> find_value ( local_ext ) )
                     {
+                        // checking master status
                         Call_Box * cb_master = find_CB ( v_cb, local_ext - 1 );
                         
-                        if ( ( cb_master not_eq NULL ) and ( cb_master -> get_status () not_eq cb_idle ) ) return ( 0x20 );
+                        if ( cb_master not_eq NULL ) 
+                        {
+                            if ( cb_master -> get_status () not_eq cb_idle ) return ( 0x20 );
+                        
+                            else if ( cb_master -> get_timer () >= cm -> get_acceptable_delay () ) return ( 0x40 );
+                        }
                     }
                 }
                     else
@@ -55,15 +65,21 @@
                         // checking slave status
                         Call_Box * cb_slave = find_CB ( v_cb, local_ext + 1 );
                         
-                        if ( ( cb_slave not_eq NULL ) and ( cb_slave -> get_status () not_eq cb_idle ) ) return ( 0x21 );
+                        if ( cb_slave not_eq NULL )
+                        {
+                            if ( cb_slave -> get_status () not_eq cb_idle ) return ( 0x21 );
+                            
+                            else if ( cb_slave -> get_timer () >= cm -> get_acceptable_delay () ) return ( 0x41 );
+                        }
                     }
                 }
+                
                 /*
                     condição adicionada para minimizar o comportamento do cbx perder o tx, 
                     pacotes vindo shiftados pra cabeceira, e não perdendo o rx, portando
                     o cbx não resetava sozinho, idéia, deixar ele rebotar pelo wdt dele.
                 */
-                if ( ( cb -> get_timer () < ACCEPTABLE_DELAY ) and ( cb -> get_overflow_times () == 0 ) )
+                if ( ( cb -> get_timer () < cm -> get_acceptable_delay () ) and ( cb -> get_overflow_times () == 0 ) )
                 {
                     send2callboxes( build_cb_package( local_ext, cb->get_port(), REGISTRY, 
                         ( char * )data, cb -> msg_id_update (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );