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