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