Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
98:43b45f26b430
Parent:
97:8985817e8847
Child:
99:e80850c51106
--- a/prompt.cpp	Sat Jan 10 23:59:51 2015 +0000
+++ b/prompt.cpp	Sun Jan 11 03:30:47 2015 +0000
@@ -1044,6 +1044,27 @@
             }
         }
         
+        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( from_eth ){
+                    snprintf( debug_buf, __PROMPT_ETH_BUFFER_SIZE__, "Port Match Debug On\n\r" );
+                    debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
+                }
+                debug_port_match = true;
+            }
+            if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
+                miss_match = false;
+                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';
+                }
+                debug_port_match = false;
+            }
+        }
+        
         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;
@@ -1442,6 +1463,59 @@
             for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
         }
         
+        else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "pcc ", 4 )) {
+            miss_match = false;
+            int ext,port;
+            char *split, *ref, *cmd;
+            
+            ref = debug_buf;
+            
+            strcat( debug_buf, "\r" );
+            
+            split = strtok( debug_buf + 4, " " );
+            ext = atoi( split );
+            
+            split += strlen( split ) + 1;
+            split = strtok( NULL, " " );
+            port = atoi( split );
+            
+            split += strlen( split ) + 1;
+            cmd = split;
+            
+            promptcb_last_ext = ext;
+            promptcb_last_port = port;
+            
+            strcpy( promptcb_last_cmd, cmd );
+            strcat( cmd, "\r\r\r\n" );
+            
+            //send_msg( "Tamanho do cmd == %d", strlen( cmd ) );
+            
+            //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 );
+            send2callboxes( __build_cb_package__( ext, port, __PROMPT__, cmd, id_msg++, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) );
+            pc.printf("\n\rComando enviado");
+            
+            if( from_eth ){
+                char eth_msg[ 512 ];
+                snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r", ext, port, cmd );
+                if( tcp_session ){ 
+                    tcp_client.send_all( eth_msg, strlen( eth_msg ) );
+                }else if( udp_request ){
+                    udp_server.sendTo( udp_client, eth_msg, strlen( eth_msg ) );
+                }
+            }
+            
+            debug_buf = ref;
+            //bufptr = 0;
+            //debug_buf[ 0 ] = 0;
+            bufptr = 0;
+            for( uint8_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
+        }
+        
+        
+        
+        
         else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "_pcb",4 )) {
             miss_match = false;
             debug_buf[ bufptr++ ] = 0x0D;