Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Committer:
klauss
Date:
Wed May 13 14:25:57 2015 +0000
Revision:
124:c1b6c893e1c3
Parent:
123:1d395b5a4cad
Child:
126:1f90756250fb
wip__

Who changed what in which revision?

UserRevisionLine numberNew contents of line
klauss 44:cc4996469404 1 #include "prompt.h"
klauss 45:c80574f24dc3 2
klauss 60:b4ec6beb3be3 3 bool flood_silence = false;
klauss 65:0b653cfe95db 4 bool delayed_flood = false;
klauss 63:0d95da692bb4 5
klauss 78:1353744f01e1 6 Timer tcp_timer;
klauss 78:1353744f01e1 7 bool tcp_alive = false;
klauss 119:ee6a53069455 8 bool serial_pc_pending = false;
klauss 19:ab2088e0dec6 9
klauss 58:af7e8788f106 10 char __debug_buf__[ DEBUGBUFSIZE ];
klauss 35:96885a7931f0 11 char * debug_buf = __debug_buf__;
klauss 58:af7e8788f106 12 char last_cmd[ DEBUGBUFSIZE ];
klauss 58:af7e8788f106 13 char tmp_cmd[ DEBUGBUFSIZE ] = "help";
klauss 30:8dfb6d8de53d 14 char last_debug_buf[ DEBUGBUFSIZE ] = "help";
klauss 119:ee6a53069455 15 char eth_buffer[ PROMPT_ETH_BUFFER_SIZE ];
klauss 119:ee6a53069455 16 char eth_udp_buffer[ PROMPT_ETH_BUFFER_SIZE ];
klauss 119:ee6a53069455 17 char gp_buff[ DEBUGBUFSIZE ];
klauss 19:ab2088e0dec6 18
klauss 119:ee6a53069455 19 uint16_t bufptr = 0;
klauss 119:ee6a53069455 20 uint16_t last_bufptr = 0;
klauss 119:ee6a53069455 21
klauss 121:ee02790d00b7 22 int init_prompt_eth ( void )
klauss 119:ee6a53069455 23 {
klauss 119:ee6a53069455 24 int return_value = 0;
klauss 117:e9facba9db27 25
klauss 119:ee6a53069455 26 int udp_bind = udp_client.bind( UDP_PORT_LISTENER );
klauss 117:e9facba9db27 27
klauss 119:ee6a53069455 28 udp_client.set_blocking( false, 0 );
klauss 119:ee6a53069455 29
klauss 119:ee6a53069455 30 if ( debug_prompt_eth ) debug_msg("udp_client.bind :: %d", udp_bind );
klauss 119:ee6a53069455 31
klauss 119:ee6a53069455 32 if ( udp_bind == 0 ) return_value |= BIT0;
klauss 119:ee6a53069455 33
klauss 119:ee6a53069455 34 int tcp_bind = tcp_server.bind( TCP_PORT_LISTENER );
klauss 117:e9facba9db27 35
klauss 119:ee6a53069455 36 tcp_server.set_blocking( false, 0 );
klauss 119:ee6a53069455 37
klauss 119:ee6a53069455 38 int tcp_listen = tcp_server.listen();
klauss 117:e9facba9db27 39
klauss 119:ee6a53069455 40 if ( debug_prompt_eth ) debug_msg("tcp_server.bind :: %d", tcp_bind );
klauss 119:ee6a53069455 41
klauss 119:ee6a53069455 42 if ( tcp_bind == 0 ) return_value |= BIT1;
klauss 119:ee6a53069455 43
klauss 119:ee6a53069455 44 return ( return_value );
klauss 19:ab2088e0dec6 45 }
klauss 19:ab2088e0dec6 46
klauss 28:94aec56c6329 47 // main prompt process
klauss 119:ee6a53069455 48 char * prompt_process( char * msg_from_cb, int length )
klauss 119:ee6a53069455 49 {
klauss 28:94aec56c6329 50 //FIXME dar flush na serial
klauss 19:ab2088e0dec6 51 volatile char b = 0;
klauss 19:ab2088e0dec6 52 static uint8_t bufret = 0;
klauss 30:8dfb6d8de53d 53 static Timer flood_timeout;
klauss 60:b4ec6beb3be3 54 static Timer flood_silence_timer;
klauss 60:b4ec6beb3be3 55 static uint8_t id_msg = 0x10;
klauss 60:b4ec6beb3be3 56 static int start_ext, end_ext, ext_count;
klauss 36:728498a78e1e 57 bool miss_match = true;
klauss 119:ee6a53069455 58 char eth_buffer[ PROMPT_ETH_BUFFER_SIZE ];
klauss 119:ee6a53069455 59 uint8_t write_buffer[ CB_BUFFER_SIZE ];
klauss 114:472502b31a12 60
klauss 123:1d395b5a4cad 61 if ( id_msg < 0x11 ) id_msg = 0x11;
klauss 123:1d395b5a4cad 62
klauss 114:472502b31a12 63 if( flood_timeout.read() > 60 ){
klauss 45:c80574f24dc3 64 pflood = 0;
klauss 45:c80574f24dc3 65 flood_timeout.stop();
klauss 45:c80574f24dc3 66 flood_timeout.reset();
klauss 45:c80574f24dc3 67 }
klauss 114:472502b31a12 68
klauss 119:ee6a53069455 69 if( tcp_timer.read() >= TCP_IDLE_MAX_TIME ) {
klauss 119:ee6a53069455 70 tcp_alive = false;
klauss 119:ee6a53069455 71 tcp_timer.stop();
klauss 119:ee6a53069455 72 tcp_timer.reset();
klauss 119:ee6a53069455 73 tcp_session = false;
klauss 119:ee6a53069455 74 debug_buf = __debug_buf__;
klauss 119:ee6a53069455 75 bufptr = last_bufptr;
klauss 119:ee6a53069455 76 bufret = 0;
klauss 119:ee6a53069455 77 from_eth = false;
klauss 119:ee6a53069455 78 tcp_client.close();
klauss 119:ee6a53069455 79 return( NULL );
klauss 119:ee6a53069455 80 }
klauss 119:ee6a53069455 81
klauss 119:ee6a53069455 82 if( udp_query )
klauss 119:ee6a53069455 83 {
klauss 119:ee6a53069455 84 if( msg_from_cb != NULL )
klauss 119:ee6a53069455 85 {
klauss 119:ee6a53069455 86 last_bufptr = bufptr;
klauss 119:ee6a53069455 87 if( ( length > 2 ) && ( msg_from_cb[ length - 2 ] == '\r' ) ) msg_from_cb[ length - 2 ] = 0;
klauss 119:ee6a53069455 88
klauss 119:ee6a53069455 89 if( ( length > 1 ) && ( msg_from_cb[ length - 1 ] == '\n' ) ) msg_from_cb[ length - 1 ] = 0;
klauss 119:ee6a53069455 90
klauss 119:ee6a53069455 91 if( ( length == 1 ) && msg_from_cb[ 0 ] == 0x0A ) strcpy( msg_from_cb, "\r" );
klauss 119:ee6a53069455 92
klauss 119:ee6a53069455 93 bufptr = strlen( msg_from_cb );
klauss 119:ee6a53069455 94 debug_buf = msg_from_cb;
klauss 119:ee6a53069455 95 from_eth = true;
klauss 119:ee6a53069455 96 bufret = 1;
klauss 117:e9facba9db27 97 }
klauss 119:ee6a53069455 98 }
klauss 119:ee6a53069455 99 else
klauss 119:ee6a53069455 100 {
klauss 119:ee6a53069455 101 if( !tcp_server.accept( tcp_client ) )
klauss 119:ee6a53069455 102 {
klauss 119:ee6a53069455 103 tcp_session = true;
klauss 119:ee6a53069455 104 tcp_timer.start();
klauss 119:ee6a53069455 105 last_bufptr = bufptr;
klauss 119:ee6a53069455 106 for( register int i = 0; i < PROMPT_ETH_BUFFER_SIZE; i++ ) eth_buffer[ i ] = 0;
klauss 119:ee6a53069455 107 }
klauss 119:ee6a53069455 108 if( tcp_session && !udp_query )
klauss 119:ee6a53069455 109 {
klauss 117:e9facba9db27 110 tcp_client.set_blocking( false, 0 );
klauss 119:ee6a53069455 111 //for( register int i = 0; i < PROMPT_ETH_BUFFER_SIZE; i++ ) eth_buffer[ i ] = 0;
klauss 117:e9facba9db27 112 int n = tcp_client.receive( eth_buffer, sizeof( eth_buffer ) - 1 );
klauss 119:ee6a53069455 113 if( n > 0 ) {
klauss 117:e9facba9db27 114 tcp_timer.reset();
klauss 119:ee6a53069455 115
klauss 117:e9facba9db27 116 if( ( n > 2 ) && ( eth_buffer[ n - 2 ] == '\r' ) ) eth_buffer[ n - 2 ] = 0;
klauss 119:ee6a53069455 117
klauss 117:e9facba9db27 118 if( ( n > 1 ) && ( eth_buffer[ n - 1 ] == '\n' ) ) eth_buffer[ n - 1 ] = 0;
klauss 119:ee6a53069455 119
klauss 117:e9facba9db27 120 if( ( n == 1 ) && eth_buffer[ 0 ] == 0x0A ) strcpy( eth_buffer, "\r" );
klauss 119:ee6a53069455 121
klauss 105:a930035b6556 122 bufptr = strlen( eth_buffer );
klauss 105:a930035b6556 123 debug_buf = eth_buffer;
klauss 105:a930035b6556 124 from_eth = true;
klauss 105:a930035b6556 125 bufret = 1;
klauss 119:ee6a53069455 126
klauss 119:ee6a53069455 127 if( !( strcmp( eth_buffer, "quit" ) ) )
klauss 119:ee6a53069455 128 {
klauss 119:ee6a53069455 129 tcp_timer.stop();
klauss 105:a930035b6556 130 tcp_timer.reset();
klauss 105:a930035b6556 131 debug_buf = __debug_buf__;
klauss 105:a930035b6556 132 bufptr = last_bufptr;
klauss 105:a930035b6556 133 from_eth = false;
klauss 105:a930035b6556 134 tcp_session = false;
klauss 105:a930035b6556 135 tcp_client.close();
klauss 105:a930035b6556 136 bufret = 0;
klauss 105:a930035b6556 137 return( NULL );
klauss 105:a930035b6556 138 }
klauss 119:ee6a53069455 139 } else {
klauss 48:195c97f12e8e 140 debug_buf = __debug_buf__;
klauss 48:195c97f12e8e 141 bufptr = last_bufptr;
klauss 57:78f7191a8b69 142 from_eth = false;
klauss 45:c80574f24dc3 143 }
klauss 119:ee6a53069455 144 }
klauss 117:e9facba9db27 145 }
klauss 119:ee6a53069455 146
klauss 119:ee6a53069455 147 if( ( !from_eth ) && ( !udp_query ) )
klauss 119:ee6a53069455 148 {
klauss 119:ee6a53069455 149 if( pc.readable() ) {
klauss 117:e9facba9db27 150 b = pc.getc();
klauss 119:ee6a53069455 151 if( b == 0x0D ) {
klauss 119:ee6a53069455 152 // enter
klauss 117:e9facba9db27 153 bufret = 1;
klauss 119:ee6a53069455 154 if( from_eth ) serial_pc_pending = true;
klauss 119:ee6a53069455 155 } else {
klauss 117:e9facba9db27 156 pc.putc( b );
klauss 119:ee6a53069455 157 if( b == 0x08 || b == 0x7F ) {
klauss 119:ee6a53069455 158 // BS | DEL
klauss 119:ee6a53069455 159 if( bufptr > 0 ) {
klauss 119:ee6a53069455 160 __debug_buf__[ --bufptr ] = 0;
klauss 119:ee6a53069455 161 }
klauss 119:ee6a53069455 162 } else if( b == 0x09 ) {
klauss 117:e9facba9db27 163 // ignore tab
klauss 119:ee6a53069455 164 } else {
klauss 119:ee6a53069455 165 //debug_msg("--%c,%d--%d--", b, bufptr, last_bufptr );
klauss 119:ee6a53069455 166 __debug_buf__[ bufptr ] = b;
klauss 117:e9facba9db27 167 bufptr++;
klauss 117:e9facba9db27 168 }
klauss 119:ee6a53069455 169 last_bufptr = bufptr;
klauss 117:e9facba9db27 170 }
klauss 116:39a41ebb675c 171 }
klauss 53:bb492a8f115a 172 }
klauss 117:e9facba9db27 173
klauss 114:472502b31a12 174 if( flood_silence ){
klauss 114:472502b31a12 175 if( flood_silence_timer.read_ms() > 250 ){
klauss 113:db67ae00550e 176 char cmd[ 16 ] = "flood off";
klauss 113:db67ae00550e 177 int str_end = strlen( cmd );
klauss 113:db67ae00550e 178 cmd[ str_end ] = 0x0D;
klauss 113:db67ae00550e 179 cmd[ str_end + 1 ] = 0x00;
klauss 119:ee6a53069455 180
klauss 113:db67ae00550e 181 int port = convert_ext_to_port( ext_count );
klauss 119:ee6a53069455 182 send2callboxes( build_cb_package( ext_count, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 119:ee6a53069455 183 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nSilence sent to ext=%d port=%d", ext_count, port );
klauss 119:ee6a53069455 184
klauss 119:ee6a53069455 185 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 186 snprintf( eth_buffer, PROMPT_ETH_BUFFER_SIZE, "\r\nSilence sent to ext=%d port=%d", ext_count, port );
klauss 113:db67ae00550e 187 tcp_client.send_all( eth_buffer, strlen( eth_buffer ) );
klauss 119:ee6a53069455 188 } else if( udp_query ) {
klauss 119:ee6a53069455 189 snprintf( eth_buffer, PROMPT_ETH_BUFFER_SIZE, "\r\nSilence sent to ext=%d port=%d", ext_count, port );
klauss 119:ee6a53069455 190 udp_query_send_msg( eth_buffer );
klauss 113:db67ae00550e 191 }
klauss 113:db67ae00550e 192 flood_silence_timer.reset();
klauss 114:472502b31a12 193
klauss 119:ee6a53069455 194 // importante para o uso da funçao silence
klauss 119:ee6a53069455 195 if( ++ext_count > end_ext ) {
klauss 113:db67ae00550e 196 flood_silence = false;
klauss 113:db67ae00550e 197 flood_silence_timer.stop();
klauss 113:db67ae00550e 198 flood_silence_timer.reset();
klauss 119:ee6a53069455 199
klauss 119:ee6a53069455 200 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\n> " );
klauss 119:ee6a53069455 201 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 202 snprintf( eth_buffer, PROMPT_ETH_BUFFER_SIZE, "\r\n> " );
klauss 113:db67ae00550e 203 tcp_client.send_all( eth_buffer, strlen( eth_buffer ) );
klauss 119:ee6a53069455 204 } else if( udp_query ) {
klauss 119:ee6a53069455 205 snprintf( eth_buffer, PROMPT_ETH_BUFFER_SIZE, "\r\n> " );
klauss 119:ee6a53069455 206 udp_query_send_msg( eth_buffer );
klauss 113:db67ae00550e 207 }
klauss 31:bb5fb28a77df 208 }
klauss 53:bb492a8f115a 209 }
klauss 48:195c97f12e8e 210 }
klauss 114:472502b31a12 211
klauss 114:472502b31a12 212 if( delayed_flood ){
klauss 65:0b653cfe95db 213 tflood.start();
klauss 65:0b653cfe95db 214 tflood.reset();
klauss 65:0b653cfe95db 215 floodcount =0;
klauss 65:0b653cfe95db 216 pflood = 1;
klauss 65:0b653cfe95db 217 flood_timeout.start();
klauss 65:0b653cfe95db 218 delayed_flood = false;
klauss 114:472502b31a12 219 if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r");
klauss 114:472502b31a12 220 if( from_eth ){
klauss 119:ee6a53069455 221 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood On\n\r" );
klauss 114:472502b31a12 222 //debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 65:0b653cfe95db 223 }
klauss 65:0b653cfe95db 224 }
klauss 114:472502b31a12 225
klauss 45:c80574f24dc3 226 // Prompt commands here
klauss 58:af7e8788f106 227 if ( bufret == 1 ) {
klauss 114:472502b31a12 228 static unsigned int promptcb_last_ext = 0;
klauss 114:472502b31a12 229 static unsigned int promptcb_last_port = 0;
klauss 55:2f5e7374af9d 230 static char promptcb_last_cmd[ 300 ];
klauss 60:b4ec6beb3be3 231
klauss 124:c1b6c893e1c3 232 // removendo espacos em branco no inicio da string
klauss 124:c1b6c893e1c3 233 uint16_t shift_blank_spaces = 0;
klauss 124:c1b6c893e1c3 234 for ( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ )
klauss 124:c1b6c893e1c3 235 {
klauss 124:c1b6c893e1c3 236 if ( debug_buf [ i ] == 0x20 ) shift_blank_spaces++;
klauss 124:c1b6c893e1c3 237
klauss 124:c1b6c893e1c3 238 if ( debug_buf [ i ] != 0x20 ) break;
klauss 124:c1b6c893e1c3 239 }
klauss 124:c1b6c893e1c3 240 debug_buf += shift_blank_spaces;
klauss 124:c1b6c893e1c3 241
klauss 58:af7e8788f106 242 strcpy( tmp_cmd, debug_buf );
klauss 114:472502b31a12 243 if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "." ) ){
klauss 45:c80574f24dc3 244 miss_match = false;
klauss 58:af7e8788f106 245 strcpy( debug_buf, last_cmd );
klauss 58:af7e8788f106 246 strcpy( tmp_cmd, debug_buf );
klauss 114:472502b31a12 247 }else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "+" ) ){
klauss 59:e1e300880d2d 248 miss_match = false;
klauss 59:e1e300880d2d 249 strcpy( debug_buf, "flood on" );
klauss 59:e1e300880d2d 250 strcpy( tmp_cmd, debug_buf );
klauss 114:472502b31a12 251 }else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "-" ) ){
klauss 59:e1e300880d2d 252 miss_match = false;
klauss 59:e1e300880d2d 253 strcpy( debug_buf, "flood off" );
klauss 59:e1e300880d2d 254 strcpy( tmp_cmd, debug_buf );
klauss 114:472502b31a12 255 }else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "++ ", 3 ) ){
klauss 59:e1e300880d2d 256 miss_match = false;
klauss 65:0b653cfe95db 257 delayed_flood = true;
klauss 59:e1e300880d2d 258 int ext = atoi( debug_buf + 3 );
klauss 59:e1e300880d2d 259 sprintf( debug_buf, "pcb %i flood on", ext );
klauss 114:472502b31a12 260 }else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "-- ", 3 ) ){
klauss 59:e1e300880d2d 261 miss_match = false;
klauss 59:e1e300880d2d 262 int ext = atoi( debug_buf + 3 );
klauss 114:472502b31a12 263 if( debug_uart3 ) pc.printf("\n\rFlood OFF\n\r");
klauss 114:472502b31a12 264 if( from_eth ){
klauss 119:ee6a53069455 265 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood OFF\n\r" );
klauss 114:472502b31a12 266 //debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 59:e1e300880d2d 267 }
klauss 59:e1e300880d2d 268 pflood = 0;
klauss 59:e1e300880d2d 269 tflood.stop();
klauss 59:e1e300880d2d 270 flood_timeout.reset();
klauss 114:472502b31a12 271 sprintf( debug_buf, "pcb %i flood off", ext );
klauss 45:c80574f24dc3 272 }
klauss 114:472502b31a12 273
klauss 48:195c97f12e8e 274 //tratamento dos enters
klauss 114:472502b31a12 275 if( !bufptr ){
klauss 45:c80574f24dc3 276 miss_match = false;
klauss 114:472502b31a12 277 }else if( bufptr == 1 ) {
klauss 48:195c97f12e8e 278 if( debug_buf[ 0 ] == 0x0D || debug_buf[ 0 ] == 0x0D ) miss_match = false;
klauss 48:195c97f12e8e 279 }
klauss 114:472502b31a12 280
klauss 114:472502b31a12 281 if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ifconfig" ) ){
klauss 45:c80574f24dc3 282 miss_match = false;
klauss 114:472502b31a12 283 if( debug_uart3 ) pc.printf("\n\r");
klauss 45:c80574f24dc3 284 files('s');
klauss 45:c80574f24dc3 285 }
klauss 114:472502b31a12 286
klauss 114:472502b31a12 287 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "rx" ) ){
klauss 62:07e5bdc9f8f7 288 miss_match = false;
klauss 62:07e5bdc9f8f7 289 rx = true;
klauss 62:07e5bdc9f8f7 290 }
klauss 114:472502b31a12 291
klauss 114:472502b31a12 292 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "tx" ) ){
klauss 63:0d95da692bb4 293 miss_match = false;
klauss 63:0d95da692bb4 294 tx = true;
klauss 63:0d95da692bb4 295 }
klauss 114:472502b31a12 296
klauss 114:472502b31a12 297 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "stats" ) ){
klauss 63:0d95da692bb4 298 miss_match = false;
klauss 63:0d95da692bb4 299 stats = true;
klauss 114:472502b31a12 300 }
klauss 114:472502b31a12 301 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "reset_stats" ) ){
klauss 63:0d95da692bb4 302 miss_match = false;
klauss 63:0d95da692bb4 303 r_stats = true;
klauss 63:0d95da692bb4 304 }
klauss 114:472502b31a12 305
klauss 114:472502b31a12 306 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "rtp" ) ) {
klauss 114:472502b31a12 307 miss_match = false;
klauss 114:472502b31a12 308 dshow_rtp = true;
klauss 114:472502b31a12 309 }
klauss 114:472502b31a12 310
klauss 114:472502b31a12 311 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "callrtp" ) ) {
klauss 45:c80574f24dc3 312 miss_match = false;
klauss 114:472502b31a12 313 dcallshow_rtp = true;
klauss 114:472502b31a12 314 }
klauss 114:472502b31a12 315
klauss 114:472502b31a12 316 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "format" ) ){
klauss 114:472502b31a12 317 miss_match = false;
klauss 119:ee6a53069455 318
klauss 119:ee6a53069455 319 if( from_eth )
klauss 119:ee6a53069455 320 {
klauss 119:ee6a53069455 321 char msg[ 32 ];
klauss 119:ee6a53069455 322 snprintf( msg, 32, "Not Allowed\n\r");
klauss 119:ee6a53069455 323
klauss 119:ee6a53069455 324 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 325 tcp_client.send_all( msg, strlen( msg ) );
klauss 119:ee6a53069455 326 } else if( udp_query ) {
klauss 119:ee6a53069455 327 udp_query_send_msg( msg );
klauss 119:ee6a53069455 328 }
klauss 119:ee6a53069455 329 } else {
klauss 119:ee6a53069455 330 if ( debug_uart3 ) pc.printf("\n\rFormatando o sistema de arquivos... espere o sistema reiniciar\n\r");
klauss 62:07e5bdc9f8f7 331 files('e');
klauss 62:07e5bdc9f8f7 332 files('w');
klauss 62:07e5bdc9f8f7 333 __disable_irq();
klauss 62:07e5bdc9f8f7 334 NVIC_SystemReset();
klauss 42:480335bdde12 335 }
klauss 45:c80574f24dc3 336 }
klauss 45:c80574f24dc3 337
klauss 59:e1e300880d2d 338 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "ipset ", 6 )) {
klauss 45:c80574f24dc3 339 miss_match = false;
klauss 54:448d57291be6 340 set_ip( debug_buf + 6 );
klauss 45:c80574f24dc3 341 files('s');
klauss 45:c80574f24dc3 342 }
klauss 109:a5b8264ffbbc 343
klauss 114:472502b31a12 344 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "extset ", 7 ) ){
klauss 45:c80574f24dc3 345 miss_match = false;
klauss 55:2f5e7374af9d 346 set_header_ext( atoi( debug_buf + 7 ) );
klauss 45:c80574f24dc3 347 files('s');
klauss 45:c80574f24dc3 348 }
klauss 114:472502b31a12 349
klauss 114:472502b31a12 350 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "serextset ", 10 ) ){
klauss 45:c80574f24dc3 351 miss_match = false;
klauss 55:2f5e7374af9d 352 set_server_ext( atoi( debug_buf + 10 ) );
klauss 45:c80574f24dc3 353 files('s');
klauss 45:c80574f24dc3 354 }
klauss 119:ee6a53069455 355
klauss 119:ee6a53069455 356 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "shift_port ", 11 ) ){
klauss 119:ee6a53069455 357 miss_match = false;
klauss 119:ee6a53069455 358 set_shift_port( atoi( debug_buf + 11 ) );
klauss 119:ee6a53069455 359 files('s');
klauss 119:ee6a53069455 360 }
klauss 45:c80574f24dc3 361
klauss 114:472502b31a12 362 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "maskset ",8 ) ){
klauss 45:c80574f24dc3 363 miss_match = false;
klauss 55:2f5e7374af9d 364 set_mask( debug_buf + 8 );
klauss 45:c80574f24dc3 365 files('s');
klauss 45:c80574f24dc3 366 }
klauss 45:c80574f24dc3 367
klauss 114:472502b31a12 368 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "gatewayset ",11 ) ){
klauss 45:c80574f24dc3 369 miss_match = false;
klauss 55:2f5e7374af9d 370 set_gateway( debug_buf + 11 );
klauss 45:c80574f24dc3 371 files('s');
klauss 45:c80574f24dc3 372 }
klauss 45:c80574f24dc3 373
klauss 114:472502b31a12 374 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "msipport ",9 ) ){
klauss 45:c80574f24dc3 375 miss_match = false;
klauss 55:2f5e7374af9d 376 set_header_sip_port( atoi( debug_buf + 9 ) );
klauss 45:c80574f24dc3 377 files('s');
klauss 45:c80574f24dc3 378 }
klauss 45:c80574f24dc3 379
klauss 114:472502b31a12 380 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "serverip ",9 ) ){
klauss 45:c80574f24dc3 381 miss_match = false;
klauss 55:2f5e7374af9d 382 set_server_ip( debug_buf + 9 );
klauss 45:c80574f24dc3 383 files('s');
klauss 45:c80574f24dc3 384 }
klauss 114:472502b31a12 385
klauss 114:472502b31a12 386 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "maxext ", 7 ) ){
klauss 81:3656f00ab3db 387 miss_match = false;
klauss 81:3656f00ab3db 388 set_max_ext( atoi( debug_buf + 7 ) );
klauss 81:3656f00ab3db 389 files('s');
klauss 81:3656f00ab3db 390 }
klauss 114:472502b31a12 391
klauss 114:472502b31a12 392 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "minext ", 7 ) ){
klauss 81:3656f00ab3db 393 miss_match = false;
klauss 81:3656f00ab3db 394 set_min_ext( atoi( debug_buf + 7 ) );
klauss 81:3656f00ab3db 395 files('s');
klauss 81:3656f00ab3db 396 }
klauss 45:c80574f24dc3 397
klauss 114:472502b31a12 398 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "ssport ", 7 ) ){
klauss 45:c80574f24dc3 399 miss_match = false;
klauss 55:2f5e7374af9d 400 set_server_port( atoi( debug_buf + 7 ) );
klauss 45:c80574f24dc3 401 files('s');
klauss 45:c80574f24dc3 402 }
klauss 114:472502b31a12 403
klauss 114:472502b31a12 404 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "fw_ip ", 6 ) ){
klauss 99:e80850c51106 405 miss_match = false;
klauss 99:e80850c51106 406 set_fw_ip( debug_buf + 6 );
klauss 99:e80850c51106 407 files('s');
klauss 99:e80850c51106 408 }
klauss 114:472502b31a12 409
klauss 114:472502b31a12 410 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "fw_port ", 8 ) ){
klauss 99:e80850c51106 411 miss_match = false;
klauss 99:e80850c51106 412 set_fw_port( atoi( debug_buf + 8 ) );
klauss 99:e80850c51106 413 files('s');
klauss 99:e80850c51106 414 }
klauss 114:472502b31a12 415
klauss 114:472502b31a12 416 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dconfig" ) ){
klauss 113:db67ae00550e 417 miss_match = false;
klauss 114:472502b31a12 418 /*
klauss 50:d9b6577a70f5 419 files('e');
klauss 45:c80574f24dc3 420 files('w');
klauss 45:c80574f24dc3 421 files('s');
klauss 114:472502b31a12 422 */
klauss 45:c80574f24dc3 423 }
klauss 45:c80574f24dc3 424
klauss 119:ee6a53069455 425 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "reset" ) ) {
klauss 45:c80574f24dc3 426 miss_match = false;
klauss 119:ee6a53069455 427 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rJob is done\n\r");
klauss 119:ee6a53069455 428 if( from_eth ) {
klauss 119:ee6a53069455 429 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Job is done\n\r");
klauss 45:c80574f24dc3 430 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 431 if( tcp_session && !udp_query ) {
klauss 45:c80574f24dc3 432 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 45:c80574f24dc3 433 tcp_client.close();
klauss 119:ee6a53069455 434 } else if( udp_query ) {
klauss 119:ee6a53069455 435 udp_query_send_msg( debug_buf );
klauss 42:480335bdde12 436 }
klauss 45:c80574f24dc3 437 }
klauss 48:195c97f12e8e 438 __disable_irq();
klauss 45:c80574f24dc3 439 NVIC_SystemReset();
klauss 45:c80574f24dc3 440 }
klauss 45:c80574f24dc3 441
klauss 114:472502b31a12 442 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dog" ) ){
klauss 45:c80574f24dc3 443 miss_match = false;
klauss 119:ee6a53069455 444 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r MUUUUUUUuuuuUUUUUU - I'm not a dog!!!! \n\r");
klauss 119:ee6a53069455 445 if( from_eth ) {
klauss 119:ee6a53069455 446 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "MUUUUUUUuuuuUUUUUU - I'm not a dog!!!!\n\r");
klauss 119:ee6a53069455 447 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 448 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 449 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 450 } else if( udp_query ) {
klauss 119:ee6a53069455 451 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 452 }
klauss 45:c80574f24dc3 453 }
klauss 45:c80574f24dc3 454 }
klauss 108:18a3702650f3 455
klauss 124:c1b6c893e1c3 456 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "request_clock" ) ) {
klauss 124:c1b6c893e1c3 457 miss_match = false;
klauss 124:c1b6c893e1c3 458 request_clock_now = true;
klauss 124:c1b6c893e1c3 459 }
klauss 124:c1b6c893e1c3 460
klauss 124:c1b6c893e1c3 461 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "hello" ) ) {
klauss 124:c1b6c893e1c3 462 miss_match = false;
klauss 124:c1b6c893e1c3 463 show_hello_status = true;
klauss 124:c1b6c893e1c3 464 }
klauss 124:c1b6c893e1c3 465
klauss 119:ee6a53069455 466 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "date" ) ) {
klauss 119:ee6a53069455 467 miss_match = false;
klauss 119:ee6a53069455 468 send_msg(" %s %s", __DATE__, __TIME__ );
klauss 119:ee6a53069455 469 }
klauss 119:ee6a53069455 470
klauss 119:ee6a53069455 471 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "clock" ) ) {
klauss 119:ee6a53069455 472 miss_match = false;
klauss 119:ee6a53069455 473 show_current_time = true;
klauss 119:ee6a53069455 474 }
klauss 119:ee6a53069455 475
klauss 119:ee6a53069455 476 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "overflow" ) ) {
klauss 119:ee6a53069455 477 miss_match = false;
klauss 119:ee6a53069455 478 send_msg("Overflow messages :: %d", string_msg_overflow );
klauss 119:ee6a53069455 479 }
klauss 119:ee6a53069455 480
klauss 114:472502b31a12 481 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dep" ) ){
klauss 105:a930035b6556 482 miss_match = false;
klauss 109:a5b8264ffbbc 483 drop_entendi_pkg = !drop_entendi_pkg;
klauss 109:a5b8264ffbbc 484 if ( drop_entendi_pkg )
klauss 109:a5b8264ffbbc 485 {
klauss 112:6ae726539ab9 486 debug_msg ("Entendi pkgs will be droped");
klauss 109:a5b8264ffbbc 487 }
klauss 109:a5b8264ffbbc 488 else
klauss 109:a5b8264ffbbc 489 {
klauss 112:6ae726539ab9 490 debug_msg ("Entendi pkgs don't will be droped");
klauss 109:a5b8264ffbbc 491 }
klauss 105:a930035b6556 492 }
klauss 105:a930035b6556 493
klauss 109:a5b8264ffbbc 494 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dita" ) ){
klauss 97:8985817e8847 495 miss_match = false;
klauss 109:a5b8264ffbbc 496 drop_invite_to_ast_pkg = !drop_invite_to_ast_pkg;
klauss 109:a5b8264ffbbc 497 if ( drop_invite_to_ast_pkg )
klauss 109:a5b8264ffbbc 498 {
klauss 109:a5b8264ffbbc 499 debug_msg ("Invite pkgs to ast will be droped");
klauss 64:5b011d5707d2 500 }
klauss 109:a5b8264ffbbc 501 else
klauss 109:a5b8264ffbbc 502 {
klauss 109:a5b8264ffbbc 503 debug_msg ("Invite pkgs to ast don't will be droped");
klauss 64:5b011d5707d2 504 }
klauss 64:5b011d5707d2 505 }
klauss 105:a930035b6556 506
klauss 109:a5b8264ffbbc 507 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dop" ) ){
klauss 109:a5b8264ffbbc 508 miss_match = false;
klauss 109:a5b8264ffbbc 509 drop_ok_pkg = !drop_ok_pkg;
klauss 109:a5b8264ffbbc 510 if ( drop_ok_pkg )
klauss 109:a5b8264ffbbc 511 {
klauss 109:a5b8264ffbbc 512 debug_msg ("Ok pkgs will be droped");
klauss 45:c80574f24dc3 513 }
klauss 109:a5b8264ffbbc 514 else
klauss 109:a5b8264ffbbc 515 {
klauss 109:a5b8264ffbbc 516 debug_msg ("Ok pkgs don't will be droped");
klauss 61:06e77dff6f00 517 }
klauss 109:a5b8264ffbbc 518 }
klauss 105:a930035b6556 519
klauss 109:a5b8264ffbbc 520 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dip" ) ){
klauss 60:b4ec6beb3be3 521 miss_match = false;
klauss 109:a5b8264ffbbc 522 drop_invite_pkg = !drop_invite_pkg;
klauss 109:a5b8264ffbbc 523 if ( drop_invite_pkg )
klauss 109:a5b8264ffbbc 524 {
klauss 109:a5b8264ffbbc 525 debug_msg ("invite pkgs from cbx will be droped");
klauss 109:a5b8264ffbbc 526 }
klauss 109:a5b8264ffbbc 527 else
klauss 109:a5b8264ffbbc 528 {
klauss 109:a5b8264ffbbc 529 debug_msg ("invite pkgs from cbx don't will be droped");
klauss 48:195c97f12e8e 530 }
klauss 114:472502b31a12 531
klauss 109:a5b8264ffbbc 532 }
klauss 109:a5b8264ffbbc 533
klauss 119:ee6a53069455 534 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "drp" ) ){
klauss 119:ee6a53069455 535 miss_match = false;
klauss 119:ee6a53069455 536 drop_registry_pkg = !drop_registry_pkg;
klauss 119:ee6a53069455 537 if ( drop_registry_pkg )
klauss 119:ee6a53069455 538 {
klauss 119:ee6a53069455 539 debug_msg ("registrys pkgs from cbx will be droped");
klauss 119:ee6a53069455 540 }
klauss 119:ee6a53069455 541 else
klauss 119:ee6a53069455 542 {
klauss 119:ee6a53069455 543 debug_msg ("registrys pkgs from cbx don't will be droped");
klauss 119:ee6a53069455 544 }
klauss 119:ee6a53069455 545
klauss 119:ee6a53069455 546 }
klauss 119:ee6a53069455 547
klauss 119:ee6a53069455 548 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "rafc" ) ){
klauss 119:ee6a53069455 549 miss_match = false;
klauss 119:ee6a53069455 550 received_audio_from_cb = !received_audio_from_cb;
klauss 119:ee6a53069455 551 if ( received_audio_from_cb )
klauss 119:ee6a53069455 552 {
klauss 119:ee6a53069455 553 debug_msg ("audio pkgs from cbx will printed");
klauss 119:ee6a53069455 554 }
klauss 119:ee6a53069455 555 else
klauss 119:ee6a53069455 556 {
klauss 119:ee6a53069455 557 debug_msg ("audio pkgs from cbx don't will printed");
klauss 119:ee6a53069455 558 }
klauss 119:ee6a53069455 559
klauss 119:ee6a53069455 560 }
klauss 119:ee6a53069455 561
klauss 109:a5b8264ffbbc 562 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "dap" ) ){
klauss 109:a5b8264ffbbc 563 miss_match = false;
klauss 109:a5b8264ffbbc 564 drop_ack_pkg = !drop_ack_pkg;
klauss 109:a5b8264ffbbc 565 if ( drop_ack_pkg )
klauss 109:a5b8264ffbbc 566 {
klauss 109:a5b8264ffbbc 567 debug_msg ("ack pkgs will be droped");
klauss 109:a5b8264ffbbc 568 }
klauss 109:a5b8264ffbbc 569 else
klauss 109:a5b8264ffbbc 570 {
klauss 109:a5b8264ffbbc 571 debug_msg ("ack pkgs don't will be droped");
klauss 114:472502b31a12 572 }
klauss 114:472502b31a12 573
klauss 45:c80574f24dc3 574 }
klauss 105:a930035b6556 575
klauss 109:a5b8264ffbbc 576 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "drfa" ) ){
klauss 109:a5b8264ffbbc 577 miss_match = false;
klauss 109:a5b8264ffbbc 578 drop_rtp_from_ast_pkg = !drop_rtp_from_ast_pkg;
klauss 109:a5b8264ffbbc 579 if ( drop_rtp_from_ast_pkg )
klauss 109:a5b8264ffbbc 580 {
klauss 119:ee6a53069455 581 debug_msg ("rtp pkgs from ast will be droped");
klauss 42:480335bdde12 582 }
klauss 109:a5b8264ffbbc 583 else
klauss 109:a5b8264ffbbc 584 {
klauss 109:a5b8264ffbbc 585 debug_msg ("rtp pkgs from ast don't will be droped");
klauss 78:1353744f01e1 586 }
klauss 114:472502b31a12 587 }
klauss 114:472502b31a12 588
klauss 109:a5b8264ffbbc 589 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "drfc" ) ){
klauss 109:a5b8264ffbbc 590 miss_match = false;
klauss 109:a5b8264ffbbc 591 drop_rtp_from_cbx_pkg = !drop_rtp_from_cbx_pkg;
klauss 109:a5b8264ffbbc 592 if ( drop_rtp_from_cbx_pkg )
klauss 109:a5b8264ffbbc 593 {
klauss 109:a5b8264ffbbc 594 debug_msg ("rtp pkgs from cbx will be droped");
klauss 109:a5b8264ffbbc 595 }
klauss 109:a5b8264ffbbc 596 else
klauss 109:a5b8264ffbbc 597 {
klauss 109:a5b8264ffbbc 598 debug_msg ("rtp pkgs from cbx don't will be droped");
klauss 119:ee6a53069455 599 }
klauss 119:ee6a53069455 600 }
klauss 119:ee6a53069455 601
klauss 119:ee6a53069455 602 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "uptime" ) ) {
klauss 119:ee6a53069455 603 miss_match = false;
klauss 119:ee6a53069455 604 send_msg(" %d", uptime );
klauss 109:a5b8264ffbbc 605 }
klauss 114:472502b31a12 606
klauss 124:c1b6c893e1c3 607 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "wake" ) ) {
klauss 124:c1b6c893e1c3 608 miss_match = false;
klauss 124:c1b6c893e1c3 609 show_wake_all_up_status = true;
klauss 124:c1b6c893e1c3 610 }
klauss 124:c1b6c893e1c3 611
klauss 124:c1b6c893e1c3 612 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "wake_on" ) ) {
klauss 124:c1b6c893e1c3 613 miss_match = false;
klauss 124:c1b6c893e1c3 614 send_msg("Function wake_all_up : Enable");
klauss 124:c1b6c893e1c3 615 wake_all = true;
klauss 124:c1b6c893e1c3 616 }
klauss 124:c1b6c893e1c3 617
klauss 124:c1b6c893e1c3 618 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "wake_off" ) ) {
klauss 124:c1b6c893e1c3 619 miss_match = false;
klauss 124:c1b6c893e1c3 620 send_msg("Function wake_all_up : Disable");
klauss 124:c1b6c893e1c3 621 wake_all = false;
klauss 124:c1b6c893e1c3 622 }
klauss 124:c1b6c893e1c3 623
klauss 119:ee6a53069455 624 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "sizes" ) ) {
klauss 119:ee6a53069455 625 miss_match = false;
klauss 119:ee6a53069455 626 sizes = true;
klauss 119:ee6a53069455 627 }
klauss 119:ee6a53069455 628
klauss 114:472502b31a12 629 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ftq" ) ){
klauss 109:a5b8264ffbbc 630 miss_match = false;
klauss 114:472502b31a12 631 if( debug_uart3 ) pc.printf( "\n\rFTQ ON\n\r" );
klauss 114:472502b31a12 632 if( from_eth ){
klauss 119:ee6a53069455 633 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FTQ On\n\r" );
klauss 114:472502b31a12 634 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 635 }
klauss 114:472502b31a12 636 big_bug_pkg = true;
klauss 109:a5b8264ffbbc 637 }
klauss 114:472502b31a12 638
klauss 114:472502b31a12 639 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "ktq" ) ){
klauss 109:a5b8264ffbbc 640 miss_match = false;
klauss 114:472502b31a12 641 if( debug_uart3 ) pc.printf( "\n\rFTQ!!!\n\r" );
klauss 124:c1b6c893e1c3 642
klauss 124:c1b6c893e1c3 643 if( from_eth ){
klauss 124:c1b6c893e1c3 644 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FTQ!!!\n\r" );
klauss 124:c1b6c893e1c3 645 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 646 }
klauss 124:c1b6c893e1c3 647 flood_bug_pkg = !flood_bug_pkg;
klauss 109:a5b8264ffbbc 648 }
klauss 114:472502b31a12 649
klauss 124:c1b6c893e1c3 650 else if ( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "ls", 2 ) )
klauss 124:c1b6c893e1c3 651 {
klauss 109:a5b8264ffbbc 652 miss_match = false;
klauss 124:c1b6c893e1c3 653 reverse_list = false;
klauss 109:a5b8264ffbbc 654 list = true;
klauss 124:c1b6c893e1c3 655
klauss 124:c1b6c893e1c3 656 if ( strlen ( debug_buf ) != 2 )
klauss 124:c1b6c893e1c3 657 {
klauss 124:c1b6c893e1c3 658 if ( strstr ( ( debug_buf + 2 ), "r" ) )
klauss 124:c1b6c893e1c3 659 {
klauss 124:c1b6c893e1c3 660 reverse_list = true;
klauss 124:c1b6c893e1c3 661 }
klauss 124:c1b6c893e1c3 662
klauss 124:c1b6c893e1c3 663 if ( strstr ( ( debug_buf + 2 ), "l" ) )
klauss 124:c1b6c893e1c3 664 {
klauss 124:c1b6c893e1c3 665 list = false;
klauss 124:c1b6c893e1c3 666 long_list = true;
klauss 124:c1b6c893e1c3 667 }
klauss 124:c1b6c893e1c3 668 if ( strstr ( ( debug_buf + 2 ), "t" ) )
klauss 124:c1b6c893e1c3 669 {
klauss 124:c1b6c893e1c3 670 long_list = true;
klauss 124:c1b6c893e1c3 671 list = false;
klauss 124:c1b6c893e1c3 672 show_time = true;
klauss 124:c1b6c893e1c3 673 }
klauss 124:c1b6c893e1c3 674 }
klauss 109:a5b8264ffbbc 675 }
klauss 114:472502b31a12 676
klauss 124:c1b6c893e1c3 677 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drtp ", 5 ) ) {
klauss 114:472502b31a12 678 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ) {
klauss 114:472502b31a12 679 miss_match = false;
klauss 114:472502b31a12 680 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRtp Debug ON\n\r" );
klauss 114:472502b31a12 681 if( from_eth ) {
klauss 119:ee6a53069455 682 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Rtp Debug On\n\r");
klauss 114:472502b31a12 683 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 684 if( tcp_session ) {
klauss 114:472502b31a12 685 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 114:472502b31a12 686 }
klauss 114:472502b31a12 687 }
klauss 114:472502b31a12 688 debug_rtp = true;
klauss 114:472502b31a12 689 }
klauss 114:472502b31a12 690 if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ){
klauss 114:472502b31a12 691 miss_match = false;
klauss 114:472502b31a12 692 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRtp Debug OFF\n\r" );
klauss 114:472502b31a12 693 if( from_eth ) {
klauss 119:ee6a53069455 694 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Rtp Debug Off\n\r");
klauss 114:472502b31a12 695 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 696 if( tcp_session ) {
klauss 114:472502b31a12 697 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 114:472502b31a12 698 }
klauss 114:472502b31a12 699 }
klauss 114:472502b31a12 700 debug_rtp = false;
klauss 114:472502b31a12 701 }
klauss 107:cf1e43414adb 702 }
klauss 107:cf1e43414adb 703
klauss 109:a5b8264ffbbc 704 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "print_v_cb" ) ) {
klauss 109:a5b8264ffbbc 705 miss_match = false;
klauss 109:a5b8264ffbbc 706 print_v_cb = true;
klauss 109:a5b8264ffbbc 707 }
klauss 109:a5b8264ffbbc 708
klauss 109:a5b8264ffbbc 709 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "print_v_call" ) ) {
klauss 109:a5b8264ffbbc 710 miss_match = false;
klauss 109:a5b8264ffbbc 711 print_v_call = true;
klauss 109:a5b8264ffbbc 712 }
klauss 109:a5b8264ffbbc 713
klauss 109:a5b8264ffbbc 714 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "tt" ) ){
klauss 109:a5b8264ffbbc 715 miss_match = false;
klauss 109:a5b8264ffbbc 716 main_test = !main_test;
klauss 109:a5b8264ffbbc 717 }
klauss 109:a5b8264ffbbc 718
klauss 112:6ae726539ab9 719 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "registra" ) ){
klauss 112:6ae726539ab9 720 miss_match = false;
klauss 112:6ae726539ab9 721 registra = true;
klauss 112:6ae726539ab9 722 }
klauss 112:6ae726539ab9 723
klauss 114:472502b31a12 724 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "show_sip" ) ){
klauss 114:472502b31a12 725 miss_match = false;
klauss 114:472502b31a12 726 show_sip = true;
klauss 114:472502b31a12 727 }
klauss 114:472502b31a12 728
klauss 114:472502b31a12 729 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "reset_cks" ) ){
klauss 114:472502b31a12 730 miss_match = false;
klauss 114:472502b31a12 731 reset_cks = true;
klauss 114:472502b31a12 732 }
klauss 114:472502b31a12 733
klauss 114:472502b31a12 734 //replaced by ls
klauss 114:472502b31a12 735 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "status" ) ){
klauss 109:a5b8264ffbbc 736 miss_match = false;
klauss 114:472502b31a12 737 list = true;
klauss 114:472502b31a12 738 }
klauss 114:472502b31a12 739
klauss 114:472502b31a12 740 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "wdt" ) ){
klauss 114:472502b31a12 741 miss_match = false;
klauss 114:472502b31a12 742 debug_wdt = true;
klauss 114:472502b31a12 743 }
klauss 114:472502b31a12 744
klauss 114:472502b31a12 745 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "eth" ) ){
klauss 114:472502b31a12 746 miss_match = false;
klauss 114:472502b31a12 747 debug_eth = true;
klauss 114:472502b31a12 748 }
klauss 114:472502b31a12 749
klauss 119:ee6a53069455 750 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "deleted" ) ) {
klauss 119:ee6a53069455 751 miss_match = false;
klauss 124:c1b6c893e1c3 752 send_msg("::deleted_sip [ %5i ]::", deleted_sip );
klauss 119:ee6a53069455 753 }
klauss 119:ee6a53069455 754
klauss 119:ee6a53069455 755 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "types" ) ) {
klauss 114:472502b31a12 756 miss_match = false;
klauss 119:ee6a53069455 757
klauss 119:ee6a53069455 758 if( debug_uart3 && !( from_eth ) ) 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" );
klauss 119:ee6a53069455 759
klauss 119:ee6a53069455 760 if( from_eth ) {
klauss 119:ee6a53069455 761 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "hex :: 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");
klauss 119:ee6a53069455 762 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 763 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 764 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 765 } else if( udp_query ) {
klauss 119:ee6a53069455 766 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 767 }
klauss 105:a930035b6556 768 }
klauss 105:a930035b6556 769 }
klauss 114:472502b31a12 770
klauss 114:472502b31a12 771 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "protocol" ) ){
klauss 119:ee6a53069455 772 miss_match = false;
klauss 119:ee6a53069455 773
klauss 119:ee6a53069455 774 if( debug_uart3 && !( from_eth ) ) 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" );
klauss 119:ee6a53069455 775
klauss 119:ee6a53069455 776 if( from_eth ) {
klauss 119:ee6a53069455 777 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "| 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");
klauss 119:ee6a53069455 778 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 779 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 780 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 781 } else if( udp_query ) {
klauss 119:ee6a53069455 782 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 783 }
klauss 109:a5b8264ffbbc 784 }
klauss 109:a5b8264ffbbc 785 }
klauss 114:472502b31a12 786
klauss 114:472502b31a12 787 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "flood ", 6 ) ){
klauss 114:472502b31a12 788 if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on", 2 ) ){
klauss 109:a5b8264ffbbc 789 miss_match = false;
klauss 114:472502b31a12 790 if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r");
klauss 114:472502b31a12 791 if( from_eth ){
klauss 119:ee6a53069455 792 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood On\n\r" );
klauss 109:a5b8264ffbbc 793 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 794 }
klauss 109:a5b8264ffbbc 795 tflood.start();
klauss 109:a5b8264ffbbc 796 tflood.reset();
klauss 109:a5b8264ffbbc 797 floodcount =0;
klauss 109:a5b8264ffbbc 798 pflood = 1;
klauss 109:a5b8264ffbbc 799 flood_timeout.start();
klauss 109:a5b8264ffbbc 800 }
klauss 114:472502b31a12 801
klauss 114:472502b31a12 802 if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "more", 4 ) ){
klauss 109:a5b8264ffbbc 803 miss_match = false;
klauss 114:472502b31a12 804 if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r");
klauss 114:472502b31a12 805 if( from_eth ){
klauss 119:ee6a53069455 806 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood On\n\r" );
klauss 114:472502b31a12 807 //debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 109:a5b8264ffbbc 808 }
klauss 109:a5b8264ffbbc 809 tflood.start();
klauss 109:a5b8264ffbbc 810 tflood.reset();
klauss 109:a5b8264ffbbc 811 floodcount = 0;
klauss 109:a5b8264ffbbc 812 pflood = 1;
klauss 109:a5b8264ffbbc 813 }
klauss 114:472502b31a12 814
klauss 109:a5b8264ffbbc 815 if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off", 3 )) {
klauss 104:62646ef786a3 816 miss_match = false;
klauss 114:472502b31a12 817 if( debug_uart3 ) pc.printf("\n\rFlood OFF\n\r");
klauss 114:472502b31a12 818 if( from_eth ){
klauss 119:ee6a53069455 819 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood Off\n\r" );
klauss 104:62646ef786a3 820 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 109:a5b8264ffbbc 821 }
klauss 109:a5b8264ffbbc 822 pflood = 0;
klauss 109:a5b8264ffbbc 823 tflood.stop();
klauss 109:a5b8264ffbbc 824 flood_timeout.reset();
klauss 109:a5b8264ffbbc 825 }
klauss 119:ee6a53069455 826
klauss 119:ee6a53069455 827 }
klauss 119:ee6a53069455 828
klauss 119:ee6a53069455 829 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "silence ", 8 ) ){
klauss 109:a5b8264ffbbc 830 miss_match = false;
klauss 109:a5b8264ffbbc 831 char *ref, *split;
klauss 119:ee6a53069455 832
klauss 109:a5b8264ffbbc 833 strcpy( promptcb_last_cmd, debug_buf );
klauss 119:ee6a53069455 834
klauss 119:ee6a53069455 835 if( !( strcmp( debug_buf + 8, "-h" ) && strcmp( debug_buf + 8, "--help" ) ) ) {
klauss 119:ee6a53069455 836 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rUsage :: silence start_ext end_ext | start_ext must be greater than end_ext\n\rObs : ( end_ext - start_ext ) < 50 ");
klauss 119:ee6a53069455 837
klauss 119:ee6a53069455 838 if( from_eth ) {
klauss 119:ee6a53069455 839 snprintf( debug_buf, 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 ");
klauss 119:ee6a53069455 840 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 841 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 842 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 843 } else if( udp_query ) {
klauss 119:ee6a53069455 844 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 845 }
klauss 109:a5b8264ffbbc 846 }
klauss 119:ee6a53069455 847 } else {
klauss 109:a5b8264ffbbc 848 ref = debug_buf;
klauss 119:ee6a53069455 849
klauss 109:a5b8264ffbbc 850 split = strtok( debug_buf + 8, " " );
klauss 119:ee6a53069455 851
klauss 109:a5b8264ffbbc 852 start_ext = atoi( split );
klauss 119:ee6a53069455 853
klauss 109:a5b8264ffbbc 854 split += strlen( split ) + 1;
klauss 119:ee6a53069455 855
klauss 109:a5b8264ffbbc 856 end_ext = atoi( split );
klauss 119:ee6a53069455 857
klauss 109:a5b8264ffbbc 858 debug_buf = ref;
klauss 119:ee6a53069455 859
klauss 119:ee6a53069455 860 if( start_ext < end_ext && ( end_ext - start_ext ) < 50 ) {
klauss 109:a5b8264ffbbc 861 if( start_ext % 2 ) start_ext--;
klauss 109:a5b8264ffbbc 862 if( !( end_ext % 2 ) ) end_ext++;
klauss 119:ee6a53069455 863
klauss 109:a5b8264ffbbc 864 ext_count = start_ext;
klauss 109:a5b8264ffbbc 865 flood_silence_timer.start();
klauss 119:ee6a53069455 866 } else {
klauss 119:ee6a53069455 867 if( debug_uart3 && !( from_eth ) ) 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 ");
klauss 119:ee6a53069455 868
klauss 119:ee6a53069455 869 if( from_eth ) {
klauss 119:ee6a53069455 870 snprintf( debug_buf, 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 ");
klauss 119:ee6a53069455 871 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 872 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 873 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 874 } else if( udp_query ) {
klauss 119:ee6a53069455 875 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 876 }
klauss 105:a930035b6556 877 }
klauss 104:62646ef786a3 878 }
klauss 109:a5b8264ffbbc 879 flood_silence = true;
klauss 104:62646ef786a3 880 }
klauss 104:62646ef786a3 881 }
klauss 114:472502b31a12 882
klauss 114:472502b31a12 883 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug ",6 ) ){
klauss 109:a5b8264ffbbc 884 if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on",2 )) {
klauss 109:a5b8264ffbbc 885 miss_match = false;
klauss 119:ee6a53069455 886 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDebug ON\n\r");
klauss 119:ee6a53069455 887 if( from_eth ) {
klauss 119:ee6a53069455 888 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug On\n\r");
klauss 109:a5b8264ffbbc 889 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 890 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 891 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 892 } else if( udp_query ) {
klauss 119:ee6a53069455 893 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 894 }
klauss 109:a5b8264ffbbc 895 }
klauss 109:a5b8264ffbbc 896 debug_alive = true;
klauss 109:a5b8264ffbbc 897 }
klauss 109:a5b8264ffbbc 898 if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off",3 )) {
klauss 109:a5b8264ffbbc 899 miss_match = false;
klauss 119:ee6a53069455 900 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDebug OFF\n\r");
klauss 119:ee6a53069455 901 if( from_eth ) {
klauss 119:ee6a53069455 902 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Off\n\r");
klauss 109:a5b8264ffbbc 903 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 904 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 905 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 906 } else if( udp_query ) {
klauss 119:ee6a53069455 907 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 908 }
klauss 109:a5b8264ffbbc 909 }
klauss 109:a5b8264ffbbc 910 debug_alive = false;
klauss 109:a5b8264ffbbc 911 }
klauss 119:ee6a53069455 912 if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "show",4 ) ) {
klauss 100:09a23fcd3bdf 913 miss_match = false;
klauss 119:ee6a53069455 914 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdsip");
klauss 119:ee6a53069455 915 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_alive");
klauss 119:ee6a53069455 916 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_prompt");
klauss 119:ee6a53069455 917 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_vector");
klauss 119:ee6a53069455 918 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb");
klauss 119:ee6a53069455 919 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_main");
klauss 119:ee6a53069455 920 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdcks");
klauss 119:ee6a53069455 921 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb_rx");
klauss 119:ee6a53069455 922 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb_tx*");
klauss 119:ee6a53069455 923 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_eth_rx*");
klauss 119:ee6a53069455 924 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_eth_tx*");
klauss 119:ee6a53069455 925 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_file");
klauss 109:a5b8264ffbbc 926
klauss 119:ee6a53069455 927 if( from_eth ) {
klauss 119:ee6a53069455 928 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");
klauss 100:09a23fcd3bdf 929 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 930 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 931 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 932 } else if( udp_query ) {
klauss 119:ee6a53069455 933 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 934 }
klauss 109:a5b8264ffbbc 935 }
klauss 109:a5b8264ffbbc 936 }
klauss 109:a5b8264ffbbc 937 }
klauss 114:472502b31a12 938
klauss 114:472502b31a12 939 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dsip ", 5 ) ){
klauss 119:ee6a53069455 940 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ) {
klauss 109:a5b8264ffbbc 941 miss_match = false;
klauss 119:ee6a53069455 942 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rSip Debug ON\n\r" );
klauss 119:ee6a53069455 943 if( from_eth ) {
klauss 119:ee6a53069455 944 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Sip Debug On\n\r");
klauss 109:a5b8264ffbbc 945 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 946 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 947 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 948 } else if( udp_query ) {
klauss 119:ee6a53069455 949 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 950 }
klauss 109:a5b8264ffbbc 951 }
klauss 109:a5b8264ffbbc 952 debug_sip = true;
klauss 109:a5b8264ffbbc 953 }
klauss 109:a5b8264ffbbc 954 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) {
klauss 109:a5b8264ffbbc 955 miss_match = false;
klauss 119:ee6a53069455 956 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rSip Debug OFF\n\r" );
klauss 119:ee6a53069455 957 if( from_eth ) {
klauss 119:ee6a53069455 958 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Sip Debug Off\n\r");
klauss 109:a5b8264ffbbc 959 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 960 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 961 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 962 } else if( udp_query ) {
klauss 119:ee6a53069455 963 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 964 }
klauss 109:a5b8264ffbbc 965 }
klauss 109:a5b8264ffbbc 966 debug_sip = false;
klauss 109:a5b8264ffbbc 967 }
klauss 109:a5b8264ffbbc 968 }
klauss 109:a5b8264ffbbc 969
klauss 124:c1b6c893e1c3 970
klauss 124:c1b6c893e1c3 971 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dhello ", 7 ) ){
klauss 124:c1b6c893e1c3 972 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 124:c1b6c893e1c3 973 miss_match = false;
klauss 124:c1b6c893e1c3 974 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rHello Debug ON\n\r" );
klauss 124:c1b6c893e1c3 975 if( from_eth ) {
klauss 124:c1b6c893e1c3 976 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Hello Debug On\n\r");
klauss 124:c1b6c893e1c3 977 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 978 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 979 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 980 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 981 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 982 }
klauss 124:c1b6c893e1c3 983 }
klauss 124:c1b6c893e1c3 984 debug_hello = true;
klauss 124:c1b6c893e1c3 985 }
klauss 124:c1b6c893e1c3 986 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 124:c1b6c893e1c3 987 miss_match = false;
klauss 124:c1b6c893e1c3 988 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rHello Debug OFF\n\r" );
klauss 124:c1b6c893e1c3 989 if( from_eth ) {
klauss 124:c1b6c893e1c3 990 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Hello Debug Off\n\r");
klauss 124:c1b6c893e1c3 991 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 992 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 993 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 994 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 995 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 996 }
klauss 124:c1b6c893e1c3 997 }
klauss 124:c1b6c893e1c3 998 debug_hello = false;
klauss 124:c1b6c893e1c3 999 }
klauss 124:c1b6c893e1c3 1000 }
klauss 124:c1b6c893e1c3 1001
klauss 122:480c44b0e205 1002 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmissedwdt ", 11 ) ){
klauss 122:480c44b0e205 1003 if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "on", 2 ) ) {
klauss 122:480c44b0e205 1004 miss_match = false;
klauss 122:480c44b0e205 1005 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt missed Debug ON\n\r" );
klauss 122:480c44b0e205 1006 if( from_eth ) {
klauss 122:480c44b0e205 1007 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt missed Debug On\n\r");
klauss 122:480c44b0e205 1008 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 122:480c44b0e205 1009 if( tcp_session && !udp_query ) {
klauss 122:480c44b0e205 1010 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 122:480c44b0e205 1011 } else if( udp_query ) {
klauss 122:480c44b0e205 1012 udp_query_send_msg( debug_buf );
klauss 122:480c44b0e205 1013 }
klauss 122:480c44b0e205 1014 }
klauss 122:480c44b0e205 1015 dmissed_wdt = true;
klauss 122:480c44b0e205 1016 }
klauss 122:480c44b0e205 1017 if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "off",3 )) {
klauss 122:480c44b0e205 1018 miss_match = false;
klauss 122:480c44b0e205 1019 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt missed Debug OFF\n\r" );
klauss 122:480c44b0e205 1020 if( from_eth ) {
klauss 122:480c44b0e205 1021 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt missed Debug Off\n\r");
klauss 122:480c44b0e205 1022 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 122:480c44b0e205 1023 if( tcp_session && !udp_query ) {
klauss 122:480c44b0e205 1024 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 122:480c44b0e205 1025 } else if( udp_query ) {
klauss 122:480c44b0e205 1026 udp_query_send_msg( debug_buf );
klauss 122:480c44b0e205 1027 }
klauss 122:480c44b0e205 1028 }
klauss 122:480c44b0e205 1029 dmissed_wdt = false;
klauss 122:480c44b0e205 1030 }
klauss 122:480c44b0e205 1031 }
klauss 122:480c44b0e205 1032
klauss 119:ee6a53069455 1033 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dclock ", 7 ) ){
klauss 119:ee6a53069455 1034 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1035 miss_match = false;
klauss 119:ee6a53069455 1036 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rClock Debug ON\n\r" );
klauss 119:ee6a53069455 1037 if( from_eth ) {
klauss 119:ee6a53069455 1038 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Clock Debug On\n\r");
klauss 119:ee6a53069455 1039 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1040 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1041 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1042 } else if( udp_query ) {
klauss 119:ee6a53069455 1043 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1044 }
klauss 119:ee6a53069455 1045 }
klauss 119:ee6a53069455 1046 debug_clock = true;
klauss 119:ee6a53069455 1047 }
klauss 119:ee6a53069455 1048 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 119:ee6a53069455 1049 miss_match = false;
klauss 119:ee6a53069455 1050 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rClock Debug OFF\n\r" );
klauss 119:ee6a53069455 1051 if( from_eth ) {
klauss 119:ee6a53069455 1052 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Clock Debug Off\n\r");
klauss 119:ee6a53069455 1053 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1054 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1055 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1056 } else if( udp_query ) {
klauss 119:ee6a53069455 1057 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1058 }
klauss 119:ee6a53069455 1059 }
klauss 119:ee6a53069455 1060 debug_clock = false;
klauss 119:ee6a53069455 1061 }
klauss 119:ee6a53069455 1062 }
klauss 119:ee6a53069455 1063
klauss 119:ee6a53069455 1064 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dlength ", 8 ) ){
klauss 119:ee6a53069455 1065 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1066 miss_match = false;
klauss 119:ee6a53069455 1067 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rString length debug ON\n\r" );
klauss 119:ee6a53069455 1068 if( from_eth ) {
klauss 119:ee6a53069455 1069 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "String length debug On\n\r");
klauss 119:ee6a53069455 1070 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1071 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1072 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1073 } else if( udp_query ) {
klauss 119:ee6a53069455 1074 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1075 }
klauss 119:ee6a53069455 1076 }
klauss 119:ee6a53069455 1077 debug_string_length = true;
klauss 119:ee6a53069455 1078 }
klauss 119:ee6a53069455 1079 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 )) {
klauss 119:ee6a53069455 1080 miss_match = false;
klauss 119:ee6a53069455 1081 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rString length debug OFF\n\r" );
klauss 119:ee6a53069455 1082 if( from_eth ) {
klauss 119:ee6a53069455 1083 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "String length debug Off\n\r");
klauss 119:ee6a53069455 1084 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1085 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1086 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1087 } else if( udp_query ) {
klauss 119:ee6a53069455 1088 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1089 }
klauss 119:ee6a53069455 1090 }
klauss 119:ee6a53069455 1091 debug_string_length = false;
klauss 119:ee6a53069455 1092 }
klauss 119:ee6a53069455 1093 }
klauss 119:ee6a53069455 1094
klauss 119:ee6a53069455 1095 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dbind ", 6 ) ){
klauss 119:ee6a53069455 1096 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) {
klauss 109:a5b8264ffbbc 1097 miss_match = false;
klauss 119:ee6a53069455 1098 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rUDP Bind Debug ON\n\r" );
klauss 119:ee6a53069455 1099 if( from_eth ) {
klauss 119:ee6a53069455 1100 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "UDP Bind Debug On\n\r");
klauss 119:ee6a53069455 1101 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1102 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1103 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1104 } else if( udp_query ) {
klauss 119:ee6a53069455 1105 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1106 }
klauss 119:ee6a53069455 1107 }
klauss 119:ee6a53069455 1108 debug_bind = true;
klauss 119:ee6a53069455 1109 }
klauss 119:ee6a53069455 1110 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) {
klauss 119:ee6a53069455 1111 miss_match = false;
klauss 119:ee6a53069455 1112 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rUDP Bind Debug OFF\n\r" );
klauss 119:ee6a53069455 1113 if( from_eth ) {
klauss 119:ee6a53069455 1114 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "UDP Bind Debug Off\n\r");
klauss 119:ee6a53069455 1115 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1116 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1117 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1118 } else if( udp_query ) {
klauss 119:ee6a53069455 1119 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1120 }
klauss 119:ee6a53069455 1121 }
klauss 119:ee6a53069455 1122 debug_bind = false;
klauss 119:ee6a53069455 1123 }
klauss 119:ee6a53069455 1124 }
klauss 119:ee6a53069455 1125
klauss 119:ee6a53069455 1126 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dresetrtp ", 10 ) ) {
klauss 119:ee6a53069455 1127 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1128 miss_match = false;
klauss 119:ee6a53069455 1129 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReset RTP Debug ON\n\r" );
klauss 119:ee6a53069455 1130 if( from_eth ) {
klauss 119:ee6a53069455 1131 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reset RTP Debug On\n\r");
klauss 109:a5b8264ffbbc 1132 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1133 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1134 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1135 } else if( udp_query ) {
klauss 119:ee6a53069455 1136 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1137 }
klauss 119:ee6a53069455 1138 }
klauss 119:ee6a53069455 1139 debug_reset_rtp = true;
klauss 119:ee6a53069455 1140 }
klauss 119:ee6a53069455 1141 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 )) {
klauss 119:ee6a53069455 1142 miss_match = false;
klauss 119:ee6a53069455 1143 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReset RTP Debug OFF\n\r" );
klauss 119:ee6a53069455 1144 if( from_eth ) {
klauss 119:ee6a53069455 1145 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reset RTP Debug Off\n\r");
klauss 119:ee6a53069455 1146 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1147 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1148 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1149 } else if( udp_query ) {
klauss 119:ee6a53069455 1150 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1151 }
klauss 119:ee6a53069455 1152 }
klauss 119:ee6a53069455 1153 debug_reset_rtp = false;
klauss 119:ee6a53069455 1154 }
klauss 119:ee6a53069455 1155 }
klauss 119:ee6a53069455 1156
klauss 119:ee6a53069455 1157 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "duart ", 6 ) ) {
klauss 119:ee6a53069455 1158 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1159 miss_match = false;
klauss 119:ee6a53069455 1160 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rEnable UART3 usage\n\r" );
klauss 119:ee6a53069455 1161 if( from_eth ) {
klauss 119:ee6a53069455 1162 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Enable UART3 usage\n\r");
klauss 119:ee6a53069455 1163 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1164 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1165 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1166 } else if( udp_query ) {
klauss 119:ee6a53069455 1167 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1168 }
klauss 100:09a23fcd3bdf 1169 }
klauss 100:09a23fcd3bdf 1170 debug_uart3 = true;
klauss 100:09a23fcd3bdf 1171 }
klauss 100:09a23fcd3bdf 1172 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) {
klauss 100:09a23fcd3bdf 1173 miss_match = false;
klauss 119:ee6a53069455 1174 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDisable UART3 usage\n\r" );
klauss 119:ee6a53069455 1175 if( from_eth ) {
klauss 119:ee6a53069455 1176 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Disable UART3 usage\n\r");
klauss 100:09a23fcd3bdf 1177 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1178 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1179 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1180 } else if( udp_query ) {
klauss 119:ee6a53069455 1181 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1182 }
klauss 100:09a23fcd3bdf 1183 }
klauss 100:09a23fcd3bdf 1184 debug_uart3 = false;
klauss 100:09a23fcd3bdf 1185 }
klauss 100:09a23fcd3bdf 1186 }
klauss 114:472502b31a12 1187
klauss 114:472502b31a12 1188 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dprint ", 7 ) ){
klauss 114:472502b31a12 1189 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ){
klauss 114:472502b31a12 1190 miss_match = false;
klauss 114:472502b31a12 1191 if( debug_uart3 ) pc.printf( "\n\rDebug print On\n\r" );
klauss 114:472502b31a12 1192 if( from_eth ){
klauss 119:ee6a53069455 1193 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug print On\n\r" );
klauss 114:472502b31a12 1194 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 1195 }
klauss 114:472502b31a12 1196 print_values = true;
klauss 114:472502b31a12 1197 }
klauss 114:472502b31a12 1198 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 98:43b45f26b430 1199 miss_match = false;
klauss 114:472502b31a12 1200 if( debug_uart3 ) pc.printf( "\n\rDebug print Off\n\r" );
klauss 114:472502b31a12 1201 if( from_eth ){
klauss 119:ee6a53069455 1202 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug print Off\n\r" );
klauss 98:43b45f26b430 1203 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 114:472502b31a12 1204 }
klauss 114:472502b31a12 1205 print_values = false;
klauss 114:472502b31a12 1206 }
klauss 114:472502b31a12 1207 }
klauss 114:472502b31a12 1208
klauss 119:ee6a53069455 1209 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmissed ", 8 ) ) {
klauss 119:ee6a53069455 1210 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1211 miss_match = false;
klauss 119:ee6a53069455 1212 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDebug Missed ON\n\r" );
klauss 119:ee6a53069455 1213 if( from_eth ) {
klauss 119:ee6a53069455 1214 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Missed ON\n\r");
klauss 119:ee6a53069455 1215 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1216 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1217 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1218 } else if( udp_query ) {
klauss 119:ee6a53069455 1219 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1220 }
klauss 119:ee6a53069455 1221 }
klauss 119:ee6a53069455 1222 debug_missed = true;
klauss 119:ee6a53069455 1223 }
klauss 119:ee6a53069455 1224 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off", 3 )) {
klauss 119:ee6a53069455 1225 miss_match = false;
klauss 119:ee6a53069455 1226 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDebug Missed Off\n\r" );
klauss 119:ee6a53069455 1227 if( from_eth ) {
klauss 119:ee6a53069455 1228 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Missed Off\n\r");
klauss 119:ee6a53069455 1229 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1230 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1231 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1232 } else if( udp_query ) {
klauss 119:ee6a53069455 1233 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1234 }
klauss 119:ee6a53069455 1235 }
klauss 119:ee6a53069455 1236 debug_missed = false;
klauss 119:ee6a53069455 1237 }
klauss 119:ee6a53069455 1238 }
klauss 119:ee6a53069455 1239
klauss 119:ee6a53069455 1240 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dreconnect ", 11 ) ) {
klauss 119:ee6a53069455 1241 if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "on", 2 ) ) {
klauss 114:472502b31a12 1242 miss_match = false;
klauss 119:ee6a53069455 1243 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReconnecet Debug ON\n\r" );
klauss 119:ee6a53069455 1244 if( from_eth ) {
klauss 119:ee6a53069455 1245 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reconnecet Debug On\n\r");
klauss 119:ee6a53069455 1246 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1247 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1248 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1249 } else if( udp_query ) {
klauss 119:ee6a53069455 1250 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1251 }
klauss 119:ee6a53069455 1252 }
klauss 119:ee6a53069455 1253 debug_reconnect = true;
klauss 119:ee6a53069455 1254 }
klauss 119:ee6a53069455 1255 if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "off", 3 )) {
klauss 119:ee6a53069455 1256 miss_match = false;
klauss 119:ee6a53069455 1257 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReconnecet Debug OFF\n\r" );
klauss 119:ee6a53069455 1258 if( from_eth ) {
klauss 119:ee6a53069455 1259 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reconnecet Debug Off\n\r");
klauss 114:472502b31a12 1260 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1261 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1262 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1263 } else if( udp_query ) {
klauss 119:ee6a53069455 1264 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1265 }
klauss 119:ee6a53069455 1266 }
klauss 119:ee6a53069455 1267 debug_reconnect = false;
klauss 119:ee6a53069455 1268 }
klauss 119:ee6a53069455 1269 }
klauss 119:ee6a53069455 1270
klauss 119:ee6a53069455 1271 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmatch ", 7 ) ) {
klauss 119:ee6a53069455 1272 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1273 miss_match = false;
klauss 119:ee6a53069455 1274 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPort Match Debug ON\n\r" );
klauss 119:ee6a53069455 1275 if( from_eth ) {
klauss 119:ee6a53069455 1276 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Port Match Debug On\n\r");
klauss 119:ee6a53069455 1277 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1278 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1279 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1280 } else if( udp_query ) {
klauss 119:ee6a53069455 1281 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1282 }
klauss 98:43b45f26b430 1283 }
klauss 98:43b45f26b430 1284 debug_port_match = true;
klauss 98:43b45f26b430 1285 }
klauss 98:43b45f26b430 1286 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 98:43b45f26b430 1287 miss_match = false;
klauss 119:ee6a53069455 1288 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPort Match Debug OFF\n\r" );
klauss 119:ee6a53069455 1289 if( from_eth ) {
klauss 119:ee6a53069455 1290 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Port Match Debug Off\n\r");
klauss 98:43b45f26b430 1291 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1292 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1293 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1294 } else if( udp_query ) {
klauss 119:ee6a53069455 1295 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1296 }
klauss 98:43b45f26b430 1297 }
klauss 98:43b45f26b430 1298 debug_port_match = false;
klauss 98:43b45f26b430 1299 }
klauss 98:43b45f26b430 1300 }
klauss 114:472502b31a12 1301
klauss 119:ee6a53069455 1302
klauss 119:ee6a53069455 1303 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmuted ", 7 ) ) {
klauss 119:ee6a53069455 1304 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 81:3656f00ab3db 1305 miss_match = false;
klauss 119:ee6a53069455 1306 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rMuted Debug ON\n\r" );
klauss 119:ee6a53069455 1307 if( from_eth ) {
klauss 119:ee6a53069455 1308 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Muted Debug On\n\r");
klauss 81:3656f00ab3db 1309 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1310 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1311 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1312 } else if( udp_query ) {
klauss 119:ee6a53069455 1313 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1314 }
klauss 81:3656f00ab3db 1315 }
klauss 81:3656f00ab3db 1316 debug_muted = true;
klauss 81:3656f00ab3db 1317 }
klauss 81:3656f00ab3db 1318 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 81:3656f00ab3db 1319 miss_match = false;
klauss 119:ee6a53069455 1320 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rMuted Debug OFF\n\r" );
klauss 119:ee6a53069455 1321 if( from_eth ) {
klauss 119:ee6a53069455 1322 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Muted Debug Off\n\r");
klauss 81:3656f00ab3db 1323 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1324 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1325 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1326 } else if( udp_query ) {
klauss 119:ee6a53069455 1327 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1328 }
klauss 81:3656f00ab3db 1329 }
klauss 81:3656f00ab3db 1330 debug_muted = false;
klauss 81:3656f00ab3db 1331 }
klauss 81:3656f00ab3db 1332 }
klauss 114:472502b31a12 1333
klauss 119:ee6a53069455 1334 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwdt ", 5 ) ) {
klauss 119:ee6a53069455 1335 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ) {
klauss 81:3656f00ab3db 1336 miss_match = false;
klauss 119:ee6a53069455 1337 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt Debug ON\n\r" );
klauss 119:ee6a53069455 1338 if( from_eth ) {
klauss 119:ee6a53069455 1339 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt Debug On\n\r");
klauss 81:3656f00ab3db 1340 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1341 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1342 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1343 } else if( udp_query ) {
klauss 119:ee6a53069455 1344 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1345 }
klauss 81:3656f00ab3db 1346 }
klauss 81:3656f00ab3db 1347 wdt_show = true;
klauss 81:3656f00ab3db 1348 }
klauss 81:3656f00ab3db 1349 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) {
klauss 81:3656f00ab3db 1350 miss_match = false;
klauss 119:ee6a53069455 1351 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt Debug OFF\n\r" );
klauss 119:ee6a53069455 1352 if( from_eth ) {
klauss 119:ee6a53069455 1353 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt Debug Off\n\r");
klauss 81:3656f00ab3db 1354 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1355 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1356 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1357 } else if( udp_query ) {
klauss 119:ee6a53069455 1358 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1359 }
klauss 81:3656f00ab3db 1360 }
klauss 81:3656f00ab3db 1361 wdt_show = false;
klauss 81:3656f00ab3db 1362 }
klauss 81:3656f00ab3db 1363 }
klauss 114:472502b31a12 1364
klauss 119:ee6a53069455 1365 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drefresh ", 9 ) ) {
klauss 119:ee6a53069455 1366 if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ) {
klauss 81:3656f00ab3db 1367 miss_match = false;
klauss 119:ee6a53069455 1368 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRefresh Debug ON\n\r" );
klauss 119:ee6a53069455 1369 if( from_eth ) {
klauss 119:ee6a53069455 1370 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Refresh Debug On\n\r");
klauss 81:3656f00ab3db 1371 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1372 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1373 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1374 } else if( udp_query ) {
klauss 119:ee6a53069455 1375 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1376 }
klauss 81:3656f00ab3db 1377 }
klauss 81:3656f00ab3db 1378 debug_refresh= true;
klauss 81:3656f00ab3db 1379 }
klauss 81:3656f00ab3db 1380 if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off",3 )) {
klauss 81:3656f00ab3db 1381 miss_match = false;
klauss 119:ee6a53069455 1382 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRefresh Debug OFF\n\r" );
klauss 119:ee6a53069455 1383 if( from_eth ) {
klauss 119:ee6a53069455 1384 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Refresh Debug Off\n\r");
klauss 81:3656f00ab3db 1385 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1386 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1387 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1388 } else if( udp_query ) {
klauss 119:ee6a53069455 1389 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1390 }
klauss 81:3656f00ab3db 1391 }
klauss 81:3656f00ab3db 1392 debug_refresh = false;
klauss 81:3656f00ab3db 1393 }
klauss 81:3656f00ab3db 1394 }
klauss 114:472502b31a12 1395
klauss 119:ee6a53069455 1396 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dping ", 6 ) ) {
klauss 119:ee6a53069455 1397 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1398 miss_match = false;
klauss 119:ee6a53069455 1399 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPing Debug ON\n\r" );
klauss 119:ee6a53069455 1400 if( from_eth ) {
klauss 119:ee6a53069455 1401 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Ping Debug On\n\r");
klauss 78:1353744f01e1 1402 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1403 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1404 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1405 } else if( udp_query ) {
klauss 119:ee6a53069455 1406 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1407 }
klauss 78:1353744f01e1 1408 }
klauss 78:1353744f01e1 1409 debug_ping = true;
klauss 78:1353744f01e1 1410 }
klauss 78:1353744f01e1 1411 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) {
klauss 78:1353744f01e1 1412 miss_match = false;
klauss 119:ee6a53069455 1413 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPing Debug OFF\n\r" );
klauss 119:ee6a53069455 1414 if( from_eth ) {
klauss 119:ee6a53069455 1415 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Ping Debug Off\n\r");
klauss 78:1353744f01e1 1416 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1417 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1418 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1419 } else if( udp_query ) {
klauss 119:ee6a53069455 1420 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1421 }
klauss 78:1353744f01e1 1422 }
klauss 78:1353744f01e1 1423 debug_ping= false;
klauss 78:1353744f01e1 1424 }
klauss 78:1353744f01e1 1425 }
klauss 114:472502b31a12 1426
klauss 119:ee6a53069455 1427 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwu ", 4 ) ) {
klauss 119:ee6a53069455 1428 if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1429 miss_match = false;
klauss 119:ee6a53069455 1430 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWake Up Debug ON\n\r" );
klauss 119:ee6a53069455 1431 if( from_eth ) {
klauss 119:ee6a53069455 1432 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wake Up Debug On\n\r");
klauss 78:1353744f01e1 1433 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1434 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1435 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1436 } else if( udp_query ) {
klauss 119:ee6a53069455 1437 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1438 }
klauss 78:1353744f01e1 1439 }
klauss 78:1353744f01e1 1440 debug_wake = true;
klauss 78:1353744f01e1 1441 }
klauss 78:1353744f01e1 1442 if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "off",3 )) {
klauss 78:1353744f01e1 1443 miss_match = false;
klauss 119:ee6a53069455 1444 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWake Up Debug OFF\n\r" );
klauss 119:ee6a53069455 1445 if( from_eth ) {
klauss 119:ee6a53069455 1446 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wake Up Debug Off\n\r");
klauss 78:1353744f01e1 1447 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1448 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1449 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1450 } else if( udp_query ) {
klauss 119:ee6a53069455 1451 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1452 }
klauss 78:1353744f01e1 1453 }
klauss 78:1353744f01e1 1454 debug_wake = false;
klauss 78:1353744f01e1 1455 }
klauss 78:1353744f01e1 1456 }
klauss 114:472502b31a12 1457
klauss 119:ee6a53069455 1458 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "tcp_alive ", 10 ) ) {
klauss 119:ee6a53069455 1459 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1460 miss_match = false;
klauss 119:ee6a53069455 1461 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTCP don't drop mode on\n\r" );
klauss 119:ee6a53069455 1462 if( from_eth ) {
klauss 119:ee6a53069455 1463 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "TCP don't drop mode on\n\r");
klauss 78:1353744f01e1 1464 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1465 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1466 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1467 } else if( udp_query ) {
klauss 119:ee6a53069455 1468 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1469 }
klauss 78:1353744f01e1 1470 }
klauss 78:1353744f01e1 1471 tcp_alive = true;
klauss 78:1353744f01e1 1472 }
klauss 78:1353744f01e1 1473 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 )) {
klauss 78:1353744f01e1 1474 miss_match = false;
klauss 119:ee6a53069455 1475 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTCP don't drop mode off\n\r" );
klauss 119:ee6a53069455 1476 if( from_eth ) {
klauss 119:ee6a53069455 1477 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "TCP don't drop mode off\n\r");
klauss 78:1353744f01e1 1478 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1479 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1480 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1481 } else if( udp_query ) {
klauss 119:ee6a53069455 1482 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1483 }
klauss 78:1353744f01e1 1484 }
klauss 78:1353744f01e1 1485 tcp_alive = false;
klauss 78:1353744f01e1 1486 }
klauss 78:1353744f01e1 1487 }
klauss 114:472502b31a12 1488
klauss 119:ee6a53069455 1489 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "daging ",7 ) ) {
klauss 119:ee6a53069455 1490 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1491 miss_match = false;
klauss 119:ee6a53069455 1492 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rAging Debug ON\n\r" );
klauss 119:ee6a53069455 1493 if( from_eth ) {
klauss 119:ee6a53069455 1494 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Aging Debug On\n\r");
klauss 78:1353744f01e1 1495 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1496 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1497 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1498 } else if( udp_query ) {
klauss 119:ee6a53069455 1499 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1500 }
klauss 78:1353744f01e1 1501 }
klauss 78:1353744f01e1 1502 debug_aging = true;
klauss 78:1353744f01e1 1503 }
klauss 78:1353744f01e1 1504 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) {
klauss 78:1353744f01e1 1505 miss_match = false;
klauss 119:ee6a53069455 1506 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rAging Debug OFF\n\r" );
klauss 119:ee6a53069455 1507 if( from_eth ) {
klauss 119:ee6a53069455 1508 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Aging Debug Off\n\r");
klauss 78:1353744f01e1 1509 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1510 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1511 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1512 } else if( udp_query ) {
klauss 119:ee6a53069455 1513 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1514 }
klauss 78:1353744f01e1 1515 }
klauss 78:1353744f01e1 1516 debug_aging = false;
klauss 78:1353744f01e1 1517 }
klauss 78:1353744f01e1 1518 }
klauss 114:472502b31a12 1519
klauss 119:ee6a53069455 1520 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcpld ", 6 ) ) {
klauss 119:ee6a53069455 1521 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1522 miss_match = false;
klauss 119:ee6a53069455 1523 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Debug ON\n\r" );
klauss 119:ee6a53069455 1524 if( from_eth ) {
klauss 119:ee6a53069455 1525 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Debug On\n\r");
klauss 78:1353744f01e1 1526 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1527 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1528 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1529 } else if( udp_query ) {
klauss 119:ee6a53069455 1530 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1531 }
klauss 78:1353744f01e1 1532 }
klauss 78:1353744f01e1 1533 debug_cpld = true;
klauss 119:ee6a53069455 1534 debug_cb_rx = true;
klauss 119:ee6a53069455 1535 debug_cb_tx = true;
klauss 78:1353744f01e1 1536 }
klauss 119:ee6a53069455 1537 if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 ) ) {
klauss 78:1353744f01e1 1538 miss_match = false;
klauss 119:ee6a53069455 1539 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Debug OFF\n\r" );
klauss 119:ee6a53069455 1540 if( from_eth ) {
klauss 119:ee6a53069455 1541 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Debug Off\n\r");
klauss 78:1353744f01e1 1542 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1543 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1544 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1545 } else if( udp_query ) {
klauss 119:ee6a53069455 1546 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1547 }
klauss 78:1353744f01e1 1548 }
klauss 78:1353744f01e1 1549 debug_cpld = false;
klauss 119:ee6a53069455 1550 debug_cb_rx = false;
klauss 119:ee6a53069455 1551 debug_cb_tx = false;
klauss 78:1353744f01e1 1552 }
klauss 78:1353744f01e1 1553 }
klauss 78:1353744f01e1 1554
klauss 124:c1b6c893e1c3 1555 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtxshow ", 8 ) ) {
klauss 124:c1b6c893e1c3 1556 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) {
klauss 124:c1b6c893e1c3 1557 miss_match = false;
klauss 124:c1b6c893e1c3 1558 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show TX Debug ON\n\r" );
klauss 124:c1b6c893e1c3 1559 if( from_eth ) {
klauss 124:c1b6c893e1c3 1560 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show TX Debug On\n\r");
klauss 124:c1b6c893e1c3 1561 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 1562 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1563 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 1564 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1565 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 1566 }
klauss 124:c1b6c893e1c3 1567 }
klauss 124:c1b6c893e1c3 1568 debug_show_tx_cpld = true;
klauss 124:c1b6c893e1c3 1569 }
klauss 124:c1b6c893e1c3 1570 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 ) ) {
klauss 124:c1b6c893e1c3 1571 miss_match = false;
klauss 124:c1b6c893e1c3 1572 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show TX Debug OFF\n\r" );
klauss 124:c1b6c893e1c3 1573 if( from_eth ) {
klauss 124:c1b6c893e1c3 1574 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show TX Debug Off\n\r");
klauss 124:c1b6c893e1c3 1575 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 1576 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1577 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 1578 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1579 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 1580 }
klauss 124:c1b6c893e1c3 1581 }
klauss 124:c1b6c893e1c3 1582 debug_show_tx_cpld = false;
klauss 124:c1b6c893e1c3 1583 }
klauss 124:c1b6c893e1c3 1584 }
klauss 124:c1b6c893e1c3 1585
klauss 124:c1b6c893e1c3 1586 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dshowcpld ", 10 ) ) {
klauss 119:ee6a53069455 1587 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1588 miss_match = false;
klauss 119:ee6a53069455 1589 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show Debug ON\n\r" );
klauss 119:ee6a53069455 1590 if( from_eth ) {
klauss 119:ee6a53069455 1591 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show Debug On\n\r");
klauss 119:ee6a53069455 1592 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1593 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1594 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1595 } else if( udp_query ) {
klauss 119:ee6a53069455 1596 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1597 }
klauss 119:ee6a53069455 1598 }
klauss 124:c1b6c893e1c3 1599 debug_show_tx_cpld = true;
klauss 124:c1b6c893e1c3 1600 debug_show_rx_cpld = true;
klauss 119:ee6a53069455 1601 }
klauss 119:ee6a53069455 1602 if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 ) ) {
klauss 113:db67ae00550e 1603 miss_match = false;
klauss 119:ee6a53069455 1604 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show Debug OFF\n\r" );
klauss 119:ee6a53069455 1605 if( from_eth ) {
klauss 119:ee6a53069455 1606 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show Debug Off\n\r");
klauss 105:a930035b6556 1607 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1608 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1609 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1610 } else if( udp_query ) {
klauss 119:ee6a53069455 1611 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1612 }
klauss 119:ee6a53069455 1613 }
klauss 124:c1b6c893e1c3 1614 debug_show_tx_cpld = false;
klauss 124:c1b6c893e1c3 1615 debug_show_rx_cpld = false;
klauss 119:ee6a53069455 1616 }
klauss 119:ee6a53069455 1617 }
klauss 124:c1b6c893e1c3 1618
klauss 119:ee6a53069455 1619
klauss 124:c1b6c893e1c3 1620 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drxshow ", 8 ) ) {
klauss 124:c1b6c893e1c3 1621 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) {
klauss 124:c1b6c893e1c3 1622 miss_match = false;
klauss 124:c1b6c893e1c3 1623 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show RX Debug ON\n\r" );
klauss 124:c1b6c893e1c3 1624 if( from_eth ) {
klauss 124:c1b6c893e1c3 1625 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show RX Debug On\n\r");
klauss 124:c1b6c893e1c3 1626 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 1627 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1628 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 1629 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1630 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 1631 }
klauss 124:c1b6c893e1c3 1632 }
klauss 124:c1b6c893e1c3 1633 debug_show_rx_cpld = true;
klauss 124:c1b6c893e1c3 1634 }
klauss 124:c1b6c893e1c3 1635 if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 ) ) {
klauss 124:c1b6c893e1c3 1636 miss_match = false;
klauss 124:c1b6c893e1c3 1637 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show RX Debug OFF\n\r" );
klauss 124:c1b6c893e1c3 1638 if( from_eth ) {
klauss 124:c1b6c893e1c3 1639 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show RX Debug Off\n\r");
klauss 124:c1b6c893e1c3 1640 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 124:c1b6c893e1c3 1641 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1642 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 124:c1b6c893e1c3 1643 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1644 udp_query_send_msg( debug_buf );
klauss 124:c1b6c893e1c3 1645 }
klauss 124:c1b6c893e1c3 1646 }
klauss 124:c1b6c893e1c3 1647 debug_show_rx_cpld = false;
klauss 124:c1b6c893e1c3 1648 }
klauss 124:c1b6c893e1c3 1649 }
klauss 119:ee6a53069455 1650
klauss 119:ee6a53069455 1651 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks_err ", 9 ) ){
klauss 119:ee6a53069455 1652 if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ) {
klauss 119:ee6a53069455 1653 miss_match = false;
klauss 119:ee6a53069455 1654 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rCKS_ERR Debug ON\n\r" );
klauss 119:ee6a53069455 1655 if( from_eth ) {
klauss 119:ee6a53069455 1656 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS_ERR Debug On\n\r");
klauss 119:ee6a53069455 1657 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1658 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1659 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1660 } else if( udp_query ) {
klauss 119:ee6a53069455 1661 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1662 }
klauss 78:1353744f01e1 1663 }
klauss 78:1353744f01e1 1664 debug_cks_err = true;
klauss 78:1353744f01e1 1665 }
klauss 119:ee6a53069455 1666 if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off", 3 ) ) {
klauss 78:1353744f01e1 1667 miss_match = false;
klauss 119:ee6a53069455 1668 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rCKS_ERR Debug OFF\n\r" );
klauss 119:ee6a53069455 1669 if( from_eth ) {
klauss 119:ee6a53069455 1670 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS_ERR Debug off\n\r");
klauss 78:1353744f01e1 1671 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1672 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1673 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1674 } else if( udp_query ) {
klauss 119:ee6a53069455 1675 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1676 }
klauss 78:1353744f01e1 1677 }
klauss 78:1353744f01e1 1678 debug_cks_err = false;
klauss 78:1353744f01e1 1679 }
klauss 78:1353744f01e1 1680 }
klauss 114:472502b31a12 1681
klauss 114:472502b31a12 1682 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dinvite ", 8 ) ){
klauss 119:ee6a53069455 1683 if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) {
klauss 78:1353744f01e1 1684 miss_match = false;
klauss 119:ee6a53069455 1685 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rInvite Debug ON\n\r" );
klauss 119:ee6a53069455 1686 if( from_eth ) {
klauss 119:ee6a53069455 1687 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Invite Debug On\n\r");
klauss 78:1353744f01e1 1688 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1689 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1690 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1691 } else if( udp_query ) {
klauss 119:ee6a53069455 1692 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1693 }
klauss 78:1353744f01e1 1694 }
klauss 81:3656f00ab3db 1695 debug_invite = true;
klauss 78:1353744f01e1 1696 }
klauss 78:1353744f01e1 1697 if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 )) {
klauss 78:1353744f01e1 1698 miss_match = false;
klauss 119:ee6a53069455 1699 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rInvite Debug OFF\n\r" );
klauss 119:ee6a53069455 1700 if( from_eth ) {
klauss 119:ee6a53069455 1701 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Invite Debug Off\n\r");
klauss 78:1353744f01e1 1702 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1703 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1704 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1705 } else if( udp_query ) {
klauss 119:ee6a53069455 1706 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1707 }
klauss 78:1353744f01e1 1708 }
klauss 78:1353744f01e1 1709 debug_invite = 0;
klauss 45:c80574f24dc3 1710 }
klauss 45:c80574f24dc3 1711 }
klauss 114:472502b31a12 1712
klauss 119:ee6a53069455 1713 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dparallel ", 10 ) ) {
klauss 119:ee6a53069455 1714 if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t * )"on", 2 ) ) {
klauss 72:895ca792c647 1715 miss_match = false;
klauss 119:ee6a53069455 1716 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rParallel Write Debug ON\n\r" );
klauss 119:ee6a53069455 1717 if( from_eth ) {
klauss 119:ee6a53069455 1718 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rParallel Write Debug ON\n\r");
klauss 72:895ca792c647 1719 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1720 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1721 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1722 } else if( udp_query ) {
klauss 119:ee6a53069455 1723 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1724 }
klauss 72:895ca792c647 1725 }
klauss 72:895ca792c647 1726 dparallel = true;
klauss 72:895ca792c647 1727 }
klauss 72:895ca792c647 1728 if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t *)"off", 3 )) {
klauss 72:895ca792c647 1729 miss_match = false;
klauss 119:ee6a53069455 1730 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rParallel Write Debug OFF\n\r" );
klauss 119:ee6a53069455 1731 if( from_eth ) {
klauss 119:ee6a53069455 1732 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rParallel Write Debug Off\n\r");
klauss 72:895ca792c647 1733 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1734 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1735 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1736 } else if( udp_query ) {
klauss 119:ee6a53069455 1737 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1738 }
klauss 72:895ca792c647 1739 }
klauss 72:895ca792c647 1740 dparallel = false;
klauss 72:895ca792c647 1741 }
klauss 72:895ca792c647 1742 }
klauss 119:ee6a53069455 1743 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtelos ", 7 ) ) {
klauss 119:ee6a53069455 1744 if (xmemmatch( (uint8_t*)( debug_buf + 7 ), (uint8_t*) "on", 2 ) ) {
klauss 53:bb492a8f115a 1745 miss_match = false;
klauss 119:ee6a53069455 1746 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTelemetry Debug ON\n\r" );
klauss 119:ee6a53069455 1747 if( from_eth ) {
klauss 119:ee6a53069455 1748 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rTelemetry Debug On\n\r");
klauss 53:bb492a8f115a 1749 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1750 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1751 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1752 } else if( udp_query ) {
klauss 119:ee6a53069455 1753 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1754 }
klauss 53:bb492a8f115a 1755 }
klauss 53:bb492a8f115a 1756 debug_telemetry = true;
klauss 53:bb492a8f115a 1757 }
klauss 78:1353744f01e1 1758 if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off", 3 )) {
klauss 53:bb492a8f115a 1759 miss_match = false;
klauss 119:ee6a53069455 1760 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTelemetry Debug OFF\n\r" );
klauss 119:ee6a53069455 1761 if( from_eth ) {
klauss 119:ee6a53069455 1762 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rTelemetry Debug Off\n\r");
klauss 53:bb492a8f115a 1763 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 1764 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 1765 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 1766 } else if( udp_query ) {
klauss 119:ee6a53069455 1767 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 1768 }
klauss 53:bb492a8f115a 1769 }
klauss 53:bb492a8f115a 1770 debug_telemetry = false;
klauss 53:bb492a8f115a 1771 }
klauss 53:bb492a8f115a 1772 }
klauss 114:472502b31a12 1773
klauss 124:c1b6c893e1c3 1774 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks ", 5 ) )
klauss 124:c1b6c893e1c3 1775 {
klauss 114:472502b31a12 1776 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on",2 ) ){
klauss 45:c80574f24dc3 1777 miss_match = false;
klauss 114:472502b31a12 1778 if( debug_uart3 ) pc.printf( "\n\rCKS Debug ON\n\r" );
klauss 114:472502b31a12 1779 if( from_eth ){
klauss 119:ee6a53069455 1780 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS Debug On\n\r" );
klauss 45:c80574f24dc3 1781 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 45:c80574f24dc3 1782 }
klauss 78:1353744f01e1 1783 debug_cks = true;
klauss 45:c80574f24dc3 1784 }
klauss 50:d9b6577a70f5 1785 if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) {
klauss 45:c80574f24dc3 1786 miss_match = false;
klauss 114:472502b31a12 1787 if( debug_uart3 ) pc.printf( "\n\rCKS Debug OFF\n\r" );
klauss 114:472502b31a12 1788 if( from_eth ){
klauss 119:ee6a53069455 1789 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS Debug Off\n\r" );
klauss 45:c80574f24dc3 1790 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 45:c80574f24dc3 1791 }
klauss 78:1353744f01e1 1792 debug_cks = false;
klauss 45:c80574f24dc3 1793 }
klauss 45:c80574f24dc3 1794 }
klauss 114:472502b31a12 1795
klauss 124:c1b6c893e1c3 1796 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "cc ", 3 ) )
klauss 124:c1b6c893e1c3 1797 {
klauss 124:c1b6c893e1c3 1798 miss_match = false;
klauss 124:c1b6c893e1c3 1799 int ext,port;
klauss 124:c1b6c893e1c3 1800 char *split, *ref, *cmd;
klauss 124:c1b6c893e1c3 1801
klauss 124:c1b6c893e1c3 1802 ref = debug_buf;
klauss 124:c1b6c893e1c3 1803
klauss 124:c1b6c893e1c3 1804 strcat( debug_buf, "\r" );
klauss 124:c1b6c893e1c3 1805
klauss 124:c1b6c893e1c3 1806 split = strtok( debug_buf + 3, " " );
klauss 124:c1b6c893e1c3 1807 ext = atoi( split );
klauss 124:c1b6c893e1c3 1808
klauss 124:c1b6c893e1c3 1809 port = ext;
klauss 124:c1b6c893e1c3 1810
klauss 124:c1b6c893e1c3 1811 split += strlen( split ) + 1;
klauss 124:c1b6c893e1c3 1812 cmd = split;
klauss 124:c1b6c893e1c3 1813
klauss 124:c1b6c893e1c3 1814 promptcb_last_ext = ext;
klauss 124:c1b6c893e1c3 1815 promptcb_last_port = port;
klauss 124:c1b6c893e1c3 1816
klauss 124:c1b6c893e1c3 1817 strcpy( promptcb_last_cmd, cmd );
klauss 124:c1b6c893e1c3 1818
klauss 124:c1b6c893e1c3 1819 for ( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd [ i ] = 0;
klauss 124:c1b6c893e1c3 1820
klauss 124:c1b6c893e1c3 1821 if ( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd );
klauss 124:c1b6c893e1c3 1822
klauss 124:c1b6c893e1c3 1823 send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 124:c1b6c893e1c3 1824
klauss 124:c1b6c893e1c3 1825 if ( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 124:c1b6c893e1c3 1826
klauss 124:c1b6c893e1c3 1827 if( from_eth ) {
klauss 124:c1b6c893e1c3 1828 char eth_msg[ 512 ];
klauss 124:c1b6c893e1c3 1829 snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r> ", ext, port, cmd );
klauss 124:c1b6c893e1c3 1830 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1831 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 124:c1b6c893e1c3 1832 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1833 udp_query_send_msg( eth_msg );
klauss 124:c1b6c893e1c3 1834 }
klauss 124:c1b6c893e1c3 1835 }
klauss 124:c1b6c893e1c3 1836
klauss 124:c1b6c893e1c3 1837 debug_buf = ref;
klauss 124:c1b6c893e1c3 1838 bufptr = 0;
klauss 124:c1b6c893e1c3 1839 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 124:c1b6c893e1c3 1840 }
klauss 124:c1b6c893e1c3 1841
klauss 124:c1b6c893e1c3 1842 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "bc ", 3 ) )
klauss 124:c1b6c893e1c3 1843 {
klauss 124:c1b6c893e1c3 1844 miss_match = false;
klauss 124:c1b6c893e1c3 1845
klauss 124:c1b6c893e1c3 1846 strcat( debug_buf, "\r" );
klauss 124:c1b6c893e1c3 1847
klauss 124:c1b6c893e1c3 1848 char * cmd = debug_buf + 3;
klauss 124:c1b6c893e1c3 1849
klauss 124:c1b6c893e1c3 1850 for ( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd [ i ] = 0;
klauss 124:c1b6c893e1c3 1851
klauss 124:c1b6c893e1c3 1852 if ( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%x port=%x cmd=%s", BROADCAST_EXT, BROADCAST_EXT, cmd );
klauss 124:c1b6c893e1c3 1853
klauss 124:c1b6c893e1c3 1854 send2callboxes ( build_cb_package( BROADCAST_EXT, BROADCAST_EXT, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 124:c1b6c893e1c3 1855
klauss 124:c1b6c893e1c3 1856 if ( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 124:c1b6c893e1c3 1857
klauss 124:c1b6c893e1c3 1858 if( from_eth ) {
klauss 124:c1b6c893e1c3 1859 char eth_msg[ 512 ];
klauss 124:c1b6c893e1c3 1860 snprintf( eth_msg, 512 - 1, "\r\next=%x port=%x cmd=%s\r\nComando enviado\n\r> ", BROADCAST_EXT, BROADCAST_EXT, cmd );
klauss 124:c1b6c893e1c3 1861 if( tcp_session && !udp_query ) {
klauss 124:c1b6c893e1c3 1862 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 124:c1b6c893e1c3 1863 } else if( udp_query ) {
klauss 124:c1b6c893e1c3 1864 udp_query_send_msg( eth_msg );
klauss 124:c1b6c893e1c3 1865 }
klauss 124:c1b6c893e1c3 1866 }
klauss 124:c1b6c893e1c3 1867
klauss 124:c1b6c893e1c3 1868 bufptr = 0;
klauss 124:c1b6c893e1c3 1869 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf [ i ] = 0;
klauss 124:c1b6c893e1c3 1870 }
klauss 124:c1b6c893e1c3 1871
klauss 124:c1b6c893e1c3 1872
klauss 119:ee6a53069455 1873 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "pcb ", 4 )) {
klauss 78:1353744f01e1 1874 miss_match = false;
klauss 78:1353744f01e1 1875 int ext,port;
klauss 78:1353744f01e1 1876 char *split, *ref, *cmd;
klauss 119:ee6a53069455 1877
klauss 78:1353744f01e1 1878 ref = debug_buf;
klauss 119:ee6a53069455 1879
klauss 78:1353744f01e1 1880 strcat( debug_buf, "\r" );
klauss 119:ee6a53069455 1881
klauss 119:ee6a53069455 1882 split = strtok( debug_buf + 4, " " );
klauss 78:1353744f01e1 1883 ext = atoi( split );
klauss 119:ee6a53069455 1884
klauss 119:ee6a53069455 1885 port = convert_ext_to_port( ext );
klauss 78:1353744f01e1 1886 split += strlen( split ) + 1;
klauss 78:1353744f01e1 1887 cmd = split;
klauss 119:ee6a53069455 1888
klauss 78:1353744f01e1 1889 promptcb_last_ext = ext;
klauss 78:1353744f01e1 1890 promptcb_last_port = port;
klauss 119:ee6a53069455 1891
klauss 78:1353744f01e1 1892 strcpy( promptcb_last_cmd, cmd );
klauss 119:ee6a53069455 1893
klauss 119:ee6a53069455 1894 for( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd[ i ] = 0;
klauss 119:ee6a53069455 1895
klauss 119:ee6a53069455 1896 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd );
klauss 119:ee6a53069455 1897 send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 119:ee6a53069455 1898 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 119:ee6a53069455 1899
klauss 119:ee6a53069455 1900 if( from_eth ) {
klauss 78:1353744f01e1 1901 char eth_msg[ 512 ];
klauss 119:ee6a53069455 1902 snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r> ", ext, port, cmd );
klauss 119:ee6a53069455 1903 if( tcp_session && !udp_query ) {
klauss 78:1353744f01e1 1904 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 119:ee6a53069455 1905 } else if( udp_query ) {
klauss 119:ee6a53069455 1906 udp_query_send_msg( eth_msg );
klauss 78:1353744f01e1 1907 }
klauss 78:1353744f01e1 1908 }
klauss 119:ee6a53069455 1909
klauss 78:1353744f01e1 1910 debug_buf = ref;
klauss 78:1353744f01e1 1911 bufptr = 0;
klauss 119:ee6a53069455 1912 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 78:1353744f01e1 1913 }
klauss 114:472502b31a12 1914
klauss 123:1d395b5a4cad 1915 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "pend_all" ) )
klauss 123:1d395b5a4cad 1916 {
klauss 123:1d395b5a4cad 1917 miss_match = false;
klauss 123:1d395b5a4cad 1918
klauss 123:1d395b5a4cad 1919 char cmd_msg [ CB_BUFFER_SIZE ] = "pend\r";
klauss 123:1d395b5a4cad 1920
klauss 123:1d395b5a4cad 1921 for( register int i = strlen( cmd_msg ); i < DEBUGBUFSIZE; i++ ) cmd_msg [ i ] = 0;
klauss 123:1d395b5a4cad 1922
klauss 123:1d395b5a4cad 1923 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%x port=%x cmd=%s", BROADCAST_EXT, BROADCAST_EXT, cmd_msg );
klauss 123:1d395b5a4cad 1924
klauss 123:1d395b5a4cad 1925 send2callboxes( build_cb_package( BROADCAST_EXT, BROADCAST_EXT, PROMPT, cmd_msg, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 123:1d395b5a4cad 1926
klauss 123:1d395b5a4cad 1927 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 123:1d395b5a4cad 1928
klauss 123:1d395b5a4cad 1929 if( from_eth ) {
klauss 123:1d395b5a4cad 1930 char eth_msg[ 512 ];
klauss 123:1d395b5a4cad 1931 snprintf( eth_msg, 512 - 1, "\r\next=%x port=%x cmd=%s\r\nComando enviado\n\r> ", BROADCAST_EXT, BROADCAST_EXT, cmd_msg );
klauss 123:1d395b5a4cad 1932 if( tcp_session && !udp_query ) {
klauss 123:1d395b5a4cad 1933 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 123:1d395b5a4cad 1934 } else if( udp_query ) {
klauss 123:1d395b5a4cad 1935 udp_query_send_msg( eth_msg );
klauss 123:1d395b5a4cad 1936 }
klauss 123:1d395b5a4cad 1937 }
klauss 123:1d395b5a4cad 1938
klauss 123:1d395b5a4cad 1939 bufptr = 0;
klauss 123:1d395b5a4cad 1940 for ( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf [ i ] = 0;
klauss 123:1d395b5a4cad 1941 }
klauss 123:1d395b5a4cad 1942
klauss 124:c1b6c893e1c3 1943 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "bye ", 4 ) )
klauss 124:c1b6c893e1c3 1944 {
klauss 92:92df17f538a8 1945 miss_match = false;
klauss 92:92df17f538a8 1946 int ext,port;
klauss 124:c1b6c893e1c3 1947 char * ref;
klauss 124:c1b6c893e1c3 1948
klauss 92:92df17f538a8 1949 ref = debug_buf;
klauss 124:c1b6c893e1c3 1950
klauss 124:c1b6c893e1c3 1951 strcat( debug_buf, "\r" );
klauss 124:c1b6c893e1c3 1952
klauss 124:c1b6c893e1c3 1953 ext = atoi( strtok( debug_buf + 4, " " ) );
klauss 124:c1b6c893e1c3 1954
klauss 124:c1b6c893e1c3 1955 port = ext;
klauss 124:c1b6c893e1c3 1956
klauss 124:c1b6c893e1c3 1957 promptcb_last_ext = ext;
klauss 124:c1b6c893e1c3 1958 promptcb_last_port = port;
klauss 114:472502b31a12 1959
klauss 124:c1b6c893e1c3 1960 char msg[] = "bye";
klauss 124:c1b6c893e1c3 1961
klauss 124:c1b6c893e1c3 1962 if ( debug_uart3 && !( from_eth ) ) pc.printf("\r\nSend BYE to ext=%d port=%d", ext, port );
klauss 124:c1b6c893e1c3 1963
klauss 124:c1b6c893e1c3 1964 send2callboxes ( build_cb_package( ext, port, CB_BYE, msg, ( id_msg++ & ~BIT7 ), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 114:472502b31a12 1965
klauss 124:c1b6c893e1c3 1966 if ( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 124:c1b6c893e1c3 1967
klauss 124:c1b6c893e1c3 1968 if( from_eth ) {
klauss 92:92df17f538a8 1969 char eth_msg[ 512 ];
klauss 124:c1b6c893e1c3 1970 snprintf( eth_msg, 512 - 1, "\r\nSend BYE to ext=%d port=%d\r\nComando enviado\n\r> ", ext, port );
klauss 119:ee6a53069455 1971 if( tcp_session && !udp_query ) {
klauss 92:92df17f538a8 1972 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 119:ee6a53069455 1973 } else if( udp_query ) {
klauss 119:ee6a53069455 1974 udp_query_send_msg( eth_msg );
klauss 92:92df17f538a8 1975 }
klauss 92:92df17f538a8 1976 }
klauss 124:c1b6c893e1c3 1977
klauss 124:c1b6c893e1c3 1978 debug_buf = ref;
klauss 124:c1b6c893e1c3 1979 bufptr = 0;
klauss 124:c1b6c893e1c3 1980 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 124:c1b6c893e1c3 1981 }
klauss 124:c1b6c893e1c3 1982
klauss 124:c1b6c893e1c3 1983 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "end_call ", 9 ) )
klauss 124:c1b6c893e1c3 1984 {
klauss 124:c1b6c893e1c3 1985 miss_match = false;
klauss 124:c1b6c893e1c3 1986 char * ref;
klauss 124:c1b6c893e1c3 1987
klauss 124:c1b6c893e1c3 1988 ref = debug_buf;
klauss 124:c1b6c893e1c3 1989
klauss 124:c1b6c893e1c3 1990 end_call_ext = atoi( strtok( debug_buf + 9, " " ) );
klauss 124:c1b6c893e1c3 1991 end_call = true;
klauss 124:c1b6c893e1c3 1992
klauss 92:92df17f538a8 1993 debug_buf = ref;
klauss 92:92df17f538a8 1994 bufptr = 0;
klauss 119:ee6a53069455 1995 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 45:c80574f24dc3 1996 }
klauss 114:472502b31a12 1997
klauss 98:43b45f26b430 1998 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "pcc ", 4 )) {
klauss 98:43b45f26b430 1999 miss_match = false;
klauss 98:43b45f26b430 2000 int ext,port;
klauss 98:43b45f26b430 2001 char *split, *ref, *cmd;
klauss 119:ee6a53069455 2002
klauss 98:43b45f26b430 2003 ref = debug_buf;
klauss 119:ee6a53069455 2004
klauss 98:43b45f26b430 2005 strcat( debug_buf, "\r" );
klauss 119:ee6a53069455 2006
klauss 98:43b45f26b430 2007 split = strtok( debug_buf + 4, " " );
klauss 98:43b45f26b430 2008 ext = atoi( split );
klauss 119:ee6a53069455 2009
klauss 98:43b45f26b430 2010 split += strlen( split ) + 1;
klauss 98:43b45f26b430 2011 split = strtok( NULL, " " );
klauss 98:43b45f26b430 2012 port = atoi( split );
klauss 119:ee6a53069455 2013
klauss 98:43b45f26b430 2014 split += strlen( split ) + 1;
klauss 98:43b45f26b430 2015 cmd = split;
klauss 119:ee6a53069455 2016
klauss 98:43b45f26b430 2017 promptcb_last_ext = ext;
klauss 98:43b45f26b430 2018 promptcb_last_port = port;
klauss 119:ee6a53069455 2019
klauss 98:43b45f26b430 2020 strcpy( promptcb_last_cmd, cmd );
klauss 119:ee6a53069455 2021
klauss 119:ee6a53069455 2022 for( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd[ i ] = 0;
klauss 119:ee6a53069455 2023
klauss 119:ee6a53069455 2024 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd );
klauss 119:ee6a53069455 2025 send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 119:ee6a53069455 2026 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 119:ee6a53069455 2027
klauss 119:ee6a53069455 2028 if( from_eth ) {
klauss 98:43b45f26b430 2029 char eth_msg[ 512 ];
klauss 98:43b45f26b430 2030 snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r", ext, port, cmd );
klauss 119:ee6a53069455 2031 if( tcp_session && !udp_query ) {
klauss 98:43b45f26b430 2032 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 119:ee6a53069455 2033 } else if( udp_query ) {
klauss 119:ee6a53069455 2034 udp_query_send_msg( eth_msg );
klauss 98:43b45f26b430 2035 }
klauss 98:43b45f26b430 2036 }
klauss 119:ee6a53069455 2037
klauss 98:43b45f26b430 2038 debug_buf = ref;
klauss 98:43b45f26b430 2039 bufptr = 0;
klauss 119:ee6a53069455 2040 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2041 }
klauss 114:472502b31a12 2042
klauss 114:472502b31a12 2043 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_cb ", 9 )) {
klauss 114:472502b31a12 2044 miss_match = false;
klauss 114:472502b31a12 2045 char *split;
klauss 114:472502b31a12 2046
klauss 114:472502b31a12 2047 split = strtok( debug_buf + 9, " " );
klauss 114:472502b31a12 2048 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2049 {
klauss 114:472502b31a12 2050 print_cb_all = true;
klauss 114:472502b31a12 2051 }
klauss 114:472502b31a12 2052 else
klauss 114:472502b31a12 2053 {
klauss 114:472502b31a12 2054 print_cb_var = true;
klauss 114:472502b31a12 2055 print_this_cb = atoi( split );
klauss 114:472502b31a12 2056 }
klauss 114:472502b31a12 2057
klauss 114:472502b31a12 2058 bufptr = 0;
klauss 119:ee6a53069455 2059 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 119:ee6a53069455 2060 }
klauss 119:ee6a53069455 2061
klauss 119:ee6a53069455 2062 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drop_ack ", 9 )) {
klauss 119:ee6a53069455 2063 miss_match = false;
klauss 119:ee6a53069455 2064 char *split;
klauss 119:ee6a53069455 2065
klauss 119:ee6a53069455 2066 split = strtok( debug_buf + 9, " " );
klauss 119:ee6a53069455 2067
klauss 119:ee6a53069455 2068 drop_this_amount_of_ack_to_ast = atoi( split );
klauss 119:ee6a53069455 2069
klauss 119:ee6a53069455 2070 send_msg("Will be droped %d acks", drop_this_amount_of_ack_to_ast );
klauss 119:ee6a53069455 2071
klauss 119:ee6a53069455 2072 bufptr = 0;
klauss 119:ee6a53069455 2073 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2074 }
klauss 114:472502b31a12 2075
klauss 114:472502b31a12 2076 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "frtp ", 5 )) {
klauss 114:472502b31a12 2077 miss_match = false;
klauss 114:472502b31a12 2078 char *split;
klauss 114:472502b31a12 2079
klauss 114:472502b31a12 2080 split = strtok( debug_buf + 5, " " );
klauss 114:472502b31a12 2081 frtp = true;
klauss 114:472502b31a12 2082 frtp_target = atoi( split );
klauss 114:472502b31a12 2083
klauss 114:472502b31a12 2084 bufptr = 0;
klauss 119:ee6a53069455 2085 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2086 }
klauss 114:472502b31a12 2087
klauss 114:472502b31a12 2088 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "rrtp ", 5 )) {
klauss 114:472502b31a12 2089 miss_match = false;
klauss 114:472502b31a12 2090 char *split;
klauss 114:472502b31a12 2091
klauss 114:472502b31a12 2092 split = strtok( debug_buf + 5, " " );
klauss 114:472502b31a12 2093 rescue_rtp = true;
klauss 114:472502b31a12 2094 rescue_rtp_target = atoi( split );
klauss 114:472502b31a12 2095
klauss 114:472502b31a12 2096 split += strlen( split ) + 1;
klauss 114:472502b31a12 2097 split = strtok( NULL, " " );
klauss 114:472502b31a12 2098 rescue_rtp_value = atoi( split );
klauss 114:472502b31a12 2099
klauss 114:472502b31a12 2100 bufptr = 0;
klauss 119:ee6a53069455 2101 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2102 }
klauss 114:472502b31a12 2103
klauss 114:472502b31a12 2104 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_cb ", 13 )) {
klauss 114:472502b31a12 2105 miss_match = false;
klauss 114:472502b31a12 2106 char *split;
klauss 114:472502b31a12 2107
klauss 114:472502b31a12 2108 split = strtok( debug_buf + 13, " " );
klauss 114:472502b31a12 2109 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2110 {
klauss 114:472502b31a12 2111 print_hex_cb_all = true;
klauss 114:472502b31a12 2112 }
klauss 114:472502b31a12 2113 else
klauss 114:472502b31a12 2114 {
klauss 114:472502b31a12 2115 print_hex_cb_var = true;
klauss 114:472502b31a12 2116 print_hex_this_cb = atoi( split );
klauss 114:472502b31a12 2117 }
klauss 114:472502b31a12 2118
klauss 114:472502b31a12 2119 bufptr = 0;
klauss 119:ee6a53069455 2120 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2121 }
klauss 114:472502b31a12 2122
klauss 114:472502b31a12 2123 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_sip ", 10 )) {
klauss 114:472502b31a12 2124 miss_match = false;
klauss 114:472502b31a12 2125 char *split;
klauss 114:472502b31a12 2126
klauss 114:472502b31a12 2127 split = strtok( debug_buf + 10, " " );
klauss 114:472502b31a12 2128 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2129 {
klauss 114:472502b31a12 2130 print_sip_all = true;
klauss 114:472502b31a12 2131 }
klauss 114:472502b31a12 2132 else
klauss 114:472502b31a12 2133 {
klauss 114:472502b31a12 2134 print_sip_var = true;
klauss 114:472502b31a12 2135 print_this_sip = atoi( split );
klauss 114:472502b31a12 2136 }
klauss 114:472502b31a12 2137
klauss 114:472502b31a12 2138 bufptr = 0;
klauss 119:ee6a53069455 2139 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 98:43b45f26b430 2140 }
klauss 114:472502b31a12 2141
klauss 114:472502b31a12 2142 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_sip ", 14 )) {
klauss 114:472502b31a12 2143 miss_match = false;
klauss 114:472502b31a12 2144 char *split;
klauss 114:472502b31a12 2145
klauss 114:472502b31a12 2146 split = strtok( debug_buf + 14, " " );
klauss 114:472502b31a12 2147 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2148 {
klauss 114:472502b31a12 2149 print_hex_sip_all = true;
klauss 114:472502b31a12 2150 }
klauss 114:472502b31a12 2151 else
klauss 114:472502b31a12 2152 {
klauss 114:472502b31a12 2153 print_hex_sip_var = true;
klauss 114:472502b31a12 2154 print_hex_this_sip = atoi( split );
klauss 114:472502b31a12 2155 }
klauss 114:472502b31a12 2156
klauss 114:472502b31a12 2157 bufptr = 0;
klauss 119:ee6a53069455 2158 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2159 }
klauss 114:472502b31a12 2160
klauss 114:472502b31a12 2161 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_call ", 11 ) )
klauss 114:472502b31a12 2162 {
klauss 114:472502b31a12 2163 miss_match = false;
klauss 114:472502b31a12 2164 char *split;
klauss 114:472502b31a12 2165
klauss 114:472502b31a12 2166 split = strtok( debug_buf + 11, " " );
klauss 114:472502b31a12 2167 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2168 {
klauss 114:472502b31a12 2169 print_call_all = true;
klauss 114:472502b31a12 2170 }
klauss 114:472502b31a12 2171 else
klauss 114:472502b31a12 2172 {
klauss 114:472502b31a12 2173 print_call_var = true;
klauss 114:472502b31a12 2174 print_this_call = atoi( split );
klauss 114:472502b31a12 2175 }
klauss 114:472502b31a12 2176
klauss 114:472502b31a12 2177 bufptr = 0;
klauss 119:ee6a53069455 2178 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2179 }
klauss 114:472502b31a12 2180
klauss 114:472502b31a12 2181 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_call ", 15 ) )
klauss 114:472502b31a12 2182 {
klauss 114:472502b31a12 2183 miss_match = false;
klauss 114:472502b31a12 2184 char *split;
klauss 114:472502b31a12 2185
klauss 114:472502b31a12 2186 split = strtok( debug_buf + 15, " " );
klauss 114:472502b31a12 2187 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2188 {
klauss 114:472502b31a12 2189 print_hex_call_all = true;
klauss 114:472502b31a12 2190 }
klauss 114:472502b31a12 2191 else
klauss 114:472502b31a12 2192 {
klauss 114:472502b31a12 2193 print_hex_call_var = true;
klauss 114:472502b31a12 2194 print_hex_this_call = atoi( split );
klauss 114:472502b31a12 2195 }
klauss 114:472502b31a12 2196
klauss 114:472502b31a12 2197 bufptr = 0;
klauss 119:ee6a53069455 2198 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2199 }
klauss 114:472502b31a12 2200
klauss 114:472502b31a12 2201 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_rtp ", 10 ) )
klauss 114:472502b31a12 2202 {
klauss 114:472502b31a12 2203 miss_match = false;
klauss 114:472502b31a12 2204 char *split;
klauss 114:472502b31a12 2205
klauss 114:472502b31a12 2206 split = strtok( debug_buf + 10, " " );
klauss 114:472502b31a12 2207 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2208 {
klauss 114:472502b31a12 2209 print_rtp_all = true;
klauss 114:472502b31a12 2210 }
klauss 114:472502b31a12 2211 else
klauss 114:472502b31a12 2212 {
klauss 114:472502b31a12 2213 print_rtp_var = true;
klauss 114:472502b31a12 2214 print_this_rtp = atoi( split );
klauss 114:472502b31a12 2215 }
klauss 114:472502b31a12 2216
klauss 114:472502b31a12 2217 bufptr = 0;
klauss 119:ee6a53069455 2218 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2219 }
klauss 114:472502b31a12 2220
klauss 114:472502b31a12 2221 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_rtp ", 14 ) )
klauss 114:472502b31a12 2222 {
klauss 114:472502b31a12 2223 miss_match = false;
klauss 114:472502b31a12 2224 char *split;
klauss 114:472502b31a12 2225
klauss 114:472502b31a12 2226 split = strtok( debug_buf + 14, " " );
klauss 114:472502b31a12 2227 if( 0 == ( strcasecmp( split, "all" ) ) )
klauss 114:472502b31a12 2228 {
klauss 114:472502b31a12 2229 print_hex_rtp_all = true;
klauss 114:472502b31a12 2230 }
klauss 114:472502b31a12 2231 else
klauss 114:472502b31a12 2232 {
klauss 114:472502b31a12 2233 print_hex_rtp_var = true;
klauss 114:472502b31a12 2234 print_hex_this_rtp = atoi( split );
klauss 114:472502b31a12 2235 }
klauss 114:472502b31a12 2236
klauss 114:472502b31a12 2237 bufptr = 0;
klauss 119:ee6a53069455 2238 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2239 }
klauss 114:472502b31a12 2240
klauss 114:472502b31a12 2241 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "log ", 4 )) {
klauss 114:472502b31a12 2242 miss_match = false;
klauss 114:472502b31a12 2243
klauss 114:472502b31a12 2244 char * split = strtok( debug_buf + 4, " " );
klauss 114:472502b31a12 2245
klauss 114:472502b31a12 2246 {
klauss 114:472502b31a12 2247 print_cb_var = true;
klauss 114:472502b31a12 2248 print_this_cb = atoi( split );
klauss 114:472502b31a12 2249 print_sip_var = true;
klauss 114:472502b31a12 2250 print_this_sip = print_this_cb;
klauss 114:472502b31a12 2251 print_call_var = true;
klauss 114:472502b31a12 2252 print_this_call = print_this_cb;
klauss 114:472502b31a12 2253 print_rtp_var = true;
klauss 114:472502b31a12 2254 print_this_rtp = print_this_cb;
klauss 114:472502b31a12 2255 }
klauss 114:472502b31a12 2256
klauss 114:472502b31a12 2257 bufptr = 0;
klauss 119:ee6a53069455 2258 for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 114:472502b31a12 2259 }
klauss 114:472502b31a12 2260
klauss 114:472502b31a12 2261
klauss 117:e9facba9db27 2262 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "rush ", 5 )) {
klauss 99:e80850c51106 2263 miss_match = false;
klauss 99:e80850c51106 2264 int ext,port;
klauss 99:e80850c51106 2265 char *split, *ref, cmd[ 32 ];
klauss 119:ee6a53069455 2266
klauss 99:e80850c51106 2267 ref = debug_buf;
klauss 119:ee6a53069455 2268
klauss 99:e80850c51106 2269 strcat( debug_buf, "\r" );
klauss 119:ee6a53069455 2270
klauss 99:e80850c51106 2271 split = strtok( debug_buf + 5, " " );
klauss 99:e80850c51106 2272 ext = atoi( split );
klauss 119:ee6a53069455 2273
klauss 99:e80850c51106 2274 split += strlen( split ) + 1;
klauss 99:e80850c51106 2275 split = strtok( NULL, " " );
klauss 99:e80850c51106 2276 port = atoi( split );
klauss 119:ee6a53069455 2277
klauss 99:e80850c51106 2278 strcpy( cmd, "ping\r\n" );
klauss 119:ee6a53069455 2279
klauss 99:e80850c51106 2280 promptcb_last_ext = ext;
klauss 99:e80850c51106 2281 promptcb_last_port = port;
klauss 119:ee6a53069455 2282
klauss 99:e80850c51106 2283 strcpy( promptcb_last_cmd, cmd );
klauss 99:e80850c51106 2284 strcat( cmd, "\r\r\r\n" );
klauss 119:ee6a53069455 2285
klauss 119:ee6a53069455 2286 for( register uint8_t i = 0; i < 3; i++ ) {
klauss 119:ee6a53069455 2287 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd );
klauss 119:ee6a53069455 2288 send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 119:ee6a53069455 2289 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado");
klauss 119:ee6a53069455 2290
klauss 119:ee6a53069455 2291 if( from_eth ) {
klauss 99:e80850c51106 2292 char eth_msg[ 512 ];
klauss 99:e80850c51106 2293 snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r", ext, port, cmd );
klauss 119:ee6a53069455 2294 if( tcp_session && !udp_query ) {
klauss 99:e80850c51106 2295 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 119:ee6a53069455 2296 } else if( udp_query ) {
klauss 119:ee6a53069455 2297 udp_query_send_msg( eth_msg );
klauss 99:e80850c51106 2298 }
klauss 99:e80850c51106 2299 }
klauss 99:e80850c51106 2300 }
klauss 119:ee6a53069455 2301
klauss 99:e80850c51106 2302 debug_buf = ref;
klauss 99:e80850c51106 2303 bufptr = 0;
klauss 119:ee6a53069455 2304 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 99:e80850c51106 2305 }
klauss 114:472502b31a12 2306
klauss 114:472502b31a12 2307
klauss 59:e1e300880d2d 2308 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "_pcb",4 )) {
klauss 45:c80574f24dc3 2309 miss_match = false;
klauss 48:195c97f12e8e 2310 debug_buf[ bufptr++ ] = 0x0D;
klauss 48:195c97f12e8e 2311 debug_buf[ bufptr++ ] = 0x00;
klauss 45:c80574f24dc3 2312
klauss 114:472502b31a12 2313 if( debug_uart3 ) pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n",promptcb_last_ext, promptcb_last_port, debug_buf + 4 );
klauss 119:ee6a53069455 2314 send2callboxes( build_cb_package( promptcb_last_ext, promptcb_last_port, PROMPT, debug_buf + 4, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 114:472502b31a12 2315 if( debug_uart3 ) pc.printf("\n\rComando enviado\n\r");
klauss 45:c80574f24dc3 2316 }
klauss 62:07e5bdc9f8f7 2317
klauss 58:af7e8788f106 2318 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "cks",3 )) {
klauss 45:c80574f24dc3 2319 miss_match = false;
klauss 81:3656f00ab3db 2320 pcks_s = true;
klauss 45:c80574f24dc3 2321 }
klauss 45:c80574f24dc3 2322
klauss 58:af7e8788f106 2323 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "showcb",6 )) {
klauss 45:c80574f24dc3 2324 miss_match = false;
klauss 81:3656f00ab3db 2325 pshowcb = true;
klauss 45:c80574f24dc3 2326 }
klauss 114:472502b31a12 2327
klauss 58:af7e8788f106 2328 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_main ", 11 )) {
klauss 81:3656f00ab3db 2329 if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on", 2 )) {
klauss 45:c80574f24dc3 2330 miss_match = false;
klauss 119:ee6a53069455 2331 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nDebug Main ON");
klauss 119:ee6a53069455 2332 if( from_eth ) {
klauss 119:ee6a53069455 2333 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Main On\n\r");
klauss 45:c80574f24dc3 2334 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2335 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2336 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2337 } else if( udp_query ) {
klauss 119:ee6a53069455 2338 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2339 }
klauss 45:c80574f24dc3 2340 }
klauss 81:3656f00ab3db 2341 debug_main = true;
klauss 45:c80574f24dc3 2342 }
klauss 81:3656f00ab3db 2343 if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off", 3 )) {
klauss 45:c80574f24dc3 2344 miss_match = false;
klauss 119:ee6a53069455 2345 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nDebug Main OFF");
klauss 119:ee6a53069455 2346 if( from_eth ) {
klauss 119:ee6a53069455 2347 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Main Off\n\r");
klauss 45:c80574f24dc3 2348 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2349 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2350 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2351 } else if( udp_query ) {
klauss 119:ee6a53069455 2352 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2353 }
klauss 45:c80574f24dc3 2354 }
klauss 45:c80574f24dc3 2355 debug_main = 0;
klauss 45:c80574f24dc3 2356 }
klauss 45:c80574f24dc3 2357 }
klauss 114:472502b31a12 2358
klauss 119:ee6a53069455 2359 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dout ", 5 ) ) {
klauss 119:ee6a53069455 2360 if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ) {
klauss 81:3656f00ab3db 2361 miss_match = false;
klauss 119:ee6a53069455 2362 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nOut Debug ON");
klauss 119:ee6a53069455 2363 if( from_eth ) {
klauss 119:ee6a53069455 2364 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Out Debug On\n\r");
klauss 81:3656f00ab3db 2365 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2366 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2367 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2368 } else if( udp_query ) {
klauss 119:ee6a53069455 2369 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2370 }
klauss 81:3656f00ab3db 2371 }
klauss 81:3656f00ab3db 2372 debug_out_of_range = true;
klauss 81:3656f00ab3db 2373 }
klauss 119:ee6a53069455 2374 if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ) {
klauss 81:3656f00ab3db 2375 miss_match = false;
klauss 119:ee6a53069455 2376 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nOut Debug OFF");
klauss 119:ee6a53069455 2377 if( from_eth ) {
klauss 119:ee6a53069455 2378 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Out Debug Off\n\r");
klauss 81:3656f00ab3db 2379 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2380 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2381 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2382 } else if( udp_query ) {
klauss 119:ee6a53069455 2383 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2384 }
klauss 81:3656f00ab3db 2385 }
klauss 81:3656f00ab3db 2386 debug_out_of_range = false;
klauss 81:3656f00ab3db 2387 }
klauss 81:3656f00ab3db 2388 }
klauss 114:472502b31a12 2389
klauss 121:ee02790d00b7 2390 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dboot ", 6 ) ) {
klauss 119:ee6a53069455 2391 if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "on", 2 ) ) {
klauss 99:e80850c51106 2392 miss_match = false;
klauss 119:ee6a53069455 2393 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nBoot Debug ON");
klauss 119:ee6a53069455 2394 if( from_eth ) {
klauss 119:ee6a53069455 2395 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Boot Debug On\n\r");
klauss 99:e80850c51106 2396 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2397 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2398 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2399 } else if( udp_query ) {
klauss 119:ee6a53069455 2400 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2401 }
klauss 99:e80850c51106 2402 }
klauss 99:e80850c51106 2403 debug_boot = true;
klauss 99:e80850c51106 2404 }
klauss 119:ee6a53069455 2405 if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "off", 3 ) ) {
klauss 99:e80850c51106 2406 miss_match = false;
klauss 119:ee6a53069455 2407 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nBoot Debug OFF");
klauss 119:ee6a53069455 2408 if( from_eth ) {
klauss 119:ee6a53069455 2409 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Boot Debug Off\n\r");
klauss 99:e80850c51106 2410 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2411 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2412 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2413 } else if( udp_query ) {
klauss 119:ee6a53069455 2414 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2415 }
klauss 99:e80850c51106 2416 }
klauss 99:e80850c51106 2417 debug_boot = false;
klauss 99:e80850c51106 2418 }
klauss 99:e80850c51106 2419 }
klauss 114:472502b31a12 2420
klauss 121:ee02790d00b7 2421 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dbloader ", 9 ) ) {
klauss 121:ee02790d00b7 2422 if (xmemmatch( (uint8_t*)( debug_buf + 9 ), (uint8_t*) "on", 2 ) ) {
klauss 121:ee02790d00b7 2423 miss_match = false;
klauss 121:ee02790d00b7 2424 if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rBootloader Debug ON\n\r" );
klauss 121:ee02790d00b7 2425 if( from_eth ) {
klauss 121:ee02790d00b7 2426 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Bootloader Debug On\n\r" );
klauss 121:ee02790d00b7 2427 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 121:ee02790d00b7 2428 if( tcp_session && !udp_query ) {
klauss 121:ee02790d00b7 2429 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 121:ee02790d00b7 2430 } else if( udp_query ) {
klauss 121:ee02790d00b7 2431 udp_query_send_msg( debug_buf );
klauss 121:ee02790d00b7 2432 }
klauss 121:ee02790d00b7 2433 }
klauss 121:ee02790d00b7 2434 debug_bootloader = true;
klauss 121:ee02790d00b7 2435 }
klauss 121:ee02790d00b7 2436 if (xmemmatch( (uint8_t*)( debug_buf + 9 ), (uint8_t*) "off", 3 ) ) {
klauss 121:ee02790d00b7 2437 miss_match = false;
klauss 121:ee02790d00b7 2438 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rBootloader Debug OFF\n\r");
klauss 121:ee02790d00b7 2439 if( from_eth ) {
klauss 121:ee02790d00b7 2440 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Bootloader Debug Off\n\r" );
klauss 121:ee02790d00b7 2441 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 121:ee02790d00b7 2442 if( tcp_session && !udp_query ) {
klauss 121:ee02790d00b7 2443 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 121:ee02790d00b7 2444 } else if( udp_query ) {
klauss 121:ee02790d00b7 2445 udp_query_send_msg( debug_buf );
klauss 121:ee02790d00b7 2446 }
klauss 121:ee02790d00b7 2447 }
klauss 121:ee02790d00b7 2448 debug_bootloader = false;
klauss 121:ee02790d00b7 2449 }
klauss 121:ee02790d00b7 2450 }
klauss 121:ee02790d00b7 2451
klauss 119:ee6a53069455 2452 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfw ", 4 ) ) {
klauss 119:ee6a53069455 2453 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on", 2 ) ) {
klauss 99:e80850c51106 2454 miss_match = false;
klauss 119:ee6a53069455 2455 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFW Debug ON");
klauss 119:ee6a53069455 2456 if( from_eth ) {
klauss 119:ee6a53069455 2457 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Debug On\n\r");
klauss 99:e80850c51106 2458 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2459 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2460 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2461 } else if( udp_query ) {
klauss 119:ee6a53069455 2462 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2463 }
klauss 99:e80850c51106 2464 }
klauss 99:e80850c51106 2465 debug_fw = true;
klauss 99:e80850c51106 2466 }
klauss 119:ee6a53069455 2467 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off", 3 ) ) {
klauss 99:e80850c51106 2468 miss_match = false;
klauss 119:ee6a53069455 2469 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFW Debug OFF");
klauss 119:ee6a53069455 2470 if( from_eth ) {
klauss 119:ee6a53069455 2471 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Debug Off\n\r");
klauss 99:e80850c51106 2472 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2473 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2474 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2475 } else if( udp_query ) {
klauss 119:ee6a53069455 2476 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2477 }
klauss 99:e80850c51106 2478 }
klauss 99:e80850c51106 2479 debug_fw = false;
klauss 99:e80850c51106 2480 }
klauss 99:e80850c51106 2481 }
klauss 114:472502b31a12 2482
klauss 119:ee6a53069455 2483 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfwp ", 5 ) ) {
klauss 119:ee6a53069455 2484 if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ) {
klauss 99:e80850c51106 2485 miss_match = false;
klauss 119:ee6a53069455 2486 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFWPrint Debug ON");
klauss 119:ee6a53069455 2487 if( from_eth ) {
klauss 119:ee6a53069455 2488 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FWPrint Debug On\n\r");
klauss 99:e80850c51106 2489 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2490 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2491 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2492 } else if( udp_query ) {
klauss 119:ee6a53069455 2493 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2494 }
klauss 99:e80850c51106 2495 }
klauss 99:e80850c51106 2496 debug_fw_print = true;
klauss 99:e80850c51106 2497 }
klauss 119:ee6a53069455 2498 if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ) {
klauss 99:e80850c51106 2499 miss_match = false;
klauss 119:ee6a53069455 2500 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFWPrint Debug OFF");
klauss 119:ee6a53069455 2501 if( from_eth ) {
klauss 119:ee6a53069455 2502 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FWPrint Debug Off\n\r");
klauss 99:e80850c51106 2503 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2504 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2505 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2506 } else if( udp_query ) {
klauss 119:ee6a53069455 2507 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2508 }
klauss 99:e80850c51106 2509 }
klauss 99:e80850c51106 2510 debug_fw_print = false;
klauss 99:e80850c51106 2511 }
klauss 99:e80850c51106 2512 }
klauss 114:472502b31a12 2513
klauss 99:e80850c51106 2514 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drx ", 4 )) {
klauss 99:e80850c51106 2515 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) {
klauss 45:c80574f24dc3 2516 miss_match = false;
klauss 119:ee6a53069455 2517 if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Rx ON");
klauss 119:ee6a53069455 2518 if( from_eth ) {
klauss 119:ee6a53069455 2519 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx On Rx on\n\r");
klauss 45:c80574f24dc3 2520 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2521 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2522 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2523 } else if( udp_query ) {
klauss 119:ee6a53069455 2524 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2525 }
klauss 45:c80574f24dc3 2526 }
klauss 81:3656f00ab3db 2527 debug_cb_rx = true;
klauss 45:c80574f24dc3 2528 }
klauss 99:e80850c51106 2529 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) {
klauss 45:c80574f24dc3 2530 miss_match = false;
klauss 119:ee6a53069455 2531 if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Rx OFF");
klauss 119:ee6a53069455 2532 if( from_eth ) {
klauss 119:ee6a53069455 2533 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx On Rx off\n\r");
klauss 45:c80574f24dc3 2534 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2535 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2536 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2537 } else if( udp_query ) {
klauss 119:ee6a53069455 2538 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2539 }
klauss 45:c80574f24dc3 2540 }
klauss 99:e80850c51106 2541 debug_cb_rx = false;
klauss 99:e80850c51106 2542 }
klauss 99:e80850c51106 2543 }
klauss 114:472502b31a12 2544
klauss 99:e80850c51106 2545 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtx ", 4 )) {
klauss 99:e80850c51106 2546 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) {
klauss 99:e80850c51106 2547 miss_match = false;
klauss 119:ee6a53069455 2548 if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Tx ON");
klauss 119:ee6a53069455 2549 if( from_eth ) {
klauss 119:ee6a53069455 2550 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx Tx on\n\r");
klauss 99:e80850c51106 2551 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2552 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2553 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2554 } else if( udp_query ) {
klauss 119:ee6a53069455 2555 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2556 }
klauss 99:e80850c51106 2557 }
klauss 99:e80850c51106 2558 debug_cb_tx = true;
klauss 99:e80850c51106 2559 }
klauss 99:e80850c51106 2560 if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) {
klauss 99:e80850c51106 2561 miss_match = false;
klauss 119:ee6a53069455 2562 if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Tx OFF");
klauss 119:ee6a53069455 2563 if( from_eth ) {
klauss 119:ee6a53069455 2564 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx Tx off\n\r");
klauss 99:e80850c51106 2565 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2566 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2567 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2568 } else if( udp_query ) {
klauss 119:ee6a53069455 2569 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2570 }
klauss 99:e80850c51106 2571 }
klauss 99:e80850c51106 2572 debug_cb_tx = false;
klauss 45:c80574f24dc3 2573 }
klauss 45:c80574f24dc3 2574 }
klauss 114:472502b31a12 2575
klauss 58:af7e8788f106 2576 else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_file ", 11 )) {
klauss 45:c80574f24dc3 2577 if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on",2 )) {
klauss 45:c80574f24dc3 2578 miss_match = false;
klauss 119:ee6a53069455 2579 if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug File ON");
klauss 119:ee6a53069455 2580 if( from_eth ) {
klauss 119:ee6a53069455 2581 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug File On\n\r");
klauss 45:c80574f24dc3 2582 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2583 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2584 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2585 } else if( udp_query ) {
klauss 119:ee6a53069455 2586 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2587 }
klauss 45:c80574f24dc3 2588 }
klauss 119:ee6a53069455 2589 debug_file = true;
klauss 45:c80574f24dc3 2590 }
klauss 45:c80574f24dc3 2591 if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off",3 )) {
klauss 45:c80574f24dc3 2592 miss_match = false;
klauss 119:ee6a53069455 2593 if( debug_uart3 && !( from_eth ) ) pc.printf("Debug File OFF");
klauss 119:ee6a53069455 2594 if( from_eth ) {
klauss 119:ee6a53069455 2595 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug File Off\n\r");
klauss 45:c80574f24dc3 2596 debug_buf[ strlen( debug_buf ) - 1 ] = '\0';
klauss 119:ee6a53069455 2597 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2598 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2599 } else if( udp_query ) {
klauss 119:ee6a53069455 2600 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2601 }
klauss 45:c80574f24dc3 2602 }
klauss 119:ee6a53069455 2603 debug_file = false;
klauss 45:c80574f24dc3 2604 }
klauss 45:c80574f24dc3 2605 }
klauss 45:c80574f24dc3 2606
klauss 58:af7e8788f106 2607 else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "help" )) {
klauss 45:c80574f24dc3 2608 miss_match = false;
klauss 119:ee6a53069455 2609 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r****************************PROMPT HELP******************\n\r");
klauss 119:ee6a53069455 2610 if( from_eth ) {
klauss 119:ee6a53069455 2611 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "\n\r****************************PROMPT HELP******************\n\r" );
klauss 119:ee6a53069455 2612 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2613
klauss 119:ee6a53069455 2614 else if( udp_query ) {
klauss 119:ee6a53069455 2615 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2616 /*
klauss 119:ee6a53069455 2617 int send = udp_client.sendTo( udp_server, debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2618
klauss 119:ee6a53069455 2619 if( send != strlen( debug_buf ) ) {
klauss 119:ee6a53069455 2620 if( debug_reconnect ) send_msg("Reconnect udp_query client");
klauss 119:ee6a53069455 2621 reconnect_prompt_udp_socket();
klauss 119:ee6a53069455 2622 miss_prompt_udp_send_pkg++;
klauss 119:ee6a53069455 2623 }
klauss 119:ee6a53069455 2624 */
klauss 45:c80574f24dc3 2625 }
klauss 44:cc4996469404 2626 }
klauss 119:ee6a53069455 2627
klauss 119:ee6a53069455 2628 if( debug_uart3 && !( from_eth ) ) pc.printf("ifconfig - mostra o arquivo de configuracao do sistema\n\r");
klauss 119:ee6a53069455 2629 if( from_eth ) {
klauss 119:ee6a53069455 2630 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ifconfig - mostra o arquivo de configuracao do sistema\n\r" );
klauss 119:ee6a53069455 2631 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2632
klauss 119:ee6a53069455 2633 else if( udp_query ) {
klauss 119:ee6a53069455 2634 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2635 }
klauss 45:c80574f24dc3 2636 }
klauss 119:ee6a53069455 2637 if( debug_uart3 && !( from_eth ) ) pc.printf("dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r");
klauss 119:ee6a53069455 2638 if( from_eth ) {
klauss 119:ee6a53069455 2639 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r" );
klauss 119:ee6a53069455 2640 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2641
klauss 119:ee6a53069455 2642 else if( udp_query ) {
klauss 119:ee6a53069455 2643 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2644 }
klauss 119:ee6a53069455 2645 }
klauss 119:ee6a53069455 2646 if( debug_uart3 && !( from_eth ) ) pc.printf("callme [ramal porta] - envia o pedido de ligacao para o callbox com o ramal e porta indicada\n\r");
klauss 119:ee6a53069455 2647 if( from_eth ) {
klauss 119:ee6a53069455 2648 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" );
klauss 119:ee6a53069455 2649 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2650
klauss 119:ee6a53069455 2651 else if( udp_query ) {
klauss 119:ee6a53069455 2652 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2653 }
klauss 45:c80574f24dc3 2654 }
klauss 119:ee6a53069455 2655 if( debug_uart3 && !( from_eth ) ) pc.printf("pcb porta comando - envia o <comando> para o cbx <ramal> e <porta> executar\n\r");
klauss 119:ee6a53069455 2656 if( from_eth ) {
klauss 119:ee6a53069455 2657 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "promptcb ramal porta comando - envia o <comando> para o cbx <ramal> e <porta> executar\n\r" );
klauss 119:ee6a53069455 2658 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2659
klauss 119:ee6a53069455 2660 else if( udp_query ) {
klauss 119:ee6a53069455 2661 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2662 }
klauss 45:c80574f24dc3 2663 }
klauss 119:ee6a53069455 2664 if( debug_uart3 && !( from_eth ) ) pc.printf("format - formata o sistema de arquivos\n\r");
klauss 119:ee6a53069455 2665 if( debug_uart3 && !( from_eth ) ) pc.printf("reset - resta o sistema\n\r");
klauss 119:ee6a53069455 2666 if( from_eth ) {
klauss 119:ee6a53069455 2667 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "reset - resta o sistema\n\r" );
klauss 119:ee6a53069455 2668 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2669
klauss 119:ee6a53069455 2670 else if( udp_query ) {
klauss 119:ee6a53069455 2671 udp_query_send_msg( debug_buf );
klauss 114:472502b31a12 2672 }
klauss 114:472502b31a12 2673 }
klauss 119:ee6a53069455 2674 if( debug_uart3 && !( from_eth ) ) pc.printf("ipset [ip] - Configura o IP da cabeceira\n\r");
klauss 119:ee6a53069455 2675 if( from_eth ) {
klauss 119:ee6a53069455 2676 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ipset [ip] - Configura o IP da cabeceira\n\r" );
klauss 119:ee6a53069455 2677 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2678
klauss 119:ee6a53069455 2679 else if( udp_query ) {
klauss 119:ee6a53069455 2680 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2681 }
klauss 45:c80574f24dc3 2682 }
klauss 119:ee6a53069455 2683 if( debug_uart3 && !( from_eth ) ) pc.printf("extset [ext] - Configura a ext da cabeceira\n\r");
klauss 119:ee6a53069455 2684 if( from_eth ) {
klauss 119:ee6a53069455 2685 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "extset [ext] - Configura a ext da cabeceira\n\r" );
klauss 119:ee6a53069455 2686 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2687
klauss 119:ee6a53069455 2688 else if( udp_query ) {
klauss 119:ee6a53069455 2689 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2690 }
klauss 45:c80574f24dc3 2691 }
klauss 119:ee6a53069455 2692 if( debug_uart3 && !( from_eth ) ) pc.printf("msipport [port] - Configura a porta SIP da cabeceira\n\r");
klauss 119:ee6a53069455 2693 if( from_eth ) {
klauss 119:ee6a53069455 2694 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "msipport [port] - Configura a porta SIP da cabeceira\n\r" );
klauss 119:ee6a53069455 2695 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2696
klauss 119:ee6a53069455 2697 else if( udp_query ) {
klauss 119:ee6a53069455 2698 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2699 }
klauss 45:c80574f24dc3 2700 }
klauss 119:ee6a53069455 2701 if( debug_uart3 && !( from_eth ) ) pc.printf("serverip [ip] - Configura o ip do servidor asterisk\n\r");
klauss 119:ee6a53069455 2702 if( from_eth ) {
klauss 119:ee6a53069455 2703 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "serverip [ip] - Configura o ip do servidor asterisk\n\r" );
klauss 119:ee6a53069455 2704 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2705
klauss 119:ee6a53069455 2706 else if( udp_query ) {
klauss 119:ee6a53069455 2707 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2708 }
klauss 45:c80574f24dc3 2709 }
klauss 119:ee6a53069455 2710 if( debug_uart3 && !( from_eth ) ) pc.printf("serextset [ext] - Configura a server ext da cabeceira\n\r");
klauss 119:ee6a53069455 2711 if( from_eth ) {
klauss 119:ee6a53069455 2712 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "serextset [ext] - Configura a server ext da cabeceira\n\r" );
klauss 119:ee6a53069455 2713 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2714
klauss 119:ee6a53069455 2715 else if( udp_query ) {
klauss 119:ee6a53069455 2716 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2717 }
klauss 45:c80574f24dc3 2718 }
klauss 119:ee6a53069455 2719 if( debug_uart3 && !( from_eth ) ) pc.printf("ssport [port] - Configura a porta SIP do servidor asterisk\n\r");
klauss 119:ee6a53069455 2720 if( from_eth ) {
klauss 119:ee6a53069455 2721 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ssport [port] - Configura a porta SIP do servidor asterisk\n\r" );
klauss 119:ee6a53069455 2722 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2723
klauss 119:ee6a53069455 2724 else if( udp_query ) {
klauss 119:ee6a53069455 2725 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2726 }
klauss 45:c80574f24dc3 2727 }
klauss 119:ee6a53069455 2728 if( debug_uart3 && !( from_eth ) ) pc.printf("maskset [mask] - Configura a mascara da cabeceira\n\r");
klauss 119:ee6a53069455 2729 if( from_eth ) {
klauss 119:ee6a53069455 2730 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "maskset [mask] - Configura a mascara da cabeceira\n\r" );
klauss 119:ee6a53069455 2731 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2732
klauss 119:ee6a53069455 2733 else if( udp_query ) {
klauss 119:ee6a53069455 2734 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2735 }
klauss 45:c80574f24dc3 2736 }
klauss 119:ee6a53069455 2737 if( debug_uart3 && !( from_eth ) ) pc.printf("gatewayset [gateway] - Configura o gateway da cabeceira\n\r");
klauss 119:ee6a53069455 2738 if( from_eth ) {
klauss 119:ee6a53069455 2739 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "gatewayset [gateway] - Configura o gateway da cabeceira\n\r" );
klauss 119:ee6a53069455 2740 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2741
klauss 119:ee6a53069455 2742 else if( udp_query ) {
klauss 119:ee6a53069455 2743 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2744 }
klauss 45:c80574f24dc3 2745 }
klauss 119:ee6a53069455 2746
klauss 119:ee6a53069455 2747 if( debug_uart3 && !( from_eth ) ) pc.printf("fw_ip - Configura o IP do servidor de fw\n\r");
klauss 119:ee6a53069455 2748 if( from_eth ) {
klauss 119:ee6a53069455 2749 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "fw_ip - Configura o IP do servidor de fw\n\r" );
klauss 119:ee6a53069455 2750 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2751
klauss 119:ee6a53069455 2752 else if( udp_query ) {
klauss 119:ee6a53069455 2753 udp_query_send_msg( debug_buf );
klauss 56:c64bcbaa621a 2754 }
klauss 56:c64bcbaa621a 2755 }
klauss 119:ee6a53069455 2756 if( debug_uart3 && !( from_eth ) ) pc.printf("fw_port - Configura a porta do servidor de fw\n\r");
klauss 119:ee6a53069455 2757 if( from_eth ) {
klauss 119:ee6a53069455 2758 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "fw_port - Configura a porta do servidor de fw\n\r" );
klauss 119:ee6a53069455 2759 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2760
klauss 119:ee6a53069455 2761 else if( udp_query ) {
klauss 119:ee6a53069455 2762 udp_query_send_msg( debug_buf );
klauss 99:e80850c51106 2763 }
klauss 99:e80850c51106 2764 }
klauss 119:ee6a53069455 2765
klauss 119:ee6a53069455 2766 if( debug_uart3 && !( from_eth ) ) pc.printf("maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r");
klauss 119:ee6a53069455 2767 if( from_eth ) {
klauss 119:ee6a53069455 2768 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r" );
klauss 119:ee6a53069455 2769 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2770
klauss 119:ee6a53069455 2771 else if( udp_query ) {
klauss 119:ee6a53069455 2772 udp_query_send_msg( debug_buf );
klauss 99:e80850c51106 2773 }
klauss 99:e80850c51106 2774 }
klauss 119:ee6a53069455 2775
klauss 119:ee6a53069455 2776 if( debug_uart3 && !( from_eth ) ) pc.printf("minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r");
klauss 119:ee6a53069455 2777 if( from_eth ) {
klauss 119:ee6a53069455 2778 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r" );
klauss 119:ee6a53069455 2779 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2780
klauss 119:ee6a53069455 2781 else if( udp_query ) {
klauss 119:ee6a53069455 2782 udp_query_send_msg( debug_buf );
klauss 81:3656f00ab3db 2783 }
klauss 81:3656f00ab3db 2784 }
klauss 119:ee6a53069455 2785
klauss 119:ee6a53069455 2786 if( debug_uart3 && !( from_eth ) ) pc.printf("showcb - lista os Cbx registrados na header\n\r");
klauss 119:ee6a53069455 2787 if( from_eth ) {
klauss 119:ee6a53069455 2788 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "showcb - lista os Cbx registrados na header\n\r" );
klauss 119:ee6a53069455 2789 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2790
klauss 119:ee6a53069455 2791 else if( udp_query ) {
klauss 119:ee6a53069455 2792 udp_query_send_msg( debug_buf );
klauss 81:3656f00ab3db 2793 }
klauss 81:3656f00ab3db 2794 }
klauss 119:ee6a53069455 2795 if( debug_uart3 && !( from_eth ) ) pc.printf("cks - exibe estatisticas de check sum\n\r");
klauss 119:ee6a53069455 2796 if( from_eth ) {
klauss 119:ee6a53069455 2797 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "cks - exibe estatisticas de check sum\n\r" );
klauss 119:ee6a53069455 2798 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2799
klauss 119:ee6a53069455 2800 else if( udp_query ) {
klauss 119:ee6a53069455 2801 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2802 }
klauss 45:c80574f24dc3 2803 }
klauss 119:ee6a53069455 2804 if( debug_uart3 && !( from_eth ) ) pc.printf("reset_cks - reseta estatisticas de check sum\n\r");
klauss 119:ee6a53069455 2805 if( from_eth ) {
klauss 119:ee6a53069455 2806 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "reset_cks - reseta estatisticas de check sum\n\r" );
klauss 119:ee6a53069455 2807 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2808
klauss 119:ee6a53069455 2809 else if( udp_query ) {
klauss 119:ee6a53069455 2810 udp_query_send_msg( debug_buf );
klauss 52:12930cef17c4 2811 }
klauss 52:12930cef17c4 2812 }
klauss 119:ee6a53069455 2813
klauss 119:ee6a53069455 2814 if( debug_uart3 && !( from_eth ) ) pc.printf(". - executa o comando anterior novamente\n\r");
klauss 119:ee6a53069455 2815 if( from_eth ) {
klauss 119:ee6a53069455 2816 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, ". - executa o comando anterior novamente\n\r" );
klauss 119:ee6a53069455 2817 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2818
klauss 119:ee6a53069455 2819 else if( udp_query ) {
klauss 119:ee6a53069455 2820 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2821 }
klauss 45:c80574f24dc3 2822 }
klauss 119:ee6a53069455 2823 if( debug_uart3 && !( from_eth ) ) pc.printf("debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r");
klauss 119:ee6a53069455 2824 if( from_eth ) {
klauss 119:ee6a53069455 2825 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r" );
klauss 119:ee6a53069455 2826 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2827
klauss 119:ee6a53069455 2828 else if( udp_query ) {
klauss 119:ee6a53069455 2829 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2830 }
klauss 45:c80574f24dc3 2831 }
klauss 119:ee6a53069455 2832 if( debug_uart3 && !( from_eth ) ) pc.printf("{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r");
klauss 119:ee6a53069455 2833 if( from_eth ) {
klauss 119:ee6a53069455 2834 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r");
klauss 119:ee6a53069455 2835 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2836
klauss 119:ee6a53069455 2837 else if( udp_query ) {
klauss 119:ee6a53069455 2838 udp_query_send_msg( debug_buf );
klauss 62:07e5bdc9f8f7 2839 }
klauss 62:07e5bdc9f8f7 2840 }
klauss 119:ee6a53069455 2841
klauss 119:ee6a53069455 2842 if( debug_uart3 && !( from_eth ) ) pc.printf("silence <start_ext end_ext> - envia comando de flood off para os ramais no intervalo end_ext - start_ext\n\r");
klauss 119:ee6a53069455 2843 if( from_eth ) {
klauss 119:ee6a53069455 2844 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");
klauss 119:ee6a53069455 2845 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2846
klauss 119:ee6a53069455 2847 else if( udp_query ) {
klauss 119:ee6a53069455 2848 udp_query_send_msg( debug_buf );
klauss 65:0b653cfe95db 2849 }
klauss 65:0b653cfe95db 2850 }
klauss 119:ee6a53069455 2851
klauss 119:ee6a53069455 2852 if( debug_uart3 && !( from_eth ) ) pc.printf("++ ext - Header flood on, ext flood on\n\r");
klauss 119:ee6a53069455 2853 if( from_eth ) {
klauss 119:ee6a53069455 2854 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "++ ext - Header flood on, ext flood on\n\r");
klauss 119:ee6a53069455 2855 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2856
klauss 119:ee6a53069455 2857 else if( udp_query ) {
klauss 119:ee6a53069455 2858 udp_query_send_msg( debug_buf );
klauss 45:c80574f24dc3 2859 }
klauss 45:c80574f24dc3 2860 }
klauss 119:ee6a53069455 2861
klauss 119:ee6a53069455 2862 if( debug_uart3 && !( from_eth ) ) pc.printf("-- ext - Header flood off, ext flood off\n\r");
klauss 119:ee6a53069455 2863 if( from_eth ) {
klauss 119:ee6a53069455 2864 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "++ ext - Header flood on, ext flood on\n\r");
klauss 119:ee6a53069455 2865 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2866
klauss 119:ee6a53069455 2867 else if( udp_query ) {
klauss 119:ee6a53069455 2868 udp_query_send_msg( debug_buf );
klauss 66:3f1d22e69e7b 2869 }
klauss 66:3f1d22e69e7b 2870 }
klauss 119:ee6a53069455 2871
klauss 119:ee6a53069455 2872 if( debug_uart3 && !( from_eth ) ) pc.printf("rx - Exibe ultimo pacote recebido dos CBx\n\r");
klauss 119:ee6a53069455 2873 if( from_eth ) {
klauss 119:ee6a53069455 2874 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "rx - Exibe ultimo pacote recebido dos CBx\n\r");
klauss 119:ee6a53069455 2875 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2876
klauss 119:ee6a53069455 2877 else if( udp_query ) {
klauss 119:ee6a53069455 2878 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2879 }
klauss 119:ee6a53069455 2880 }
klauss 119:ee6a53069455 2881 if( debug_uart3 && !( from_eth ) ) pc.printf("tx - Exibe ultimo pacote enviado para os CBx\n\r");
klauss 119:ee6a53069455 2882 if( from_eth ) {
klauss 119:ee6a53069455 2883 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "tx - Exibe ultimo pacote enviado para os CBx\n\r");
klauss 119:ee6a53069455 2884 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2885
klauss 119:ee6a53069455 2886 else if( udp_query ) {
klauss 119:ee6a53069455 2887 udp_query_send_msg( debug_buf );
klauss 64:5b011d5707d2 2888 }
klauss 64:5b011d5707d2 2889 }
klauss 119:ee6a53069455 2890 if( debug_uart3 && !( from_eth ) ) pc.printf("ls | status - Exibe uma lista ordenada por ext do CBx registrados na Header\n\r");
klauss 119:ee6a53069455 2891 if( from_eth ) {
klauss 119:ee6a53069455 2892 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ls | status - Exibe uma lista ordenada por ext do CBx registrados na Header\n\r");
klauss 119:ee6a53069455 2893 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2894
klauss 119:ee6a53069455 2895 else if( udp_query ) {
klauss 119:ee6a53069455 2896 udp_query_send_msg( debug_buf );
klauss 64:5b011d5707d2 2897 }
klauss 64:5b011d5707d2 2898 }
klauss 119:ee6a53069455 2899 if( debug_uart3 && !( from_eth ) ) pc.printf("types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r");
klauss 119:ee6a53069455 2900 if( from_eth ) {
klauss 119:ee6a53069455 2901 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r");
klauss 119:ee6a53069455 2902 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2903
klauss 119:ee6a53069455 2904 else if( udp_query ) {
klauss 119:ee6a53069455 2905 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 2906 }
klauss 119:ee6a53069455 2907 }
klauss 119:ee6a53069455 2908 if( debug_uart3 && !( from_eth ) ) pc.printf("protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r");
klauss 119:ee6a53069455 2909 if( from_eth ) {
klauss 119:ee6a53069455 2910 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r");
klauss 119:ee6a53069455 2911 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2912
klauss 119:ee6a53069455 2913 else if( udp_query ) {
klauss 119:ee6a53069455 2914 udp_query_send_msg( debug_buf );
klauss 64:5b011d5707d2 2915 }
klauss 64:5b011d5707d2 2916 }
klauss 119:ee6a53069455 2917
klauss 121:ee02790d00b7 2918 if( debug_uart3 && !( from_eth ) ) pc.printf("PROMPT VERSION: V%d -- %s - %s\n\r", PVERSION, __DATE__, __TIME__ );
klauss 119:ee6a53069455 2919 if( from_eth ) {
klauss 121:ee02790d00b7 2920 snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "PROMPT VERSION: V%d -- %s - %s\n\r", PVERSION, __DATE__, __TIME__);
klauss 119:ee6a53069455 2921 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2922 while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2923 } else if( udp_query ) {
klauss 119:ee6a53069455 2924 udp_query_send_msg( debug_buf );
klauss 104:62646ef786a3 2925 }
klauss 104:62646ef786a3 2926 }
klauss 119:ee6a53069455 2927 //*------------ formatando a saida ----------------*//
klauss 119:ee6a53069455 2928 strcpy( last_cmd, tmp_cmd );
klauss 119:ee6a53069455 2929 bufptr = 0;
klauss 119:ee6a53069455 2930 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 119:ee6a53069455 2931
klauss 119:ee6a53069455 2932 if( from_eth ) {
klauss 119:ee6a53069455 2933 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2934 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "> " );
klauss 119:ee6a53069455 2935 if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) );
klauss 119:ee6a53069455 2936 } else if( udp_query ) {
klauss 119:ee6a53069455 2937 udp_query_send_msg( "> " );
klauss 104:62646ef786a3 2938 }
klauss 104:62646ef786a3 2939 }
klauss 105:a930035b6556 2940 }
klauss 114:472502b31a12 2941
klauss 119:ee6a53069455 2942 else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "callme ", 7 )) {
klauss 105:a930035b6556 2943 miss_match = false;
klauss 105:a930035b6556 2944 int ext,port;
klauss 105:a930035b6556 2945 char cmd[ 16 ];
klauss 119:ee6a53069455 2946
klauss 105:a930035b6556 2947 ext = atoi( debug_buf + 7 );
klauss 105:a930035b6556 2948 port = convert_ext_to_port( ext );
klauss 119:ee6a53069455 2949
klauss 105:a930035b6556 2950 strcpy( cmd, ( ext % 2 ) ? "call init B" : "call init A" );
klauss 119:ee6a53069455 2951
klauss 105:a930035b6556 2952 if( ext % 2 ) ext--;
klauss 119:ee6a53069455 2953
klauss 105:a930035b6556 2954 promptcb_last_ext = ext;
klauss 105:a930035b6556 2955 promptcb_last_port = port;
klauss 119:ee6a53069455 2956
klauss 105:a930035b6556 2957 int tmp = strlen( cmd );
klauss 105:a930035b6556 2958 cmd[ tmp ] = 0x0D;
klauss 105:a930035b6556 2959 cmd[ tmp + 1 ] = 0x00;
klauss 105:a930035b6556 2960 strcpy( promptcb_last_cmd, cmd );
klauss 119:ee6a53069455 2961
klauss 119:ee6a53069455 2962 if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n", ext, port, cmd );
klauss 119:ee6a53069455 2963
klauss 119:ee6a53069455 2964 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r--------------------------------------------------------\n\r");
klauss 119:ee6a53069455 2965 for( uint16_t i = 0; i < strlen( cmd ) ; i++ ) if( debug_uart3 && !( from_eth ) ) pc.printf( "%02x ", cmd[ i ] );
klauss 119:ee6a53069455 2966
klauss 119:ee6a53069455 2967 send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) );
klauss 119:ee6a53069455 2968 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r--------------------------------------------------------\n\r");
klauss 119:ee6a53069455 2969 for( uint16_t i = 0; i < 300 ; i++ ) {
klauss 119:ee6a53069455 2970 if( debug_uart3 && !( from_eth ) ) pc.printf( "%02x ", write_buffer[ i ] );
klauss 119:ee6a53069455 2971 if( i != 0 && !( ( i + 1 ) % 30 ) ) if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r");
klauss 119:ee6a53069455 2972 }
klauss 119:ee6a53069455 2973
klauss 119:ee6a53069455 2974 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado\n\r");
klauss 119:ee6a53069455 2975
klauss 119:ee6a53069455 2976 if( from_eth ) {
klauss 105:a930035b6556 2977 char eth_msg[ 512 ];
klauss 105:a930035b6556 2978 snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d\r\ncmd=%s\r\n\n\rComando enviado\n\r", ext, port, cmd );
klauss 119:ee6a53069455 2979 if( tcp_session && !udp_query ) {
klauss 105:a930035b6556 2980 tcp_client.send_all( eth_msg, strlen( eth_msg ) );
klauss 119:ee6a53069455 2981 } else if( udp_query ) {
klauss 119:ee6a53069455 2982 udp_query_send_msg( eth_msg );
klauss 119:ee6a53069455 2983 }
klauss 119:ee6a53069455 2984 }
klauss 119:ee6a53069455 2985
klauss 119:ee6a53069455 2986 bufptr = 0;
klauss 119:ee6a53069455 2987 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 119:ee6a53069455 2988 }
klauss 119:ee6a53069455 2989
klauss 119:ee6a53069455 2990 if( miss_match ) {
klauss 119:ee6a53069455 2991 if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r> %s: command not found\n\r", debug_buf );
klauss 119:ee6a53069455 2992 if( from_eth ) {
klauss 119:ee6a53069455 2993 snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "> %s: command not found\n ", debug_buf );
klauss 119:ee6a53069455 2994 if( tcp_session && !udp_query ) {
klauss 119:ee6a53069455 2995 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 2996 } else if( udp_query ) {
klauss 119:ee6a53069455 2997 udp_query_send_msg( debug_buf );
klauss 105:a930035b6556 2998 }
klauss 105:a930035b6556 2999 }
klauss 119:ee6a53069455 3000 } else {
klauss 119:ee6a53069455 3001 if( from_eth && strlen( debug_buf ) > 2 ) strcpy( last_cmd, tmp_cmd );
klauss 119:ee6a53069455 3002
klauss 119:ee6a53069455 3003 else if( strlen( debug_buf ) > 2 ) strcpy( last_cmd, tmp_cmd );
klauss 119:ee6a53069455 3004 }
klauss 119:ee6a53069455 3005 }
klauss 119:ee6a53069455 3006
klauss 119:ee6a53069455 3007 if( b == 0x0D || bufret == 1 || bufptr > DEBUGBUFSIZE ) {
klauss 119:ee6a53069455 3008 bufret = 0;
klauss 119:ee6a53069455 3009
klauss 119:ee6a53069455 3010 if( debug_uart3 && !( from_eth ) ) pc.putc(0x0A);
klauss 119:ee6a53069455 3011 if( debug_uart3 && !( from_eth ) ) pc.putc(0x0D);
klauss 119:ee6a53069455 3012 if( debug_uart3 && !( from_eth ) ) pc.printf("> ");
klauss 119:ee6a53069455 3013
klauss 119:ee6a53069455 3014 if( from_eth )
klauss 119:ee6a53069455 3015 {
klauss 119:ee6a53069455 3016 if( strlen( debug_buf ) > 0 )
klauss 119:ee6a53069455 3017 {
klauss 119:ee6a53069455 3018
klauss 119:ee6a53069455 3019 if( debug_buf[ strlen( debug_buf ) - 1 ] == '\r' || debug_buf[ strlen( debug_buf ) - 1 ] == '\n' )
klauss 119:ee6a53069455 3020 {
klauss 119:ee6a53069455 3021 //strcat( debug_buf, "> " );
klauss 119:ee6a53069455 3022 strcpy( debug_buf, "> " );
klauss 119:ee6a53069455 3023 } else {
klauss 119:ee6a53069455 3024 //strcat( debug_buf, "\n\r> " );
klauss 119:ee6a53069455 3025 strcpy( debug_buf, "\n\r> " );
klauss 119:ee6a53069455 3026 }
klauss 119:ee6a53069455 3027 }else{
klauss 119:ee6a53069455 3028
klauss 119:ee6a53069455 3029 }
klauss 117:e9facba9db27 3030
klauss 119:ee6a53069455 3031 if( tcp_session && !udp_query )
klauss 119:ee6a53069455 3032 {
klauss 119:ee6a53069455 3033 tcp_client.send_all( debug_buf, strlen( debug_buf ) );
klauss 119:ee6a53069455 3034 } else if( udp_query ) {
klauss 119:ee6a53069455 3035
klauss 119:ee6a53069455 3036 udp_query_send_msg( debug_buf );
klauss 119:ee6a53069455 3037
klauss 119:ee6a53069455 3038 }
klauss 119:ee6a53069455 3039 for( register uint16_t i = 0; i < PROMPT_ETH_BUFFER_SIZE; i++ ) eth_buffer[ i ] = 0;
klauss 119:ee6a53069455 3040
klauss 119:ee6a53069455 3041 debug_buf = __debug_buf__;
klauss 119:ee6a53069455 3042
klauss 119:ee6a53069455 3043 bufptr = last_bufptr;
klauss 119:ee6a53069455 3044
klauss 119:ee6a53069455 3045 }
klauss 119:ee6a53069455 3046 else
klauss 119:ee6a53069455 3047 {
klauss 104:62646ef786a3 3048 bufptr = 0;
klauss 119:ee6a53069455 3049 last_bufptr = 0;
klauss 119:ee6a53069455 3050 for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0;
klauss 119:ee6a53069455 3051 }
klauss 119:ee6a53069455 3052 }
klauss 119:ee6a53069455 3053 return( NULL );
klauss 121:ee02790d00b7 3054 }//fim prompt_process