Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
74:81c47fff88a5
Child:
76:9f5f99dd895a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/call_manager.cpp	Mon Nov 24 16:43:16 2014 +0000
@@ -0,0 +1,34 @@
+#include "call_manager.h"
+
+VZ_call * __find_Call__( Vector * v_call, int ext ){
+    VZ_call * call = NULL;
+    for( register int i = 0; i < v_call->size(); i++ ){
+        call = ( VZ_call * )v_call->get_element( i );
+        if( call->get_cb_ext() == ext ) return( call );
+    }
+    return( NULL );
+}
+
+/* remove calls por timeout */
+void call_manager( Vector * v_call, Vector * v_cb, uint8_t * data, uint8_t * write_buffer, Timeslice * ts ){
+    for( register int i = 0; i < v_call->size(); i++ ){
+        VZ_call * call = ( VZ_call * )v_call->get_element( i );
+        if( call->is_timetofinish() ){
+            v_call->remove_element( i );
+            Call_Box * cb = __find_CB__( v_cb, call->get_cb_ext() );
+            if( cb ){ 
+                cb->status = cb_idle;
+                ts->return_timeslice( cb->get_timeslice() );
+                cb->set_timeslice( 0x00 );
+                data[ __TIMESLICE_PLACE__ ] = 0x00;
+                cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) );
+                send2callboxes( __build_cb_package__( cb->get_ext(), cb->get_port(), __CB_BYE__, 
+                    ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
+                cb->send_bye();
+                set_status( cb->sip->status, sip_idle );
+                cb->re_start_timer();
+            }
+            delete( call );    
+        }
+    }    
+}
\ No newline at end of file