![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
call_manager.cpp@77:e8c0253b57bc, 2014-11-25 (annotated)
- Committer:
- klauss
- Date:
- Tue Nov 25 18:43:01 2014 +0000
- Revision:
- 77:e8c0253b57bc
- Parent:
- 76:9f5f99dd895a
- Child:
- 78:1353744f01e1
versao estavel @bugfix setgateway
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 74:81c47fff88a5 | 1 | #include "call_manager.h" |
klauss | 74:81c47fff88a5 | 2 | |
klauss | 74:81c47fff88a5 | 3 | VZ_call * __find_Call__( Vector * v_call, int ext ){ |
klauss | 74:81c47fff88a5 | 4 | VZ_call * call = NULL; |
klauss | 74:81c47fff88a5 | 5 | for( register int i = 0; i < v_call->size(); i++ ){ |
klauss | 74:81c47fff88a5 | 6 | call = ( VZ_call * )v_call->get_element( i ); |
klauss | 74:81c47fff88a5 | 7 | if( call->get_cb_ext() == ext ) return( call ); |
klauss | 74:81c47fff88a5 | 8 | } |
klauss | 74:81c47fff88a5 | 9 | return( NULL ); |
klauss | 74:81c47fff88a5 | 10 | } |
klauss | 74:81c47fff88a5 | 11 | |
klauss | 74:81c47fff88a5 | 12 | /* remove calls por timeout */ |
klauss | 74:81c47fff88a5 | 13 | void call_manager( Vector * v_call, Vector * v_cb, uint8_t * data, uint8_t * write_buffer, Timeslice * ts ){ |
klauss | 74:81c47fff88a5 | 14 | for( register int i = 0; i < v_call->size(); i++ ){ |
klauss | 74:81c47fff88a5 | 15 | VZ_call * call = ( VZ_call * )v_call->get_element( i ); |
klauss | 74:81c47fff88a5 | 16 | if( call->is_timetofinish() ){ |
klauss | 74:81c47fff88a5 | 17 | v_call->remove_element( i ); |
klauss | 74:81c47fff88a5 | 18 | Call_Box * cb = __find_CB__( v_cb, call->get_cb_ext() ); |
klauss | 74:81c47fff88a5 | 19 | if( cb ){ |
klauss | 74:81c47fff88a5 | 20 | cb->status = cb_idle; |
klauss | 74:81c47fff88a5 | 21 | ts->return_timeslice( cb->get_timeslice() ); |
klauss | 74:81c47fff88a5 | 22 | cb->set_timeslice( 0x00 ); |
klauss | 74:81c47fff88a5 | 23 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 74:81c47fff88a5 | 24 | cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) ); |
klauss | 74:81c47fff88a5 | 25 | send2callboxes( __build_cb_package__( cb->get_ext(), cb->get_port(), __CB_BYE__, |
klauss | 74:81c47fff88a5 | 26 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 74:81c47fff88a5 | 27 | cb->send_bye(); |
klauss | 74:81c47fff88a5 | 28 | set_status( cb->sip->status, sip_idle ); |
klauss | 74:81c47fff88a5 | 29 | cb->re_start_timer(); |
klauss | 74:81c47fff88a5 | 30 | } |
klauss | 74:81c47fff88a5 | 31 | delete( call ); |
klauss | 74:81c47fff88a5 | 32 | } |
klauss | 74:81c47fff88a5 | 33 | } |
klauss | 74:81c47fff88a5 | 34 | } |