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 20 19:50:31 2015 +0000
Revision:
126:1f90756250fb
Parent:
124:c1b6c893e1c3
Child:
127:e7160a463b6c
under validation

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