![](/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:
- 67:cdedc64d9921
- Parent:
- 64:5b011d5707d2
- Child:
- 68:b54993674190
diff -r 3f1d22e69e7b -r cdedc64d9921 main.cpp --- a/main.cpp Tue Oct 28 18:35:48 2014 +0000 +++ b/main.cpp Thu Oct 30 19:26:41 2014 +0000 @@ -7,7 +7,7 @@ #include "debug.h" #include "utils.h" #include "flood.h" -#include "eth.h" +#include "bootloader_cbx_handler.h" volatile uint8_t status = 0x00; @@ -30,7 +30,7 @@ } Timer t; t.start(); - Timer udp_timer; + //Timer udp_timer; /* representa ramal do call box */ int ext = 0; @@ -97,8 +97,12 @@ send_msg("Ready"); uint8_t before = t.read(); static uint8_t count = 0; + int bl_ret = init_bl_handler(); + if( dbl ) send_msg("Valor de retorno do bl_habdler = %d", bl_ret ); + + /*------------------------------------------------ main loop -------------------------------------------------------------------------*/ while( true ){ - //FIXME colocar uma condicao aqui + //FIXME colocar uma condicao aqui caso necessario pra nao comprometer ligacoes ... prompt_process( NULL ); wdt.kick(); @@ -139,13 +143,14 @@ cb_bye_counter = 0; prompt_counter = 0; flood_counter = 0; + bootloader_cbx_counter = 0; r_stats = false; stats = true; } if( stats ){ char str[ 200 ]; - snprintf( str, 200, "\n\rReceived Pkgs::\n\r Boot :: %u\n\r Registry :: %u\n\r Ivite :: %u\n\r Audio :: %u\n\r Telemetry :: %u\n\r Cb_by :: %u\n\r Prompt :: %u\n\r Flood :: %u\n\r", - boot_counter, registry_counter, invite_counter, audio_counter, telemetry_counter, cb_bye_counter, prompt_counter, flood_counter ); + snprintf( str, 200, "\n\rReceived Pkgs::\n\r Boot :: %u\n\r Registry :: %u\n\r Ivite :: %u\n\r Audio :: %u\n\r Telemetry :: %u\n\r Cb_by :: %u\n\r Prompt :: %u\n\r Flood :: %u\n\r Bootloader_cbx :: %u\n\r", + boot_counter, registry_counter, invite_counter, audio_counter, telemetry_counter, cb_bye_counter, prompt_counter, flood_counter, bootloader_cbx_counter ); send_msg( str ); stats =false; } @@ -489,6 +494,11 @@ build_telemetry_report( ext, port, ( char *)data ); }break; + case __BOOTLOADER_CBX__ : { + bootloader_cbx_counter++; + int ret = bl_cbx_reply_to_eth( ext, ( char * )data ); + }break; + case __PROMPT__ : { prompt_counter++; send_msg( "Prompt pkg from ( %i, %i ) ::", ext, port ); @@ -586,24 +596,9 @@ }else{ if (flag == 1) { flag = 0; } } + + bl_handler(); - /* - int length; - if( udp_timer.read() > 1 && !listen_udp ){ - data = (uint8_t *)listen_eth_udp( (char *)buffer, &length ); - if( length ){ - listen_udp = true; - debug_msg(""); - }else udp_timer.reset(); - } - if( listen_udp ){ - data = (uint8_t *)listen_eth_udp( (char *)buffer, &length ); - if( udp_timer.read() > 30 ){ - listen_udp = false; - udp_timer.reset(); - } - } - */ type = __DO_NOTHING__; } } \ No newline at end of file