Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface NTPClient mbed-rtos_old mbed
Fork of header_main_public by
Diff: utils.cpp
- Revision:
- 8:e3bfe62a477e
- Parent:
- 7:019b08223b87
- Child:
- 9:ffa64f38ef9c
--- a/utils.cpp Sat Sep 13 19:21:48 2014 +0000
+++ b/utils.cpp Mon Sep 15 15:13:52 2014 +0000
@@ -41,10 +41,9 @@
led3 = led4 = 0;
}
-void __init_eth__( EthernetInterface * eth ){
- //eth->init( __MY_IP__, "255.255.255.0", "192.168.120.1" );
- eth->init( __MY_IP__, __MY_MK__, __MY_GW__ );
- eth->connect();
+int __init_eth__( EthernetInterface * eth ){
+ eth->init( __MY_IP__, "255.255.255.0", "192.168.120.1" );
+ return eth->connect();
// pensar em o que acontece e como sinalizar que nao consegui conectar na web
// aparente so da time out, so que algo vai travar quando eu tentar usar a conexao
}
@@ -69,16 +68,18 @@
void registry_aging( Vector * v_cb, uint8_t * data, uint8_t * write_buffer ){
Call_Box * cb = NULL;
- volatile int tam = v_cb->size();
if( v_cb && data && write_buffer ){
+ int tam = v_cb->size();
for( register int i = 0; i < v_cb->size(); i++ ){
cb = (Call_Box * )v_cb->get_element( i );
if( cb->is_timeout() ){
if( cb->reconfigure_timeout() == 0x00 ){
- debug_msg("( ext %d removed ?", cb->get_ext() );
- //cb->unregistry();
- //v_cb->remove_element( i );
- delete( cb );
+ debug_msg("( ext %d removed", cb->get_ext() );
+ cb->unregistry();
+ // slave = cb->get_ext() + 1;
+ // remove_slave = true;
+ // v_cb->remove_element( i );
+ // delete( cb );
break;
}else{
cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) );
@@ -90,8 +91,6 @@
}
if( tam != v_cb->size() ) debug_msg("%d ---> %d", tam, v_cb->size() );
}
-
-
/*
Call_Box * cb = NULL;
if( v_cb && data && write_buffer ){
@@ -164,18 +163,30 @@
if( call->is_timeout() || call->is_timetofinish() ){
v_call->remove_element( i );
Call_Box * cb = __find_CB__( v_cb, call->get_cb_ext() );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
if( cb ){
+ debug_msg("removendo call de %d", call->get_cb_ext() );
cb->status = cb_idle;
+ debug_msg("removendo call de %d", call->get_cb_ext() );
ts->return_timeslice( cb->get_timeslice() );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
cb->set_timeslice( 0x00 );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
data[ __TIMESLICE_PLACE__ ] = 0x00;
+ debug_msg("removendo call de %d", call->get_cb_ext() );
cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
__send_to_cb__( __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 ) );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
cb->send_bye();
+ debug_msg("removendo call de %d", call->get_cb_ext() );
set_status( cb->sip->status, sip_idle );
+ debug_msg("removendo call de %d", call->get_cb_ext() );
}
- delete( call );
+ delete( call );
+ debug_msg("Removido call de %d", call->get_cb_ext() );
+ break;
}
}
}
