![](/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:
- 43:455522f98de5
- Parent:
- 42:480335bdde12
- Child:
- 44:cc4996469404
diff -r 480335bdde12 -r 455522f98de5 prompt.cpp --- a/prompt.cpp Fri Oct 03 20:14:59 2014 +0000 +++ b/prompt.cpp Mon Oct 06 14:31:54 2014 +0000 @@ -22,6 +22,7 @@ uint8_t debug_cb_tx = 0; uint8_t debug_eth_rx = 0; uint8_t debug_eth_tx = 0; +uint8_t debug_prompt_eth = 0; uint8_t debug_file = 0; bool from_eth = false; bool udp_request = false; @@ -156,6 +157,9 @@ if( tcp_session ) client.send_all( debug_buf, strlen( debug_buf ) ); } cat("/qspi/mygate.txt"); + + debug_buf[ 0 ] = 0; + bufptr = 0; } if (type == 'c' ){ // close all files @@ -175,7 +179,7 @@ if (fip == NULL){ fip = fopen("/qspi/myip.txt", "w"); //fprintf(fip, "%s\n\r",__MY_IP__); //myip - fprintf(fip, "%s",__MY_IP__); //myip + fprintf(fip, "%s\n\r",__MY_IP__); //myip exists = false; } @@ -195,7 +199,7 @@ if (fsip == NULL){ fsip = fopen("/qspi/serverip.txt", "w"); //fprintf(fsip, "%s\n\r",__SERVER_IP__ ); //asterisk ip - fprintf(fsip, "%s",__SERVER_IP__ ); //asterisk ip + fprintf(fsip, "%s\n\r",__SERVER_IP__ ); //asterisk ip exists = false; } @@ -215,13 +219,13 @@ fmask = fopen("/qspi/mymask.txt", "r"); if (fmask == NULL){ fmask = fopen("/qspi/mymask.txt", "w"); - fprintf(fmask, "%s",__MY_MSK__); //mymask + fprintf(fmask, "%s\n\r",__MY_MSK__); //mymask exists = false; } fgate = fopen("/qspi/mygateway.txt", "r"); if (fgate == NULL){ fgate = fopen("/qspi/mygate.txt", "w"); - fprintf(fgate, "%s",__MY_GTW__); //mygateway + fprintf(fgate, "%s\n\r",__MY_GTW__); //mygateway exists = false; } if( !exists ) pc.printf("\n\r Default configurations set! \n\r"); @@ -250,7 +254,7 @@ //fprintf( fip, "%s\n\r", __MY_IP__ ); //myip fprintf( fip, "%s", __MY_IP__ ); //myip - fprintf( fport, "%i\n\r", __MY_PORT__ ); //mysipport + fprintf( fport, "%i", __MY_PORT__ ); //mysipport fprintf( fext, "%i\n\r", __MY_EXT__ ); //myext //fprintf( fsip, "%s\n\r", __SERVER_IP__ ); //asterisk ip @@ -259,7 +263,7 @@ fprintf( fsport, "%i\n\r",__SERVER_PORT__ ); //asterisk port fprintf( fmask, "%s",__MY_MSK__ ); //mymask - fprintf( fgate, "%i", __MY_GTW__ ); //mygateway + fprintf( fgate, "%i\n\r", __MY_GTW__ ); //mygateway files('c'); @@ -276,12 +280,15 @@ } files('i'); // check if the files are created files('c'); - + pc.printf("*******System Ready*******\n\r"); +} + +void init_prompt(){ server.bind( TCP_PORT_LISTENER ); server.listen(); tcp_timer.start(); server.set_blocking( false, 1 ); - pc.printf("*******System Ready*******\n\r"); + pc.printf("*******Prompt eth Ready*******\n\r"); } // main prompt process @@ -311,7 +318,7 @@ buffer[ n - 2 ] = 0; bufptr = n - 2; if( !( strcmp( buffer, "quit" ) ) ){ - debug_msg("quit request"); + if( debug_prompt_eth ) pc.printf( "\n\rquit request\n\r" ); debug_buf = __debug_buf__; bufptr = last_bufptr; tcp_session = false; @@ -871,7 +878,6 @@ */ if( miss_match ){ - debug_msg(""); 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 );