![](/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: prompt.cpp
- Revision:
- 100:09a23fcd3bdf
- Parent:
- 99:e80850c51106
- Child:
- 102:98c7155e8bea
diff -r e80850c51106 -r 09a23fcd3bdf prompt.cpp --- a/prompt.cpp Mon Jan 19 18:00:42 2015 +0000 +++ b/prompt.cpp Thu Feb 12 16:42:35 2015 +0000 @@ -35,7 +35,7 @@ void files( const char type ){ // show files if (type == 's' ){ - pc.printf("Header IP " ); + if( debug_uart3 ) pc.printf("Header IP " ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Header IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -47,7 +47,7 @@ cat("/qspi/myip.txt"); - pc.printf("Header ext "); + if( debug_uart3 ) pc.printf("Header ext "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Header ext " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -59,7 +59,7 @@ cat("/qspi/myext.txt"); - pc.printf("Header port "); + if( debug_uart3 ) pc.printf("Header port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Header port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -71,7 +71,7 @@ cat("/qspi/mysipport.txt"); - pc.printf("Server IP "); + if( debug_uart3 ) pc.printf("Server IP "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Server IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -83,7 +83,7 @@ cat("/qspi/serverip.txt"); - pc.printf("Server ext "); + if( debug_uart3 ) pc.printf("Server ext "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Server ext " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -95,7 +95,7 @@ cat("/qspi/peerext.txt"); - pc.printf("Server port "); + if( debug_uart3 ) pc.printf("Server port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Server port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -106,7 +106,7 @@ } cat("/qspi/serverport.txt"); - pc.printf("Mascara de rede "); + if( debug_uart3 ) pc.printf("Mascara de rede "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Mascara de rede " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -117,7 +117,7 @@ } cat("/qspi/mymask.txt"); - pc.printf("Gateway IP "); + if( debug_uart3 ) pc.printf("Gateway IP "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Gateway IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -128,7 +128,7 @@ } cat("/qspi/mygateway.txt"); - pc.printf("UDP Port "); + if( debug_uart3 ) pc.printf("UDP Port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "UDP Port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -140,7 +140,7 @@ cat("/qspi/udpport.txt"); - pc.printf("TCP Port "); + if( debug_uart3 ) pc.printf("TCP Port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "TCP Port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -152,7 +152,7 @@ cat("/qspi/tcpport.txt"); - pc.printf("Telemetry Server IP "); + if( debug_uart3 ) pc.printf("Telemetry Server IP "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Telemetry Server IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -164,7 +164,7 @@ cat("/qspi/telemetry_ip.txt"); - pc.printf("Telemetry Server Port "); + if( debug_uart3 ) pc.printf("Telemetry Server Port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Telemetry Server Port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -177,7 +177,7 @@ cat("/qspi/telemetry_port.txt"); /* - pc.printf("FW Server IP "); + if( debug_uart3 ) pc.printf("FW Server IP "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FW Server IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -189,7 +189,7 @@ cat("/qspi/fw_ip.txt"); - pc.printf("FW Server Port "); + if( debug_uart3 ) pc.printf("FW Server Port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Fw Server Port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -202,7 +202,7 @@ cat("/qspi/fw_port.txt"); */ - pc.printf("FW Server IP "); + if( debug_uart3 ) pc.printf("FW Server IP "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FW Server IP " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -214,7 +214,7 @@ cat("/qspi/fw_ip.txt"); - pc.printf("FW Server Port "); + if( debug_uart3 ) pc.printf("FW Server Port "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FW Server Port " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -226,7 +226,7 @@ cat("/qspi/fw_port.txt"); - pc.printf("Max Ext "); + if( debug_uart3 ) pc.printf("Max Ext "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Max Ext " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -238,7 +238,7 @@ cat("/qspi/maxext.txt"); - pc.printf("Min Ext "); + if( debug_uart3 ) pc.printf("Min Ext "); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Min Ext " ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -265,7 +265,7 @@ if (type == 'c' ){ // close all files - debug_msg(""); + //debug_msg(""); if( fip ) fclose( fip ); if( fmask ) fclose( fmask ); if( fgate ) fclose( fgate ); @@ -282,11 +282,11 @@ if( ftport ) fclose( ftport ); if( ffwip ) fclose( ffwip ); if( ffwport) fclose( ffwport ); - debug_msg(""); + //debug_msg(""); } if (type == 'i' ){ - debug_msg(""); + //debug_msg(""); // Check if files exist, if not create the files //fixme criar um bool pra cada file bool exists = true; @@ -375,42 +375,42 @@ } //fclose( ftport ); - debug_msg(""); + //debug_msg(""); ffwip = fopen("/qspi/fw_ip.txt", "r" ); if( ffwip == NULL ){ set_fw_ip( __FW_SERVER_IP__ ); exists = false; } - debug_msg(""); + //debug_msg(""); //fclose( ffwip ); - debug_msg(""); + //debug_msg(""); ffwport = fopen("/qspi/fw_port.txt", "r" ); if( ffwport == NULL ){ set_fw_port( __FW_SERVER_PORT__ ); exists = false; } //fclose( ffwport ); - debug_msg(""); + //debug_msg(""); fmax = fopen("/qspi/maxext.txt", "r" ); - debug_msg(""); + //debug_msg(""); if( fmax == NULL ){ - debug_msg(""); + //debug_msg(""); set_max_ext( MAX_EXT ); - debug_msg(""); + //debug_msg(""); exists = false; - debug_msg(""); + //debug_msg(""); } //fclose( fmax ); - debug_msg(""); + //debug_msg(""); fmin = fopen("/qspi/minext.txt", "r" ); if( fmin == NULL ){ set_min_ext( MIN_EXT ); exists = false; } //fclose( fmin ); - debug_msg(""); + //debug_msg(""); if( !exists ){ - pc.printf("\n\rDefault configurations set!\n\r"); + if( debug_uart3 ) pc.printf("\n\rDefault configurations set!\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Default configurations set!\n\r"); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -421,7 +421,7 @@ } } } - debug_msg(""); + //debug_msg(""); reset_leds(); } @@ -482,7 +482,7 @@ strcpy( last_cmd, tmp_cmd ); - pc.printf("\n\rDefault configurations set!\n\r"); + if( debug_uart3 ) pc.printf("\n\rDefault configurations set!\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rDefault configurations set!\n\r"); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -541,7 +541,7 @@ files('c'); - pc.printf("\n\rErased configurations set!\n\r"); + if( debug_uart3 ) pc.printf("\n\rErased configurations set!\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rErased configurations set!\n\r"); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -560,7 +560,7 @@ // init file system and check if files exist if (!qspifs.isformatted()) { qspifs.format(); - pc.printf("\n\rFile system configured!!\n\r"); + if( debug_uart3 ) pc.printf("\n\rFile system configured!!\n\r"); } files('i'); // check if the files are created files('c'); @@ -575,7 +575,7 @@ tcp_server.set_blocking( false, 0 ); udp_server.set_blocking( false, 0 ); udp_server.bind( UDP_PORT_LISTENER ); - pc.printf("******* Prompt eth Ready *******\n\r"); + if( debug_uart3 ) pc.printf("******* Prompt eth Ready *******\n\r"); } // main prompt process @@ -696,7 +696,7 @@ }else if( udp_request ){ udp_server.sendTo( udp_client, msg_from_cb, strlen( msg_from_cb ) ); } - pc.printf( "\n\r%s\n\r", msg_from_cb ); + if( debug_uart3 ) pc.printf( "\n\r%s\n\r", msg_from_cb ); } if( flood_silence ){ @@ -708,7 +708,7 @@ int port = convert_ext_to_port( ext_count ); send2callboxes( __build_cb_package__( ext_count, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\r\nSilence sent to ext=%d port=%d", ext_count, port ); + if( debug_uart3 ) pc.printf("\r\nSilence sent to ext=%d port=%d", ext_count, port ); if( tcp_session ){ snprintf( eth_buffer, __PROMPT_ETH_BUFFER_SIZE__, "\r\nSilence sent to ext=%d port=%d", ext_count, port ); @@ -728,7 +728,7 @@ flood_silence_timer.stop(); flood_silence_timer.reset(); - pc.printf("\r\n> " ); + if( debug_uart3 ) pc.printf("\r\n> " ); if( tcp_session ){ snprintf( eth_buffer, __PROMPT_ETH_BUFFER_SIZE__, "\r\n> " ); tcp_client.send_all( eth_buffer, strlen( eth_buffer ) ); @@ -747,7 +747,7 @@ pflood = 1; flood_timeout.start(); delayed_flood = false; - pc.printf("\n\rFlood ON\n\r"); + if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Flood On\n\r" ); //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -781,7 +781,7 @@ }else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "-- ", 3 ) ){ miss_match = false; int ext = atoi( debug_buf + 3 ); - pc.printf("\n\rFlood OFF\n\r"); + if( debug_uart3 ) pc.printf("\n\rFlood OFF\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Flood OFF\n\r" ); //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -801,7 +801,7 @@ if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ifconfig" ) ){ miss_match = false; - pc.printf("\n\r"); + if( debug_uart3 ) pc.printf("\n\r"); files('s'); } @@ -826,7 +826,7 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "format" ) ){ miss_match = false; - pc.printf("\n\rFormatando o sistema de arquivos... espere o sistema reiniciar\n\r"); + if( debug_uart3 ) pc.printf("\n\rFormatando o sistema de arquivos... espere o sistema reiniciar\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Not Allowed\n\r"); @@ -931,7 +931,7 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "reset" ) ){ miss_match = false; - pc.printf("\n\rJob is done\n\r"); + if( debug_uart3 ) pc.printf("\n\rJob is done\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Job is done\n\r"); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -948,13 +948,33 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dog" ) ){ miss_match = false; - pc.printf("\n\r MUUUUUUUuuuuUUUUUU - I'm not a dog!!!! \n\r"); + if( debug_uart3 ) pc.printf("\n\r MUUUUUUUuuuuUUUUUU - I'm not a dog!!!! \n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "MUUUUUUUuuuuUUUUUU - I'm not a dog!!!!\n\r"); //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; } } + else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ftq" ) ){ + miss_match = false; + if( debug_uart3 ) pc.printf( "\n\rFTQ ON\n\r" ); + if( from_eth ){ + snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FTQ On\n\r" ); + debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; + } + big_bug_pkg = true; + } + + else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ktq" ) ){ + miss_match = false; + if( debug_uart3 ) pc.printf( "\n\rFTQ!!!\n\r" ); + if( from_eth ){ + snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FTQ!!!\n\r" ); + debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; + } + flood_bug_pkg = !flood_bug_pkg; + } + else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ls" ) ){ miss_match = false; list = true; @@ -999,7 +1019,7 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "types" ) ){ miss_match = false; - pc.printf( "\n\rhex :: dec :: Type \n\r0x00 :: 0 :: boot \n\r0x02 :: 2 :: registry \n\r0x04 :: 4 :: invite \n\r0x08 :: 8 :: audio \n\r0x10 :: 16 :: telemetry \n\r0x20 :: 32 :: cb_bye \n\r0x01 :: 1 :: prompt \n\r0x40 :: 64 :: flood \n\r" ); + if( debug_uart3 ) pc.printf( "\n\rhex :: dec :: Type \n\r0x00 :: 0 :: boot \n\r0x02 :: 2 :: registry \n\r0x04 :: 4 :: invite \n\r0x08 :: 8 :: audio \n\r0x10 :: 16 :: telemetry \n\r0x20 :: 32 :: cb_bye \n\r0x01 :: 1 :: prompt \n\r0x40 :: 64 :: flood \n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rhex :: dec :: Type \n\r0x00 :: 0 :: boot \n\r0x02 :: 2 :: registry \n\r0x04 :: 4 :: invite \n\r0x08 :: 8 :: audio \n\r0x10 :: 16 :: telemetry \n\r0x20 :: 32 :: cb_bye \n\r0x01 :: 1 :: prompt \n\r0x40 :: 64 :: flood \n\r" ); @@ -1010,7 +1030,7 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "protocol" ) ){ miss_match = false; - pc.printf( "\n\r| E | E | P | P | C | C | T | [ Seq_num | Audio ] | 14[ Clock | Audio ] | [ TS | Audio ] | ... |\n\r \n\rE = Ext = Ramal\n\r \n\rP = Port = Porta\n\r \n\rC = Checksum\n\r \n\rT = Type = Tipo\n\r \n\rSeq_num = Sequence Number = Numero de sequencia\n\r \n\rClock = 14 bytes to sync\n\r \n\r... = demais __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__ bytes\n\r" ); + if( debug_uart3 ) pc.printf( "\n\r| E | E | P | P | C | C | T | [ Seq_num | Audio ] | 14[ Clock | Audio ] | [ TS | Audio ] | ... |\n\r \n\rE = Ext = Ramal\n\r \n\rP = Port = Porta\n\r \n\rC = Checksum\n\r \n\rT = Type = Tipo\n\r \n\rSeq_num = Sequence Number = Numero de sequencia\n\r \n\rClock = 14 bytes to sync\n\r \n\r... = demais __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__ bytes\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\r| E | E | P | P | C | C | T | [ Seq_num | Audio ] | 14[ Clock | Audio ] | [ TS | Audio ] | ... |\n\r \n\rE = Ext = Ramal\n\r \n\rP = Port = Porta\n\r \n\rC = Checksum\n\r \n\rT = Type = Tipo\n\r \n\rSeq_num = Sequence Number = Numero de sequencia\n\r \n\rClock = 14 bytes to sync\n\r \n\r... = demais __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__ bytes\n\r" ); @@ -1021,7 +1041,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "flood ", 6 ) ){ if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf("\n\rFlood ON\n\r"); + if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Flood On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1035,7 +1055,7 @@ if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "more", 4 ) ){ miss_match = false; - pc.printf("\n\rFlood ON\n\r"); + if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Flood On\n\r" ); //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1048,7 +1068,7 @@ if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off", 3 )) { miss_match = false; - pc.printf("\n\rFlood OFF\n\r"); + if( debug_uart3 ) pc.printf("\n\rFlood OFF\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Flood Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1064,7 +1084,7 @@ strcpy( promptcb_last_cmd, debug_buf ); if( !( strcmp( debug_buf + 8, "-h" ) && strcmp( debug_buf + 8, "--help" ) ) ){ - pc.printf("\n\rUsage :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 "); + if( debug_uart3 ) pc.printf("\n\rUsage :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 "); if( tcp_session ){ snprintf( eth_buffer, __PROMPT_ETH_BUFFER_SIZE__, "Usage :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 " ); @@ -1089,7 +1109,7 @@ ext_count = start_ext; flood_silence_timer.start(); }else{ - pc.printf("\n\rUsage Error :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 "); + if( debug_uart3 ) pc.printf("\n\rUsage Error :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 "); if( tcp_session ){ snprintf( eth_buffer, __PROMPT_ETH_BUFFER_SIZE__, "Usage Error :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 " ); @@ -1102,7 +1122,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug ",6 ) ){ if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on",2 )) { miss_match = false; - pc.printf("\n\rDebug ON\n\r"); + if( debug_uart3 ) pc.printf("\n\rDebug ON\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1111,7 +1131,7 @@ } if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf("\n\rDebug OFF\n\r"); + if( debug_uart3 ) pc.printf("\n\rDebug OFF\n\r"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1120,18 +1140,18 @@ } if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "show",4 ) ){ miss_match = false; - pc.printf("\n\rdsip"); - pc.printf("\n\rdebug_alive"); - pc.printf("\n\rdebug_prompt"); - pc.printf("\n\rdebug_vector"); - pc.printf("\n\rdebug_cb"); - pc.printf("\n\rdebug_main"); - pc.printf("\n\rdcks"); - pc.printf("\n\rdebug_cb_rx"); - pc.printf("\n\rdebug_cb_tx*"); - pc.printf("\n\rdebug_eth_rx*"); - pc.printf("\n\rdebug_eth_tx*"); - pc.printf("\n\rdebug_file"); + if( debug_uart3 ) pc.printf("\n\rdsip"); + if( debug_uart3 ) pc.printf("\n\rdebug_alive"); + if( debug_uart3 ) pc.printf("\n\rdebug_prompt"); + if( debug_uart3 ) pc.printf("\n\rdebug_vector"); + if( debug_uart3 ) pc.printf("\n\rdebug_cb"); + if( debug_uart3 ) pc.printf("\n\rdebug_main"); + if( debug_uart3 ) pc.printf("\n\rdcks"); + if( debug_uart3 ) pc.printf("\n\rdebug_cb_rx"); + if( debug_uart3 ) pc.printf("\n\rdebug_cb_tx*"); + if( debug_uart3 ) pc.printf("\n\rdebug_eth_rx*"); + if( debug_uart3 ) pc.printf("\n\rdebug_eth_tx*"); + if( debug_uart3 ) pc.printf("\n\rdebug_file"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rdsip \n\rdebug_alive \n\rdebug_prompt \n\rdebug_vector \n\rdebug_cb \n\rdebug_main \n\rdcks \n\rdebug_cb_rx \n\rdebug_cb_tx* \n\rdebug_eth_rx* \n\rdebug_eth_tx* \n\rdebug_file\n\r" ); @@ -1143,7 +1163,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dsip ", 5 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rSip Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rSip Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Sip Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1152,7 +1172,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rSip Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rSip Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Sip Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1161,10 +1181,31 @@ } } + else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "duart ", 6 ) ){ + if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ){ + miss_match = false; + if( debug_uart3 ) pc.printf( "\n\rEnable UART3 usage\n\r" ); + if( from_eth ){ + snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Dinable UART3 usage\n\r" ); + debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; + } + debug_uart3 = true; + } + if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) { + miss_match = false; + if( debug_uart3 ) pc.printf( "\n\rEnable UART3 usage\n\r" ); + if( from_eth ){ + snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Dinable UART3 usage\n\r" ); + debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; + } + debug_uart3 = false; + } + } + else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmatch ", 7 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rPort Match Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rPort Match Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Port Match Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1173,7 +1214,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rPort Match Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rPort Match Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Port Match Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1185,7 +1226,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmuted ", 7 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rMuted Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rMuted Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Muted Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1194,7 +1235,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rMuted Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rMuted Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Muted Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1206,7 +1247,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwdt ", 5 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rWdt Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rWdt Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Wdt Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1215,7 +1256,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rWdt Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rWdt Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Wdt Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1227,7 +1268,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drefresh ", 9 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rRefresh Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rRefresh Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Refresh Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1236,7 +1277,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rRefresh Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rRefresh Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Refresh Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1248,7 +1289,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dping ", 6 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rPing Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rPing Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Ping Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1257,7 +1298,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rPing Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rPing Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Ping Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1269,7 +1310,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwu ", 4 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rWake Up Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rWake Up Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Wake Up Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1278,7 +1319,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rWake Up Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rWake Up Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Wake Up Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1290,7 +1331,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "tcp_alive ", 10 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rTCP don't drop mode on\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rTCP don't drop mode on\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "TCP don't drop mode on\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1299,7 +1340,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rTCP don't drop mode off\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rTCP don't drop mode off\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "TCP don't drop mode off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1311,7 +1352,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "daging ",7 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rAging Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rAging Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Aging Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1320,7 +1361,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rAging Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rAging Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Aging Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1332,7 +1373,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcpld ", 6 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rDCPLD Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rDCPLD Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "DCPLD Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1341,7 +1382,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 ) ){ miss_match = false; - pc.printf( "\n\rDCPLD Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rDCPLD Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "DCPLD Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1353,7 +1394,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks_err ", 9 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rCKS_ERR Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rCKS_ERR Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "CKS_ERR Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1362,7 +1403,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off", 3 ) ){ miss_match = false; - pc.printf( "\n\rCKS_ERR Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rCKS_ERR Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "CKS_ERR Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1374,7 +1415,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dinvite ", 8 ) ){ if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rInvite Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rInvite Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Invite Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1383,7 +1424,7 @@ } if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rInvite Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rInvite Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Invite Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1395,7 +1436,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dparallel ", 10 ) ){ if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t * )"on", 2 ) ){ miss_match = false; - pc.printf( "\n\rParallel Write Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rParallel Write Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rParallel Write Debug ON\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1404,7 +1445,7 @@ } if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t *)"off", 3 )) { miss_match = false; - pc.printf( "\n\rParallel Write Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rParallel Write Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\n\rParallel Write Debug OFF\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1416,7 +1457,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtelos ", 7 ) ){ if (xmemmatch( (uint8_t*)( debug_buf + 7 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf( "\n\rTelemetry Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rTelemetry Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\rTelemetry Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1425,7 +1466,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off", 3 )) { miss_match = false; - pc.printf( "\n\rTelemetry Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rTelemetry Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\rTelemetry Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1437,7 +1478,7 @@ else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks ", 5 ) ){ if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on",2 ) ){ miss_match = false; - pc.printf( "\n\rCKS Debug ON\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rCKS Debug ON\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "CKS Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1446,7 +1487,7 @@ } if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf( "\n\rCKS Debug OFF\n\r" ); + if( debug_uart3 ) pc.printf( "\n\rCKS Debug OFF\n\r" ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "CKS Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1479,9 +1520,9 @@ strcpy( promptcb_last_cmd, cmd ); strcat( cmd, "\r\r\r\n" ); - pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rComando enviado"); + if( debug_uart3 ) pc.printf("\n\rComando enviado"); if( from_eth ){ char eth_msg[ 512 ]; @@ -1512,9 +1553,9 @@ ext = atoi( split ); port = convert_ext_to_port( ext ); - pc.printf("\r\next=%d port=%d request bye", ext, port ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d request bye", ext, port ); send2callboxes( __build_cb_package__( ext, port, __CB_BYE__, (char * )data, 0x20, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rBye enviado"); + if( debug_uart3 ) pc.printf("\n\rBye enviado"); if( from_eth ){ char eth_msg[ 512 ]; @@ -1559,9 +1600,9 @@ //for( register uint16_t i = strlen( cmd ); i < __CB_BUFFER_SIZE__; i++ ) cmd[ i ] = 0; - pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rComando enviado"); + if( debug_uart3 ) pc.printf("\n\rComando enviado"); if( from_eth ){ char eth_msg[ 512 ]; @@ -1605,9 +1646,9 @@ strcpy( promptcb_last_cmd, cmd ); strcat( cmd, "\r\r\r\n" ); - pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rComando enviado"); + if( debug_uart3 ) pc.printf("\n\rComando enviado"); if( from_eth ){ char eth_msg[ 512 ]; @@ -1649,9 +1690,9 @@ strcat( cmd, "\r\r\r\n" ); for( register uint8_t i = 0; i < 3; i++ ){ - pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rComando enviado"); + if( debug_uart3 ) pc.printf("\n\rComando enviado"); if( from_eth ){ char eth_msg[ 512 ]; @@ -1676,9 +1717,9 @@ debug_buf[ bufptr++ ] = 0x0D; debug_buf[ bufptr++ ] = 0x00; - pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n",promptcb_last_ext, promptcb_last_port, debug_buf + 4 ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n",promptcb_last_ext, promptcb_last_port, debug_buf + 4 ); send2callboxes( __build_cb_package__( promptcb_last_ext, promptcb_last_port, __PROMPT__, debug_buf + 4, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\rComando enviado\n\r"); + if( debug_uart3 ) pc.printf("\n\rComando enviado\n\r"); } else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "cks",3 )) { @@ -1694,7 +1735,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_main ", 11 )) { if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on", 2 )) { miss_match = false; - pc.printf("\r\nDebug Main ON"); + if( debug_uart3 ) pc.printf("\r\nDebug Main ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Debug Main On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1703,7 +1744,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off", 3 )) { miss_match = false; - pc.printf("\r\nDebug Main OFF"); + if( debug_uart3 ) pc.printf("\r\nDebug Main OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Debug Main Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1715,7 +1756,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dout ", 5 ) ){ if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf("\r\nOut Debug ON"); + if( debug_uart3 ) pc.printf("\r\nOut Debug ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Out Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1724,7 +1765,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ){ miss_match = false; - pc.printf("\r\nOut Debug OFF"); + if( debug_uart3 ) pc.printf("\r\nOut Debug OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Out Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1736,7 +1777,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dboot ", 6 ) ){ if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf("\r\nBoot Debug ON"); + if( debug_uart3 ) pc.printf("\r\nBoot Debug ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Boot Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1745,7 +1786,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "off", 3 ) ){ miss_match = false; - pc.printf("\r\nBoot Debug OFF"); + if( debug_uart3 ) pc.printf("\r\nBoot Debug OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Boot Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1757,7 +1798,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfw ", 4 ) ){ if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf("\r\nFW Debug ON"); + if( debug_uart3 ) pc.printf("\r\nFW Debug ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FW Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1766,7 +1807,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off", 3 ) ){ miss_match = false; - pc.printf("\r\nFW Debug OFF"); + if( debug_uart3 ) pc.printf("\r\nFW Debug OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FW Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1778,7 +1819,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfwp ", 5 ) ){ if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ){ miss_match = false; - pc.printf("\r\nFWPrint Debug ON"); + if( debug_uart3 ) pc.printf("\r\nFWPrint Debug ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FWPrint Debug On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1787,7 +1828,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ){ miss_match = false; - pc.printf("\r\nFWPrint Debug OFF"); + if( debug_uart3 ) pc.printf("\r\nFWPrint Debug OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "FWPrint Debug Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1799,7 +1840,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drx ", 4 )) { if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) { miss_match = false; - pc.printf("\tDebug Cbx Rx ON"); + if( debug_uart3 ) pc.printf("\tDebug Cbx Rx ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\tDebug Cbx On Rx on\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1808,7 +1849,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf("\tDebug Cbx Rx OFF"); + if( debug_uart3 ) pc.printf("\tDebug Cbx Rx OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\tDebug Cbx Rx Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1820,7 +1861,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtx ", 4 )) { if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) { miss_match = false; - pc.printf("\tDebug Cbx Rx ON"); + if( debug_uart3 ) pc.printf("\tDebug Cbx Rx ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\tDebug Cbx On Rx on\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1829,7 +1870,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf("\tDebug Cbx Rx OFF"); + if( debug_uart3 ) pc.printf("\tDebug Cbx Rx OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\tDebug Cbx Rx Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1841,7 +1882,7 @@ else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_file ", 11 )) { if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on",2 )) { miss_match = false; - pc.printf("\tDebug File ON"); + if( debug_uart3 ) pc.printf("\tDebug File ON"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "\tDebug File On\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1850,7 +1891,7 @@ } if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off",3 )) { miss_match = false; - pc.printf("Debug File OFF"); + if( debug_uart3 ) pc.printf("Debug File OFF"); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Debug File Off\n\r" ); debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -1861,7 +1902,7 @@ else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "help" )) { miss_match = false; - pc.printf("\n\r****************************PROMPT HELP******************\n\r"); + if( debug_uart3 ) pc.printf("\n\r****************************PROMPT HELP******************\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "\n\r****************************PROMPT HELP******************\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1871,7 +1912,7 @@ } } - pc.printf("ifconfig - mostra o arquivo de configuracao do sistema\n\r"); + if( debug_uart3 ) pc.printf("ifconfig - mostra o arquivo de configuracao do sistema\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "ifconfig - mostra o arquivo de configuracao do sistema\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1880,7 +1921,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r"); + if( debug_uart3 ) pc.printf("dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1889,7 +1930,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("callme [ramal porta] - envia o pedido de ligacao para o callbox com o ramal e porta indicada\n\r"); + if( debug_uart3 ) pc.printf("callme [ramal porta] - envia o pedido de ligacao para o callbox com o ramal e porta indicada\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "callme [ramal porta] - envia o pedido de ligacao para o callbox com o ramal e porta indicada\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1898,7 +1939,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("pcb porta comando - envia o <comando> para o cbx <ramal> e <porta> executar\n\r"); + if( debug_uart3 ) pc.printf("pcb porta comando - envia o <comando> para o cbx <ramal> e <porta> executar\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "promptcb ramal porta comando - envia o <comando> para o cbx <ramal> e <porta> executar\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1907,7 +1948,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("format - formata o sistema de arquivos\n\r"); + if( debug_uart3 ) pc.printf("format - formata o sistema de arquivos\n\r"); //desabilitado via eth /* if( from_eth ){ @@ -1919,7 +1960,7 @@ } } */ - pc.printf("reset - resta o sistema\n\r"); + if( debug_uart3 ) pc.printf("reset - resta o sistema\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "reset - resta o sistema\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1928,7 +1969,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("ipset [ip] - Configura o IP da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("ipset [ip] - Configura o IP da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "ipset [ip] - Configura o IP da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1937,7 +1978,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("extset [ext] - Configura a ext da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("extset [ext] - Configura a ext da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "extset [ext] - Configura a ext da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1946,7 +1987,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("msipport [port] - Configura a porta SIP da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("msipport [port] - Configura a porta SIP da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "msipport [port] - Configura a porta SIP da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1955,7 +1996,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("serverip [ip] - Configura o ip do servidor asterisk\n\r"); + if( debug_uart3 ) pc.printf("serverip [ip] - Configura o ip do servidor asterisk\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "serverip [ip] - Configura o ip do servidor asterisk\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1964,7 +2005,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("serextset [ext] - Configura a server ext da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("serextset [ext] - Configura a server ext da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "serextset [ext] - Configura a server ext da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1973,7 +2014,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("ssport [port] - Configura a porta SIP do servidor asterisk\n\r"); + if( debug_uart3 ) pc.printf("ssport [port] - Configura a porta SIP do servidor asterisk\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "ssport [port] - Configura a porta SIP do servidor asterisk\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1982,7 +2023,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("maskset [mask] - Configura a mascara da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("maskset [mask] - Configura a mascara da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "maskset [mask] - Configura a mascara da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -1991,7 +2032,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("gatewayset [gateway] - Configura o gateway da cabeceira\n\r"); + if( debug_uart3 ) pc.printf("gatewayset [gateway] - Configura o gateway da cabeceira\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "gatewayset [gateway] - Configura o gateway da cabeceira\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2000,7 +2041,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("telemetry_ip - Configura o IP do servidor de telemetria\n\r"); + if( debug_uart3 ) pc.printf("telemetry_ip - Configura o IP do servidor de telemetria\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "telemetry_ip - Configura o IP do servidor de telemetria\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2009,7 +2050,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("telemetry_port - Configura a port do servidor de telemetria\n\r"); + if( debug_uart3 ) pc.printf("telemetry_port - Configura a port do servidor de telemetria\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "telemetry_port - Configura a port do servidor de telemetria\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2019,7 +2060,7 @@ } } - pc.printf("fw_ip - Configura o IP do servidor de fw\n\r"); + if( debug_uart3 ) pc.printf("fw_ip - Configura o IP do servidor de fw\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "fw_ip - Configura o IP do servidor de fw\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2028,7 +2069,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("fw_port - Configura a porta do servidor de fw\n\r"); + if( debug_uart3 ) pc.printf("fw_port - Configura a porta do servidor de fw\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "fw_port - Configura a porta do servidor de fw\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2038,7 +2079,7 @@ } } - pc.printf("maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r"); + if( debug_uart3 ) pc.printf("maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2048,7 +2089,7 @@ } } - pc.printf("minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r"); + if( debug_uart3 ) pc.printf("minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2058,7 +2099,7 @@ } } - pc.printf("showcb - lista os Cbx registrados na header\n\r"); + if( debug_uart3 ) pc.printf("showcb - lista os Cbx registrados na header\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "showcb - lista os Cbx registrados na header\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2068,7 +2109,7 @@ } } /* - pc.printf("status - lista resumida de cbx registrados na header\n\r"); + if( debug_uart3 ) pc.printf("status - lista resumida de cbx registrados na header\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "showcb - lista resumida de cbx registrados na header\n\r" ); if( tcp_session ) tcp_client.send_all( debug_buf, strlen( debug_buf ) ); @@ -2078,7 +2119,7 @@ } } */ - pc.printf("cks - exibe estatisticas de check sum\n\r"); + if( debug_uart3 ) pc.printf("cks - exibe estatisticas de check sum\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "cks - exibe estatisticas de check sum\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2087,7 +2128,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("reset_cks - reseta estatisticas de check sum\n\r"); + if( debug_uart3 ) pc.printf("reset_cks - reseta estatisticas de check sum\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "reset_cks - reseta estatisticas de check sum\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2097,7 +2138,7 @@ } } - pc.printf(". - executa o comando anterior novamente\n\r"); + if( debug_uart3 ) pc.printf(". - executa o comando anterior novamente\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, ". - executa o comando anterior novamente\n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2106,7 +2147,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r"); + if( debug_uart3 ) pc.printf("debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r" ); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2115,7 +2156,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r"); + if( debug_uart3 ) pc.printf("{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2125,7 +2166,7 @@ } } - pc.printf("silence <start_ext end_ext> - envia comando de flood off para os ramais no intervalo end_ext - start_ext\n\r"); + if( debug_uart3 ) pc.printf("silence <start_ext end_ext> - envia comando de flood off para os ramais no intervalo end_ext - start_ext\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "silence <start_ext end_ext> - envia comando de flood off para os ramais no intervalo end_ext - start_ext\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2135,7 +2176,7 @@ } } - pc.printf("++ ext - Header flood on, ext flood on\n\r"); + if( debug_uart3 ) pc.printf("++ ext - Header flood on, ext flood on\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "++ ext - Header flood on, ext flood on\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2145,7 +2186,7 @@ } } - pc.printf("-- ext - Header flood off, ext flood off\n\r"); + if( debug_uart3 ) pc.printf("-- ext - Header flood off, ext flood off\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "++ ext - Header flood on, ext flood on\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2155,7 +2196,7 @@ } } - pc.printf("rx - Exibe ultimo pacote recebido dos CBx\n\r"); + if( debug_uart3 ) pc.printf("rx - Exibe ultimo pacote recebido dos CBx\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "rx - Exibe ultimo pacote recebido dos CBx\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2164,7 +2205,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("tx - Exibe ultimo pacote enviado para os CBx\n\r"); + if( debug_uart3 ) pc.printf("tx - Exibe ultimo pacote enviado para os CBx\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "tx - Exibe ultimo pacote enviado para os CBx\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2173,7 +2214,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("ls | status - Exibe uma lista ordenada por ext do CBx registrados na Header\n\r"); + if( debug_uart3 ) pc.printf("ls | status - Exibe uma lista ordenada por ext do CBx registrados na Header\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "ls | status - Exibe uma lista ordenada por ext do CBx registrados na Header\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2182,7 +2223,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r"); + if( debug_uart3 ) pc.printf("types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2191,7 +2232,7 @@ udp_server.sendTo( udp_client, debug_buf, strlen( debug_buf ) ); } } - pc.printf("protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r"); + if( debug_uart3 ) pc.printf("protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r"); if( from_eth ){ snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r"); if( tcp_session ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); @@ -2201,7 +2242,7 @@ } } - pc.printf("PROMPT VERSION: V%d\n\r",PVERSION); + if( debug_uart3 ) pc.printf("PROMPT VERSION: V%d\n\r",PVERSION); //Obs :: a ultima linha nao mandamos direto pro tcp porque ela eh enviada fora desse escopo if( from_eth ) snprintf( debug_buf,__PROMPT_ETH_BUFFER_SIZE__, "PROMPT VERSION: V%d\n\r",PVERSION); } @@ -2226,20 +2267,20 @@ cmd[ tmp + 1 ] = 0x00; strcpy( promptcb_last_cmd, cmd ); - pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n", ext, port, cmd ); + if( debug_uart3 ) pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n", ext, port, cmd ); - pc.printf("\n\r--------------------------------------------------------\n\r"); - for( uint16_t i = 0; i < strlen( cmd ) ; i++ ) pc.printf( "%02x ", cmd[ i ] ); + if( debug_uart3 ) pc.printf("\n\r--------------------------------------------------------\n\r"); + for( uint16_t i = 0; i < strlen( cmd ) ; i++ ) if( debug_uart3 ) pc.printf( "%02x ", cmd[ i ] ); send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - pc.printf("\n\r--------------------------------------------------------\n\r"); + if( debug_uart3 ) pc.printf("\n\r--------------------------------------------------------\n\r"); for( uint16_t i = 0; i < 300 ; i++ ){ - pc.printf( "%02x ", write_buffer[ i ] ); - if( i != 0 && !( ( i + 1 ) % 30 ) ) pc.printf("\n\r"); + if( debug_uart3 ) pc.printf( "%02x ", write_buffer[ i ] ); + if( i != 0 && !( ( i + 1 ) % 30 ) ) if( debug_uart3 ) pc.printf("\n\r"); } - pc.printf("\n\rComando enviado\n\r"); + if( debug_uart3 ) pc.printf("\n\rComando enviado\n\r"); if( from_eth ){ char eth_msg[ 512 ]; @@ -2256,7 +2297,7 @@ } if( miss_match ){ - pc.printf("\n\r> %s: command not found\n\r", debug_buf ); + if( debug_uart3 ) pc.printf("\n\r> %s: command not found\n\r", debug_buf ); if( from_eth ){ snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "> %s: command not found\n ", debug_buf ); //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; @@ -2296,7 +2337,7 @@ } pc.putc(0x0A); pc.putc(0x0D); - pc.printf("> "); + if( debug_uart3 ) pc.printf("> "); } return( NULL ); } \ No newline at end of file