Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
call_manager.cpp
- Committer:
- klauss
- Date:
- 2014-11-25
- Revision:
- 77:e8c0253b57bc
- Parent:
- 76:9f5f99dd895a
- Child:
- 78:1353744f01e1
File content as of revision 77:e8c0253b57bc:
#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 ); } } }