![](/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
Diff: main.cpp
- Revision:
- 101:162c28286c29
- Parent:
- 100:09a23fcd3bdf
- Child:
- 102:98c7155e8bea
diff -r 09a23fcd3bdf -r 162c28286c29 main.cpp --- a/main.cpp Thu Feb 12 16:42:35 2015 +0000 +++ b/main.cpp Fri Feb 13 18:44:45 2015 +0000 @@ -143,6 +143,8 @@ init_aging(); init_sync_refresh(); + + init_clock(); //init_invite_pgk_retry_manager(); @@ -605,7 +607,7 @@ t.tv_usec = 0; int ret = lwip_select( FD_SETSIZE, &fdSet, NULL, NULL, &t ); - if(ret > 0 ) { + if( ret > 0 ) { for( register uint8_t i = 0; i < v_cb->size(); i++ ) { Call_Box * cb = (Call_Box *)v_cb->get_element( i ); int fd = cb->get_sip_socket_fd(); @@ -625,14 +627,6 @@ bool question_alive = ( wake_msg[ 5 ] == '?' ); if( wake_msg[ 5 ] == '*' ) wdt.kick(); - /* - uint8_t registered_cbx = v_cb->size(); - for( register int i = 0; i < v_cb->size(); i++ ){ - Call_Box * cb = (Call_Box * )v_cb->get_element( i ); - if( cb->is_timeout() ){ if( registered_cbx ) registered_cbx--; } - } - */ - snprintf( wake_msg, 48,"wdt:%u,%u,%u,%c,%u,%u,%u,%u,%u:", uptime, invite_counter, @@ -643,7 +637,6 @@ ts->remain_timeslices(), sip_socket_send_failure, v_call->size() - // registered_cbx ); wake_msg[ 768 - 1 ] = 0; udp_wdt_client.sendTo( udp_wdt_server, wake_msg, strlen( wake_msg ) ); @@ -723,9 +716,6 @@ set_status( cb->sip->status, sip_idle ); v_call->remove_element( i ); - - //cb->set_msg_id( ( cb->get_msg_id() & ~BIT7 ) + 1 ); - //cb->set_msg_id( ( cb->get_msg_id() + 1 ) & ~BIT7 ); send2callboxes( __build_cb_package__( ext, port, __CB_BYE__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); @@ -734,7 +724,6 @@ cb->set_msg_id( ( cb->get_msg_id() + 1 ) & ~BIT7 ); delete( call ); - //cb->re_start_timer(); } } if( already_removed ) if( debug_main || debug_invite ) debug_msg( "Already removed from vector call" ); @@ -758,10 +747,7 @@ send2callboxes( __build_cb_package__( ext, port, __CB_BYE__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - //cb->set_msg_id( ( cb->get_msg_id() & ~BIT7 ) + 1 ); cb->set_msg_id( ( cb->get_msg_id() + 1 ) & ~BIT7 ); - - //cb->re_start_timer(); } } } @@ -847,7 +833,6 @@ case __BOOTLOADER_CBX__ : { bootloader_cbx_counter++; - //int ret = bl_cbx_reply_to_eth( ext, ( char * )data ); } break; @@ -855,9 +840,6 @@ Call_Box * cb = __find_CB__( v_cb, ext ); if( cb == NULL ) { -// send2callboxes( __build_cb_package__( ext, port, __REGISTRY__, -// ( char * )data, ( ( data[ 0 ] & ~BIT7 ) + 1 ), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - if( debug_main ) debug_msg("Adding Cbx :: %d", ext ); cb = new Call_Box( ext, port ); if( cb == NULL ){ @@ -1090,6 +1072,8 @@ //invite_retry_time = true; uptime++; + + current_time++; wdt_timer.reset();