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