Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
prompt.cpp@120:770f00554b1e, 2015-05-04 (annotated)
- Committer:
- klauss
- Date:
- Mon May 04 17:25:29 2015 +0000
- Revision:
- 120:770f00554b1e
- Parent:
- 119:ee6a53069455
- Child:
- 121:ee02790d00b7
clock request to server XXX port 123
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*) "registra" ) ){ |
klauss | 112:6ae726539ab9 | 667 | miss_match = false; |
klauss | 112:6ae726539ab9 | 668 | registra = true; |
klauss | 112:6ae726539ab9 | 669 | } |
klauss | 112:6ae726539ab9 | 670 | |
klauss | 114:472502b31a12 | 671 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "show_sip" ) ){ |
klauss | 114:472502b31a12 | 672 | miss_match = false; |
klauss | 114:472502b31a12 | 673 | show_sip = true; |
klauss | 114:472502b31a12 | 674 | } |
klauss | 114:472502b31a12 | 675 | |
klauss | 114:472502b31a12 | 676 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "reset_cks" ) ){ |
klauss | 114:472502b31a12 | 677 | miss_match = false; |
klauss | 114:472502b31a12 | 678 | reset_cks = true; |
klauss | 114:472502b31a12 | 679 | } |
klauss | 114:472502b31a12 | 680 | |
klauss | 114:472502b31a12 | 681 | //replaced by ls |
klauss | 114:472502b31a12 | 682 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "status" ) ){ |
klauss | 109:a5b8264ffbbc | 683 | miss_match = false; |
klauss | 114:472502b31a12 | 684 | list = true; |
klauss | 114:472502b31a12 | 685 | } |
klauss | 114:472502b31a12 | 686 | |
klauss | 114:472502b31a12 | 687 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "wdt" ) ){ |
klauss | 114:472502b31a12 | 688 | miss_match = false; |
klauss | 114:472502b31a12 | 689 | debug_wdt = true; |
klauss | 114:472502b31a12 | 690 | } |
klauss | 114:472502b31a12 | 691 | |
klauss | 114:472502b31a12 | 692 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "eth" ) ){ |
klauss | 114:472502b31a12 | 693 | miss_match = false; |
klauss | 114:472502b31a12 | 694 | debug_eth = true; |
klauss | 114:472502b31a12 | 695 | } |
klauss | 114:472502b31a12 | 696 | |
klauss | 119:ee6a53069455 | 697 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "deleted" ) ) { |
klauss | 119:ee6a53069455 | 698 | miss_match = false; |
klauss | 119:ee6a53069455 | 699 | send_msg("::deleted_sip [%5i]::", deleted_sip ); |
klauss | 119:ee6a53069455 | 700 | } |
klauss | 119:ee6a53069455 | 701 | |
klauss | 119:ee6a53069455 | 702 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "types" ) ) { |
klauss | 114:472502b31a12 | 703 | miss_match = false; |
klauss | 119:ee6a53069455 | 704 | |
klauss | 119:ee6a53069455 | 705 | 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 | 706 | |
klauss | 119:ee6a53069455 | 707 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 708 | 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 | 709 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 710 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 711 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 712 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 713 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 714 | } |
klauss | 105:a930035b6556 | 715 | } |
klauss | 105:a930035b6556 | 716 | } |
klauss | 114:472502b31a12 | 717 | |
klauss | 114:472502b31a12 | 718 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "protocol" ) ){ |
klauss | 119:ee6a53069455 | 719 | miss_match = false; |
klauss | 119:ee6a53069455 | 720 | |
klauss | 119:ee6a53069455 | 721 | 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 | 722 | |
klauss | 119:ee6a53069455 | 723 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 724 | 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 | 725 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 726 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 727 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 728 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 729 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 730 | } |
klauss | 109:a5b8264ffbbc | 731 | } |
klauss | 109:a5b8264ffbbc | 732 | } |
klauss | 114:472502b31a12 | 733 | |
klauss | 114:472502b31a12 | 734 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "flood ", 6 ) ){ |
klauss | 114:472502b31a12 | 735 | if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on", 2 ) ){ |
klauss | 109:a5b8264ffbbc | 736 | miss_match = false; |
klauss | 114:472502b31a12 | 737 | if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r"); |
klauss | 114:472502b31a12 | 738 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 739 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood On\n\r" ); |
klauss | 109:a5b8264ffbbc | 740 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 114:472502b31a12 | 741 | } |
klauss | 109:a5b8264ffbbc | 742 | tflood.start(); |
klauss | 109:a5b8264ffbbc | 743 | tflood.reset(); |
klauss | 109:a5b8264ffbbc | 744 | floodcount =0; |
klauss | 109:a5b8264ffbbc | 745 | pflood = 1; |
klauss | 109:a5b8264ffbbc | 746 | flood_timeout.start(); |
klauss | 109:a5b8264ffbbc | 747 | } |
klauss | 114:472502b31a12 | 748 | |
klauss | 114:472502b31a12 | 749 | if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "more", 4 ) ){ |
klauss | 109:a5b8264ffbbc | 750 | miss_match = false; |
klauss | 114:472502b31a12 | 751 | if( debug_uart3 ) pc.printf("\n\rFlood ON\n\r"); |
klauss | 114:472502b31a12 | 752 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 753 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood On\n\r" ); |
klauss | 114:472502b31a12 | 754 | //debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 109:a5b8264ffbbc | 755 | } |
klauss | 109:a5b8264ffbbc | 756 | tflood.start(); |
klauss | 109:a5b8264ffbbc | 757 | tflood.reset(); |
klauss | 109:a5b8264ffbbc | 758 | floodcount = 0; |
klauss | 109:a5b8264ffbbc | 759 | pflood = 1; |
klauss | 109:a5b8264ffbbc | 760 | } |
klauss | 114:472502b31a12 | 761 | |
klauss | 109:a5b8264ffbbc | 762 | if (xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off", 3 )) { |
klauss | 104:62646ef786a3 | 763 | miss_match = false; |
klauss | 114:472502b31a12 | 764 | if( debug_uart3 ) pc.printf("\n\rFlood OFF\n\r"); |
klauss | 114:472502b31a12 | 765 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 766 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Flood Off\n\r" ); |
klauss | 104:62646ef786a3 | 767 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 109:a5b8264ffbbc | 768 | } |
klauss | 109:a5b8264ffbbc | 769 | pflood = 0; |
klauss | 109:a5b8264ffbbc | 770 | tflood.stop(); |
klauss | 109:a5b8264ffbbc | 771 | flood_timeout.reset(); |
klauss | 109:a5b8264ffbbc | 772 | } |
klauss | 119:ee6a53069455 | 773 | |
klauss | 119:ee6a53069455 | 774 | } |
klauss | 119:ee6a53069455 | 775 | |
klauss | 119:ee6a53069455 | 776 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "silence ", 8 ) ){ |
klauss | 109:a5b8264ffbbc | 777 | miss_match = false; |
klauss | 109:a5b8264ffbbc | 778 | char *ref, *split; |
klauss | 119:ee6a53069455 | 779 | |
klauss | 109:a5b8264ffbbc | 780 | strcpy( promptcb_last_cmd, debug_buf ); |
klauss | 119:ee6a53069455 | 781 | |
klauss | 119:ee6a53069455 | 782 | if( !( strcmp( debug_buf + 8, "-h" ) && strcmp( debug_buf + 8, "--help" ) ) ) { |
klauss | 119:ee6a53069455 | 783 | 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 | 784 | |
klauss | 119:ee6a53069455 | 785 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 786 | 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 | 787 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 788 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 789 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 790 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 791 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 792 | } |
klauss | 109:a5b8264ffbbc | 793 | } |
klauss | 119:ee6a53069455 | 794 | } else { |
klauss | 109:a5b8264ffbbc | 795 | ref = debug_buf; |
klauss | 119:ee6a53069455 | 796 | |
klauss | 109:a5b8264ffbbc | 797 | split = strtok( debug_buf + 8, " " ); |
klauss | 119:ee6a53069455 | 798 | |
klauss | 109:a5b8264ffbbc | 799 | start_ext = atoi( split ); |
klauss | 119:ee6a53069455 | 800 | |
klauss | 109:a5b8264ffbbc | 801 | split += strlen( split ) + 1; |
klauss | 119:ee6a53069455 | 802 | |
klauss | 109:a5b8264ffbbc | 803 | end_ext = atoi( split ); |
klauss | 119:ee6a53069455 | 804 | |
klauss | 109:a5b8264ffbbc | 805 | debug_buf = ref; |
klauss | 119:ee6a53069455 | 806 | |
klauss | 119:ee6a53069455 | 807 | if( start_ext < end_ext && ( end_ext - start_ext ) < 50 ) { |
klauss | 109:a5b8264ffbbc | 808 | if( start_ext % 2 ) start_ext--; |
klauss | 109:a5b8264ffbbc | 809 | if( !( end_ext % 2 ) ) end_ext++; |
klauss | 119:ee6a53069455 | 810 | |
klauss | 109:a5b8264ffbbc | 811 | ext_count = start_ext; |
klauss | 109:a5b8264ffbbc | 812 | flood_silence_timer.start(); |
klauss | 119:ee6a53069455 | 813 | } else { |
klauss | 119:ee6a53069455 | 814 | 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 | 815 | |
klauss | 119:ee6a53069455 | 816 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 817 | 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 | 818 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 819 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 820 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 821 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 822 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 823 | } |
klauss | 105:a930035b6556 | 824 | } |
klauss | 104:62646ef786a3 | 825 | } |
klauss | 109:a5b8264ffbbc | 826 | flood_silence = true; |
klauss | 104:62646ef786a3 | 827 | } |
klauss | 104:62646ef786a3 | 828 | } |
klauss | 114:472502b31a12 | 829 | |
klauss | 114:472502b31a12 | 830 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug ",6 ) ){ |
klauss | 109:a5b8264ffbbc | 831 | if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "on",2 )) { |
klauss | 109:a5b8264ffbbc | 832 | miss_match = false; |
klauss | 119:ee6a53069455 | 833 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDebug ON\n\r"); |
klauss | 119:ee6a53069455 | 834 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 835 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug On\n\r"); |
klauss | 109:a5b8264ffbbc | 836 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 837 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 838 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 839 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 840 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 841 | } |
klauss | 109:a5b8264ffbbc | 842 | } |
klauss | 109:a5b8264ffbbc | 843 | debug_alive = true; |
klauss | 109:a5b8264ffbbc | 844 | } |
klauss | 109:a5b8264ffbbc | 845 | if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "off",3 )) { |
klauss | 109:a5b8264ffbbc | 846 | miss_match = false; |
klauss | 119:ee6a53069455 | 847 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDebug OFF\n\r"); |
klauss | 119:ee6a53069455 | 848 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 849 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Off\n\r"); |
klauss | 109:a5b8264ffbbc | 850 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 851 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 852 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 853 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 854 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 855 | } |
klauss | 109:a5b8264ffbbc | 856 | } |
klauss | 109:a5b8264ffbbc | 857 | debug_alive = false; |
klauss | 109:a5b8264ffbbc | 858 | } |
klauss | 119:ee6a53069455 | 859 | if( xmemmatch( (uint8_t*)(debug_buf+6), (uint8_t*) "show",4 ) ) { |
klauss | 100:09a23fcd3bdf | 860 | miss_match = false; |
klauss | 119:ee6a53069455 | 861 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdsip"); |
klauss | 119:ee6a53069455 | 862 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_alive"); |
klauss | 119:ee6a53069455 | 863 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_prompt"); |
klauss | 119:ee6a53069455 | 864 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_vector"); |
klauss | 119:ee6a53069455 | 865 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb"); |
klauss | 119:ee6a53069455 | 866 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_main"); |
klauss | 119:ee6a53069455 | 867 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdcks"); |
klauss | 119:ee6a53069455 | 868 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb_rx"); |
klauss | 119:ee6a53069455 | 869 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_cb_tx*"); |
klauss | 119:ee6a53069455 | 870 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_eth_rx*"); |
klauss | 119:ee6a53069455 | 871 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_eth_tx*"); |
klauss | 119:ee6a53069455 | 872 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rdebug_file"); |
klauss | 109:a5b8264ffbbc | 873 | |
klauss | 119:ee6a53069455 | 874 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 875 | 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 | 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 | } |
klauss | 109:a5b8264ffbbc | 884 | } |
klauss | 114:472502b31a12 | 885 | |
klauss | 114:472502b31a12 | 886 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dsip ", 5 ) ){ |
klauss | 119:ee6a53069455 | 887 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ) { |
klauss | 109:a5b8264ffbbc | 888 | miss_match = false; |
klauss | 119:ee6a53069455 | 889 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rSip Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 890 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 891 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Sip Debug On\n\r"); |
klauss | 109:a5b8264ffbbc | 892 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 893 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 894 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 895 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 896 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 897 | } |
klauss | 109:a5b8264ffbbc | 898 | } |
klauss | 109:a5b8264ffbbc | 899 | debug_sip = true; |
klauss | 109:a5b8264ffbbc | 900 | } |
klauss | 109:a5b8264ffbbc | 901 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { |
klauss | 109:a5b8264ffbbc | 902 | miss_match = false; |
klauss | 119:ee6a53069455 | 903 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rSip Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 904 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 905 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Sip Debug Off\n\r"); |
klauss | 109:a5b8264ffbbc | 906 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 907 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 908 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 909 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 910 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 911 | } |
klauss | 109:a5b8264ffbbc | 912 | } |
klauss | 109:a5b8264ffbbc | 913 | debug_sip = false; |
klauss | 109:a5b8264ffbbc | 914 | } |
klauss | 109:a5b8264ffbbc | 915 | } |
klauss | 109:a5b8264ffbbc | 916 | |
klauss | 119:ee6a53069455 | 917 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dclock ", 7 ) ){ |
klauss | 119:ee6a53069455 | 918 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 919 | miss_match = false; |
klauss | 119:ee6a53069455 | 920 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rClock Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 921 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 922 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Clock Debug On\n\r"); |
klauss | 119:ee6a53069455 | 923 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 924 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 925 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 926 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 927 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 928 | } |
klauss | 119:ee6a53069455 | 929 | } |
klauss | 119:ee6a53069455 | 930 | debug_clock = true; |
klauss | 119:ee6a53069455 | 931 | } |
klauss | 119:ee6a53069455 | 932 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { |
klauss | 119:ee6a53069455 | 933 | miss_match = false; |
klauss | 119:ee6a53069455 | 934 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rClock Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 935 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 936 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Clock Debug Off\n\r"); |
klauss | 119:ee6a53069455 | 937 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 938 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 939 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 940 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 941 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 942 | } |
klauss | 119:ee6a53069455 | 943 | } |
klauss | 119:ee6a53069455 | 944 | debug_clock = false; |
klauss | 119:ee6a53069455 | 945 | } |
klauss | 119:ee6a53069455 | 946 | } |
klauss | 119:ee6a53069455 | 947 | |
klauss | 119:ee6a53069455 | 948 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dlength ", 8 ) ){ |
klauss | 119:ee6a53069455 | 949 | if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 950 | miss_match = false; |
klauss | 119:ee6a53069455 | 951 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rString length debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 952 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 953 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "String length debug On\n\r"); |
klauss | 119:ee6a53069455 | 954 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 955 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 956 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 957 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 958 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 959 | } |
klauss | 119:ee6a53069455 | 960 | } |
klauss | 119:ee6a53069455 | 961 | debug_string_length = true; |
klauss | 119:ee6a53069455 | 962 | } |
klauss | 119:ee6a53069455 | 963 | if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 )) { |
klauss | 119:ee6a53069455 | 964 | miss_match = false; |
klauss | 119:ee6a53069455 | 965 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rString length debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 966 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 967 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "String length debug Off\n\r"); |
klauss | 119:ee6a53069455 | 968 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 969 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 970 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 971 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 972 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 973 | } |
klauss | 119:ee6a53069455 | 974 | } |
klauss | 119:ee6a53069455 | 975 | debug_string_length = false; |
klauss | 119:ee6a53069455 | 976 | } |
klauss | 119:ee6a53069455 | 977 | } |
klauss | 119:ee6a53069455 | 978 | |
klauss | 119:ee6a53069455 | 979 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dbind ", 6 ) ){ |
klauss | 119:ee6a53069455 | 980 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) { |
klauss | 109:a5b8264ffbbc | 981 | miss_match = false; |
klauss | 119:ee6a53069455 | 982 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rUDP Bind Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 983 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 984 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "UDP Bind Debug On\n\r"); |
klauss | 119:ee6a53069455 | 985 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 986 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 987 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 988 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 989 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 990 | } |
klauss | 119:ee6a53069455 | 991 | } |
klauss | 119:ee6a53069455 | 992 | debug_bind = true; |
klauss | 119:ee6a53069455 | 993 | } |
klauss | 119:ee6a53069455 | 994 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) { |
klauss | 119:ee6a53069455 | 995 | miss_match = false; |
klauss | 119:ee6a53069455 | 996 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rUDP Bind Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 997 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 998 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "UDP Bind Debug Off\n\r"); |
klauss | 119:ee6a53069455 | 999 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1000 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1001 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1002 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1003 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1004 | } |
klauss | 119:ee6a53069455 | 1005 | } |
klauss | 119:ee6a53069455 | 1006 | debug_bind = false; |
klauss | 119:ee6a53069455 | 1007 | } |
klauss | 119:ee6a53069455 | 1008 | } |
klauss | 119:ee6a53069455 | 1009 | |
klauss | 119:ee6a53069455 | 1010 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dresetrtp ", 10 ) ) { |
klauss | 119:ee6a53069455 | 1011 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1012 | miss_match = false; |
klauss | 119:ee6a53069455 | 1013 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReset RTP Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1014 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1015 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reset RTP Debug On\n\r"); |
klauss | 109:a5b8264ffbbc | 1016 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1017 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1018 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1019 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1020 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1021 | } |
klauss | 119:ee6a53069455 | 1022 | } |
klauss | 119:ee6a53069455 | 1023 | debug_reset_rtp = true; |
klauss | 119:ee6a53069455 | 1024 | } |
klauss | 119:ee6a53069455 | 1025 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 )) { |
klauss | 119:ee6a53069455 | 1026 | miss_match = false; |
klauss | 119:ee6a53069455 | 1027 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReset RTP Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1028 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1029 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reset RTP Debug Off\n\r"); |
klauss | 119:ee6a53069455 | 1030 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1031 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1032 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1033 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1034 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1035 | } |
klauss | 119:ee6a53069455 | 1036 | } |
klauss | 119:ee6a53069455 | 1037 | debug_reset_rtp = false; |
klauss | 119:ee6a53069455 | 1038 | } |
klauss | 119:ee6a53069455 | 1039 | } |
klauss | 119:ee6a53069455 | 1040 | |
klauss | 119:ee6a53069455 | 1041 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "duart ", 6 ) ) { |
klauss | 119:ee6a53069455 | 1042 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1043 | miss_match = false; |
klauss | 119:ee6a53069455 | 1044 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rEnable UART3 usage\n\r" ); |
klauss | 119:ee6a53069455 | 1045 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1046 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Enable UART3 usage\n\r"); |
klauss | 119:ee6a53069455 | 1047 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1048 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1049 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1050 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1051 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1052 | } |
klauss | 100:09a23fcd3bdf | 1053 | } |
klauss | 100:09a23fcd3bdf | 1054 | debug_uart3 = true; |
klauss | 100:09a23fcd3bdf | 1055 | } |
klauss | 100:09a23fcd3bdf | 1056 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) { |
klauss | 100:09a23fcd3bdf | 1057 | miss_match = false; |
klauss | 119:ee6a53069455 | 1058 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDisable UART3 usage\n\r" ); |
klauss | 119:ee6a53069455 | 1059 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1060 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Disable UART3 usage\n\r"); |
klauss | 100:09a23fcd3bdf | 1061 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1062 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1063 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1064 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1065 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1066 | } |
klauss | 100:09a23fcd3bdf | 1067 | } |
klauss | 100:09a23fcd3bdf | 1068 | debug_uart3 = false; |
klauss | 100:09a23fcd3bdf | 1069 | } |
klauss | 100:09a23fcd3bdf | 1070 | } |
klauss | 114:472502b31a12 | 1071 | |
klauss | 114:472502b31a12 | 1072 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dprint ", 7 ) ){ |
klauss | 114:472502b31a12 | 1073 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ){ |
klauss | 114:472502b31a12 | 1074 | miss_match = false; |
klauss | 114:472502b31a12 | 1075 | if( debug_uart3 ) pc.printf( "\n\rDebug print On\n\r" ); |
klauss | 114:472502b31a12 | 1076 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 1077 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug print On\n\r" ); |
klauss | 114:472502b31a12 | 1078 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 114:472502b31a12 | 1079 | } |
klauss | 114:472502b31a12 | 1080 | print_values = true; |
klauss | 114:472502b31a12 | 1081 | } |
klauss | 114:472502b31a12 | 1082 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { |
klauss | 98:43b45f26b430 | 1083 | miss_match = false; |
klauss | 114:472502b31a12 | 1084 | if( debug_uart3 ) pc.printf( "\n\rDebug print Off\n\r" ); |
klauss | 114:472502b31a12 | 1085 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 1086 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug print Off\n\r" ); |
klauss | 98:43b45f26b430 | 1087 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 114:472502b31a12 | 1088 | } |
klauss | 114:472502b31a12 | 1089 | print_values = false; |
klauss | 114:472502b31a12 | 1090 | } |
klauss | 114:472502b31a12 | 1091 | } |
klauss | 114:472502b31a12 | 1092 | |
klauss | 119:ee6a53069455 | 1093 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmissed ", 8 ) ) { |
klauss | 119:ee6a53069455 | 1094 | if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1095 | miss_match = false; |
klauss | 119:ee6a53069455 | 1096 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDebug Missed ON\n\r" ); |
klauss | 119:ee6a53069455 | 1097 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1098 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Missed ON\n\r"); |
klauss | 119:ee6a53069455 | 1099 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1100 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1101 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1102 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1103 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1104 | } |
klauss | 119:ee6a53069455 | 1105 | } |
klauss | 119:ee6a53069455 | 1106 | debug_missed = true; |
klauss | 119:ee6a53069455 | 1107 | } |
klauss | 119:ee6a53069455 | 1108 | if (xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off", 3 )) { |
klauss | 119:ee6a53069455 | 1109 | miss_match = false; |
klauss | 119:ee6a53069455 | 1110 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDebug Missed Off\n\r" ); |
klauss | 119:ee6a53069455 | 1111 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1112 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Missed Off\n\r"); |
klauss | 119:ee6a53069455 | 1113 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1114 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1115 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1116 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1117 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1118 | } |
klauss | 119:ee6a53069455 | 1119 | } |
klauss | 119:ee6a53069455 | 1120 | debug_missed = false; |
klauss | 119:ee6a53069455 | 1121 | } |
klauss | 119:ee6a53069455 | 1122 | } |
klauss | 119:ee6a53069455 | 1123 | |
klauss | 119:ee6a53069455 | 1124 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dreconnect ", 11 ) ) { |
klauss | 119:ee6a53069455 | 1125 | if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "on", 2 ) ) { |
klauss | 114:472502b31a12 | 1126 | miss_match = false; |
klauss | 119:ee6a53069455 | 1127 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReconnecet Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1128 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1129 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reconnecet Debug On\n\r"); |
klauss | 119:ee6a53069455 | 1130 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1131 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1132 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1133 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1134 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1135 | } |
klauss | 119:ee6a53069455 | 1136 | } |
klauss | 119:ee6a53069455 | 1137 | debug_reconnect = true; |
klauss | 119:ee6a53069455 | 1138 | } |
klauss | 119:ee6a53069455 | 1139 | if (xmemmatch( (uint8_t*)(debug_buf + 11 ), (uint8_t*) "off", 3 )) { |
klauss | 119:ee6a53069455 | 1140 | miss_match = false; |
klauss | 119:ee6a53069455 | 1141 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rReconnecet Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1142 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1143 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Reconnecet Debug Off\n\r"); |
klauss | 114:472502b31a12 | 1144 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1145 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1146 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1147 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1148 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1149 | } |
klauss | 119:ee6a53069455 | 1150 | } |
klauss | 119:ee6a53069455 | 1151 | debug_reconnect = false; |
klauss | 119:ee6a53069455 | 1152 | } |
klauss | 119:ee6a53069455 | 1153 | } |
klauss | 119:ee6a53069455 | 1154 | |
klauss | 119:ee6a53069455 | 1155 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmatch ", 7 ) ) { |
klauss | 119:ee6a53069455 | 1156 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1157 | miss_match = false; |
klauss | 119:ee6a53069455 | 1158 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPort Match Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1159 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1160 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Port Match Debug On\n\r"); |
klauss | 119:ee6a53069455 | 1161 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1162 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1163 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1164 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1165 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1166 | } |
klauss | 98:43b45f26b430 | 1167 | } |
klauss | 98:43b45f26b430 | 1168 | debug_port_match = true; |
klauss | 98:43b45f26b430 | 1169 | } |
klauss | 98:43b45f26b430 | 1170 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { |
klauss | 98:43b45f26b430 | 1171 | miss_match = false; |
klauss | 119:ee6a53069455 | 1172 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPort Match Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1173 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1174 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Port Match Debug Off\n\r"); |
klauss | 98:43b45f26b430 | 1175 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1176 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1177 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1178 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1179 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1180 | } |
klauss | 98:43b45f26b430 | 1181 | } |
klauss | 98:43b45f26b430 | 1182 | debug_port_match = false; |
klauss | 98:43b45f26b430 | 1183 | } |
klauss | 98:43b45f26b430 | 1184 | } |
klauss | 114:472502b31a12 | 1185 | |
klauss | 119:ee6a53069455 | 1186 | |
klauss | 119:ee6a53069455 | 1187 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dmuted ", 7 ) ) { |
klauss | 119:ee6a53069455 | 1188 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) { |
klauss | 81:3656f00ab3db | 1189 | miss_match = false; |
klauss | 119:ee6a53069455 | 1190 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rMuted Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1191 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1192 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Muted Debug On\n\r"); |
klauss | 81:3656f00ab3db | 1193 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1194 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1195 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1196 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1197 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1198 | } |
klauss | 81:3656f00ab3db | 1199 | } |
klauss | 81:3656f00ab3db | 1200 | debug_muted = true; |
klauss | 81:3656f00ab3db | 1201 | } |
klauss | 81:3656f00ab3db | 1202 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { |
klauss | 81:3656f00ab3db | 1203 | miss_match = false; |
klauss | 119:ee6a53069455 | 1204 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rMuted Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1205 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1206 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Muted Debug Off\n\r"); |
klauss | 81:3656f00ab3db | 1207 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1208 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1209 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1210 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1211 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1212 | } |
klauss | 81:3656f00ab3db | 1213 | } |
klauss | 81:3656f00ab3db | 1214 | debug_muted = false; |
klauss | 81:3656f00ab3db | 1215 | } |
klauss | 81:3656f00ab3db | 1216 | } |
klauss | 114:472502b31a12 | 1217 | |
klauss | 119:ee6a53069455 | 1218 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwdt ", 5 ) ) { |
klauss | 119:ee6a53069455 | 1219 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on", 2 ) ) { |
klauss | 81:3656f00ab3db | 1220 | miss_match = false; |
klauss | 119:ee6a53069455 | 1221 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1222 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1223 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt Debug On\n\r"); |
klauss | 81:3656f00ab3db | 1224 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1225 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1226 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1227 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1228 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1229 | } |
klauss | 81:3656f00ab3db | 1230 | } |
klauss | 81:3656f00ab3db | 1231 | wdt_show = true; |
klauss | 81:3656f00ab3db | 1232 | } |
klauss | 81:3656f00ab3db | 1233 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { |
klauss | 81:3656f00ab3db | 1234 | miss_match = false; |
klauss | 119:ee6a53069455 | 1235 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWdt Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1236 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1237 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wdt Debug Off\n\r"); |
klauss | 81:3656f00ab3db | 1238 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1239 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1240 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1241 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1242 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1243 | } |
klauss | 81:3656f00ab3db | 1244 | } |
klauss | 81:3656f00ab3db | 1245 | wdt_show = false; |
klauss | 81:3656f00ab3db | 1246 | } |
klauss | 81:3656f00ab3db | 1247 | } |
klauss | 114:472502b31a12 | 1248 | |
klauss | 119:ee6a53069455 | 1249 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drefresh ", 9 ) ) { |
klauss | 119:ee6a53069455 | 1250 | if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ) { |
klauss | 81:3656f00ab3db | 1251 | miss_match = false; |
klauss | 119:ee6a53069455 | 1252 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRefresh Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1253 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1254 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Refresh Debug On\n\r"); |
klauss | 81:3656f00ab3db | 1255 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1256 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1257 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1258 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1259 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1260 | } |
klauss | 81:3656f00ab3db | 1261 | } |
klauss | 81:3656f00ab3db | 1262 | debug_refresh= true; |
klauss | 81:3656f00ab3db | 1263 | } |
klauss | 81:3656f00ab3db | 1264 | if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off",3 )) { |
klauss | 81:3656f00ab3db | 1265 | miss_match = false; |
klauss | 119:ee6a53069455 | 1266 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rRefresh Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1267 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1268 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Refresh Debug Off\n\r"); |
klauss | 81:3656f00ab3db | 1269 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1270 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1271 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1272 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1273 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1274 | } |
klauss | 81:3656f00ab3db | 1275 | } |
klauss | 81:3656f00ab3db | 1276 | debug_refresh = false; |
klauss | 81:3656f00ab3db | 1277 | } |
klauss | 81:3656f00ab3db | 1278 | } |
klauss | 114:472502b31a12 | 1279 | |
klauss | 119:ee6a53069455 | 1280 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dping ", 6 ) ) { |
klauss | 119:ee6a53069455 | 1281 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1282 | miss_match = false; |
klauss | 119:ee6a53069455 | 1283 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPing Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1284 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1285 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Ping Debug On\n\r"); |
klauss | 78:1353744f01e1 | 1286 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1287 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1288 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1289 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1290 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1291 | } |
klauss | 78:1353744f01e1 | 1292 | } |
klauss | 78:1353744f01e1 | 1293 | debug_ping = true; |
klauss | 78:1353744f01e1 | 1294 | } |
klauss | 78:1353744f01e1 | 1295 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 )) { |
klauss | 78:1353744f01e1 | 1296 | miss_match = false; |
klauss | 119:ee6a53069455 | 1297 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rPing Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1298 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1299 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Ping Debug Off\n\r"); |
klauss | 78:1353744f01e1 | 1300 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1301 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1302 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1303 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1304 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1305 | } |
klauss | 78:1353744f01e1 | 1306 | } |
klauss | 78:1353744f01e1 | 1307 | debug_ping= false; |
klauss | 78:1353744f01e1 | 1308 | } |
klauss | 78:1353744f01e1 | 1309 | } |
klauss | 114:472502b31a12 | 1310 | |
klauss | 119:ee6a53069455 | 1311 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dwu ", 4 ) ) { |
klauss | 119:ee6a53069455 | 1312 | if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1313 | miss_match = false; |
klauss | 119:ee6a53069455 | 1314 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWake Up Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1315 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1316 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wake Up Debug On\n\r"); |
klauss | 78:1353744f01e1 | 1317 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1318 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1319 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1320 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1321 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1322 | } |
klauss | 78:1353744f01e1 | 1323 | } |
klauss | 78:1353744f01e1 | 1324 | debug_wake = true; |
klauss | 78:1353744f01e1 | 1325 | } |
klauss | 78:1353744f01e1 | 1326 | if (xmemmatch( (uint8_t*)(debug_buf + 4 ), (uint8_t*) "off",3 )) { |
klauss | 78:1353744f01e1 | 1327 | miss_match = false; |
klauss | 119:ee6a53069455 | 1328 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rWake Up Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1329 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1330 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Wake Up Debug Off\n\r"); |
klauss | 78:1353744f01e1 | 1331 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1332 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1333 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1334 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1335 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1336 | } |
klauss | 78:1353744f01e1 | 1337 | } |
klauss | 78:1353744f01e1 | 1338 | debug_wake = false; |
klauss | 78:1353744f01e1 | 1339 | } |
klauss | 78:1353744f01e1 | 1340 | } |
klauss | 114:472502b31a12 | 1341 | |
klauss | 119:ee6a53069455 | 1342 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "tcp_alive ", 10 ) ) { |
klauss | 119:ee6a53069455 | 1343 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1344 | miss_match = false; |
klauss | 119:ee6a53069455 | 1345 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTCP don't drop mode on\n\r" ); |
klauss | 119:ee6a53069455 | 1346 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1347 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "TCP don't drop mode on\n\r"); |
klauss | 78:1353744f01e1 | 1348 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1349 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1350 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1351 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1352 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1353 | } |
klauss | 78:1353744f01e1 | 1354 | } |
klauss | 78:1353744f01e1 | 1355 | tcp_alive = true; |
klauss | 78:1353744f01e1 | 1356 | } |
klauss | 78:1353744f01e1 | 1357 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 )) { |
klauss | 78:1353744f01e1 | 1358 | miss_match = false; |
klauss | 119:ee6a53069455 | 1359 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTCP don't drop mode off\n\r" ); |
klauss | 119:ee6a53069455 | 1360 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1361 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "TCP don't drop mode off\n\r"); |
klauss | 78:1353744f01e1 | 1362 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1363 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1364 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1365 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1366 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1367 | } |
klauss | 78:1353744f01e1 | 1368 | } |
klauss | 78:1353744f01e1 | 1369 | tcp_alive = false; |
klauss | 78:1353744f01e1 | 1370 | } |
klauss | 78:1353744f01e1 | 1371 | } |
klauss | 114:472502b31a12 | 1372 | |
klauss | 119:ee6a53069455 | 1373 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "daging ",7 ) ) { |
klauss | 119:ee6a53069455 | 1374 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1375 | miss_match = false; |
klauss | 119:ee6a53069455 | 1376 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rAging Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1377 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1378 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Aging Debug On\n\r"); |
klauss | 78:1353744f01e1 | 1379 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1380 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1381 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1382 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1383 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1384 | } |
klauss | 78:1353744f01e1 | 1385 | } |
klauss | 78:1353744f01e1 | 1386 | debug_aging = true; |
klauss | 78:1353744f01e1 | 1387 | } |
klauss | 78:1353744f01e1 | 1388 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off",3 )) { |
klauss | 78:1353744f01e1 | 1389 | miss_match = false; |
klauss | 119:ee6a53069455 | 1390 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rAging Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1391 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1392 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Aging Debug Off\n\r"); |
klauss | 78:1353744f01e1 | 1393 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1394 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1395 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1396 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1397 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1398 | } |
klauss | 78:1353744f01e1 | 1399 | } |
klauss | 78:1353744f01e1 | 1400 | debug_aging = false; |
klauss | 78:1353744f01e1 | 1401 | } |
klauss | 78:1353744f01e1 | 1402 | } |
klauss | 114:472502b31a12 | 1403 | |
klauss | 119:ee6a53069455 | 1404 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcpld ", 6 ) ) { |
klauss | 119:ee6a53069455 | 1405 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1406 | miss_match = false; |
klauss | 119:ee6a53069455 | 1407 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1408 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1409 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Debug On\n\r"); |
klauss | 78:1353744f01e1 | 1410 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1411 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1412 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1413 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1414 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1415 | } |
klauss | 78:1353744f01e1 | 1416 | } |
klauss | 78:1353744f01e1 | 1417 | debug_cpld = true; |
klauss | 119:ee6a53069455 | 1418 | debug_cb_rx = true; |
klauss | 119:ee6a53069455 | 1419 | debug_cb_tx = true; |
klauss | 78:1353744f01e1 | 1420 | } |
klauss | 119:ee6a53069455 | 1421 | if (xmemmatch( (uint8_t*)(debug_buf + 6 ), (uint8_t*) "off",3 ) ) { |
klauss | 78:1353744f01e1 | 1422 | miss_match = false; |
klauss | 119:ee6a53069455 | 1423 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1424 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1425 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Debug Off\n\r"); |
klauss | 78:1353744f01e1 | 1426 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1427 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1428 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1429 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1430 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1431 | } |
klauss | 78:1353744f01e1 | 1432 | } |
klauss | 78:1353744f01e1 | 1433 | debug_cpld = false; |
klauss | 119:ee6a53069455 | 1434 | debug_cb_rx = false; |
klauss | 119:ee6a53069455 | 1435 | debug_cb_tx = false; |
klauss | 78:1353744f01e1 | 1436 | } |
klauss | 78:1353744f01e1 | 1437 | } |
klauss | 78:1353744f01e1 | 1438 | |
klauss | 119:ee6a53069455 | 1439 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dshowcpld ", 10 ) ) { |
klauss | 119:ee6a53069455 | 1440 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1441 | miss_match = false; |
klauss | 119:ee6a53069455 | 1442 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1443 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1444 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show Debug On\n\r"); |
klauss | 119:ee6a53069455 | 1445 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1446 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1447 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1448 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1449 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1450 | } |
klauss | 119:ee6a53069455 | 1451 | } |
klauss | 119:ee6a53069455 | 1452 | debug_show_cpld = true; |
klauss | 119:ee6a53069455 | 1453 | } |
klauss | 119:ee6a53069455 | 1454 | if (xmemmatch( (uint8_t*)(debug_buf + 10 ), (uint8_t*) "off",3 ) ) { |
klauss | 113:db67ae00550e | 1455 | miss_match = false; |
klauss | 119:ee6a53069455 | 1456 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rDCPLD Show Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1457 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1458 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "DCPLD Show Debug Off\n\r"); |
klauss | 105:a930035b6556 | 1459 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1460 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1461 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1462 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1463 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1464 | } |
klauss | 119:ee6a53069455 | 1465 | } |
klauss | 119:ee6a53069455 | 1466 | debug_show_cpld = false; |
klauss | 119:ee6a53069455 | 1467 | } |
klauss | 119:ee6a53069455 | 1468 | } |
klauss | 119:ee6a53069455 | 1469 | |
klauss | 119:ee6a53069455 | 1470 | |
klauss | 119:ee6a53069455 | 1471 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks_err ", 9 ) ){ |
klauss | 119:ee6a53069455 | 1472 | if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "on", 2 ) ) { |
klauss | 119:ee6a53069455 | 1473 | miss_match = false; |
klauss | 119:ee6a53069455 | 1474 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rCKS_ERR Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1475 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1476 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS_ERR Debug On\n\r"); |
klauss | 119:ee6a53069455 | 1477 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1478 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1479 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1480 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1481 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1482 | } |
klauss | 78:1353744f01e1 | 1483 | } |
klauss | 78:1353744f01e1 | 1484 | debug_cks_err = true; |
klauss | 78:1353744f01e1 | 1485 | } |
klauss | 119:ee6a53069455 | 1486 | if (xmemmatch( (uint8_t*)(debug_buf + 9 ), (uint8_t*) "off", 3 ) ) { |
klauss | 78:1353744f01e1 | 1487 | miss_match = false; |
klauss | 119:ee6a53069455 | 1488 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rCKS_ERR Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1489 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1490 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS_ERR Debug off\n\r"); |
klauss | 78:1353744f01e1 | 1491 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1492 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1493 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1494 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1495 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1496 | } |
klauss | 78:1353744f01e1 | 1497 | } |
klauss | 78:1353744f01e1 | 1498 | debug_cks_err = false; |
klauss | 78:1353744f01e1 | 1499 | } |
klauss | 78:1353744f01e1 | 1500 | } |
klauss | 114:472502b31a12 | 1501 | |
klauss | 114:472502b31a12 | 1502 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dinvite ", 8 ) ){ |
klauss | 119:ee6a53069455 | 1503 | if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "on", 2 ) ) { |
klauss | 78:1353744f01e1 | 1504 | miss_match = false; |
klauss | 119:ee6a53069455 | 1505 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rInvite Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1506 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1507 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Invite Debug On\n\r"); |
klauss | 78:1353744f01e1 | 1508 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1509 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1510 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1511 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1512 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1513 | } |
klauss | 78:1353744f01e1 | 1514 | } |
klauss | 81:3656f00ab3db | 1515 | debug_invite = true; |
klauss | 78:1353744f01e1 | 1516 | } |
klauss | 78:1353744f01e1 | 1517 | if( xmemmatch( (uint8_t*)(debug_buf + 8 ), (uint8_t*) "off",3 )) { |
klauss | 78:1353744f01e1 | 1518 | miss_match = false; |
klauss | 119:ee6a53069455 | 1519 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rInvite Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1520 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1521 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Invite Debug Off\n\r"); |
klauss | 78:1353744f01e1 | 1522 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1523 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1524 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1525 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1526 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1527 | } |
klauss | 78:1353744f01e1 | 1528 | } |
klauss | 78:1353744f01e1 | 1529 | debug_invite = 0; |
klauss | 45:c80574f24dc3 | 1530 | } |
klauss | 45:c80574f24dc3 | 1531 | } |
klauss | 114:472502b31a12 | 1532 | |
klauss | 119:ee6a53069455 | 1533 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dparallel ", 10 ) ) { |
klauss | 119:ee6a53069455 | 1534 | if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t * )"on", 2 ) ) { |
klauss | 72:895ca792c647 | 1535 | miss_match = false; |
klauss | 119:ee6a53069455 | 1536 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rParallel Write Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1537 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1538 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rParallel Write Debug ON\n\r"); |
klauss | 72:895ca792c647 | 1539 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1540 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1541 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1542 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1543 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1544 | } |
klauss | 72:895ca792c647 | 1545 | } |
klauss | 72:895ca792c647 | 1546 | dparallel = true; |
klauss | 72:895ca792c647 | 1547 | } |
klauss | 72:895ca792c647 | 1548 | if( xmemmatch( ( uint8_t * )( debug_buf + 10 ), ( uint8_t *)"off", 3 )) { |
klauss | 72:895ca792c647 | 1549 | miss_match = false; |
klauss | 119:ee6a53069455 | 1550 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rParallel Write Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1551 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1552 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rParallel Write Debug Off\n\r"); |
klauss | 72:895ca792c647 | 1553 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1554 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1555 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1556 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1557 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1558 | } |
klauss | 72:895ca792c647 | 1559 | } |
klauss | 72:895ca792c647 | 1560 | dparallel = false; |
klauss | 72:895ca792c647 | 1561 | } |
klauss | 72:895ca792c647 | 1562 | } |
klauss | 119:ee6a53069455 | 1563 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtelos ", 7 ) ) { |
klauss | 119:ee6a53069455 | 1564 | if (xmemmatch( (uint8_t*)( debug_buf + 7 ), (uint8_t*) "on", 2 ) ) { |
klauss | 53:bb492a8f115a | 1565 | miss_match = false; |
klauss | 119:ee6a53069455 | 1566 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTelemetry Debug ON\n\r" ); |
klauss | 119:ee6a53069455 | 1567 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1568 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rTelemetry Debug On\n\r"); |
klauss | 53:bb492a8f115a | 1569 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1570 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1571 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1572 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1573 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1574 | } |
klauss | 53:bb492a8f115a | 1575 | } |
klauss | 53:bb492a8f115a | 1576 | debug_telemetry = true; |
klauss | 53:bb492a8f115a | 1577 | } |
klauss | 78:1353744f01e1 | 1578 | if (xmemmatch( (uint8_t*)(debug_buf + 7 ), (uint8_t*) "off", 3 )) { |
klauss | 53:bb492a8f115a | 1579 | miss_match = false; |
klauss | 119:ee6a53069455 | 1580 | if( debug_uart3 && !( from_eth ) ) pc.printf( "\n\rTelemetry Debug OFF\n\r" ); |
klauss | 119:ee6a53069455 | 1581 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 1582 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rTelemetry Debug Off\n\r"); |
klauss | 53:bb492a8f115a | 1583 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 1584 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 1585 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 1586 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1587 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 1588 | } |
klauss | 53:bb492a8f115a | 1589 | } |
klauss | 53:bb492a8f115a | 1590 | debug_telemetry = false; |
klauss | 53:bb492a8f115a | 1591 | } |
klauss | 53:bb492a8f115a | 1592 | } |
klauss | 114:472502b31a12 | 1593 | |
klauss | 114:472502b31a12 | 1594 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dcks ", 5 ) ){ |
klauss | 114:472502b31a12 | 1595 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "on",2 ) ){ |
klauss | 45:c80574f24dc3 | 1596 | miss_match = false; |
klauss | 114:472502b31a12 | 1597 | if( debug_uart3 ) pc.printf( "\n\rCKS Debug ON\n\r" ); |
klauss | 114:472502b31a12 | 1598 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 1599 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS Debug On\n\r" ); |
klauss | 45:c80574f24dc3 | 1600 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 45:c80574f24dc3 | 1601 | } |
klauss | 78:1353744f01e1 | 1602 | debug_cks = true; |
klauss | 45:c80574f24dc3 | 1603 | } |
klauss | 50:d9b6577a70f5 | 1604 | if (xmemmatch( (uint8_t*)(debug_buf + 5 ), (uint8_t*) "off",3 )) { |
klauss | 45:c80574f24dc3 | 1605 | miss_match = false; |
klauss | 114:472502b31a12 | 1606 | if( debug_uart3 ) pc.printf( "\n\rCKS Debug OFF\n\r" ); |
klauss | 114:472502b31a12 | 1607 | if( from_eth ){ |
klauss | 119:ee6a53069455 | 1608 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "CKS Debug Off\n\r" ); |
klauss | 45:c80574f24dc3 | 1609 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 45:c80574f24dc3 | 1610 | } |
klauss | 78:1353744f01e1 | 1611 | debug_cks = false; |
klauss | 45:c80574f24dc3 | 1612 | } |
klauss | 45:c80574f24dc3 | 1613 | } |
klauss | 114:472502b31a12 | 1614 | |
klauss | 119:ee6a53069455 | 1615 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "pcb ", 4 )) { |
klauss | 78:1353744f01e1 | 1616 | miss_match = false; |
klauss | 78:1353744f01e1 | 1617 | int ext,port; |
klauss | 78:1353744f01e1 | 1618 | char *split, *ref, *cmd; |
klauss | 119:ee6a53069455 | 1619 | |
klauss | 78:1353744f01e1 | 1620 | ref = debug_buf; |
klauss | 119:ee6a53069455 | 1621 | |
klauss | 78:1353744f01e1 | 1622 | strcat( debug_buf, "\r" ); |
klauss | 119:ee6a53069455 | 1623 | |
klauss | 119:ee6a53069455 | 1624 | split = strtok( debug_buf + 4, " " ); |
klauss | 78:1353744f01e1 | 1625 | ext = atoi( split ); |
klauss | 119:ee6a53069455 | 1626 | |
klauss | 119:ee6a53069455 | 1627 | port = convert_ext_to_port( ext ); |
klauss | 78:1353744f01e1 | 1628 | split += strlen( split ) + 1; |
klauss | 78:1353744f01e1 | 1629 | cmd = split; |
klauss | 119:ee6a53069455 | 1630 | |
klauss | 78:1353744f01e1 | 1631 | promptcb_last_ext = ext; |
klauss | 78:1353744f01e1 | 1632 | promptcb_last_port = port; |
klauss | 119:ee6a53069455 | 1633 | |
klauss | 78:1353744f01e1 | 1634 | strcpy( promptcb_last_cmd, cmd ); |
klauss | 119:ee6a53069455 | 1635 | |
klauss | 119:ee6a53069455 | 1636 | for( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd[ i ] = 0; |
klauss | 119:ee6a53069455 | 1637 | |
klauss | 119:ee6a53069455 | 1638 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1639 | send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 119:ee6a53069455 | 1640 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado"); |
klauss | 119:ee6a53069455 | 1641 | |
klauss | 119:ee6a53069455 | 1642 | if( from_eth ) { |
klauss | 78:1353744f01e1 | 1643 | char eth_msg[ 512 ]; |
klauss | 119:ee6a53069455 | 1644 | snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r> ", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1645 | if( tcp_session && !udp_query ) { |
klauss | 78:1353744f01e1 | 1646 | tcp_client.send_all( eth_msg, strlen( eth_msg ) ); |
klauss | 119:ee6a53069455 | 1647 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1648 | udp_query_send_msg( eth_msg ); |
klauss | 78:1353744f01e1 | 1649 | } |
klauss | 78:1353744f01e1 | 1650 | } |
klauss | 119:ee6a53069455 | 1651 | |
klauss | 78:1353744f01e1 | 1652 | debug_buf = ref; |
klauss | 78:1353744f01e1 | 1653 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1654 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 78:1353744f01e1 | 1655 | } |
klauss | 114:472502b31a12 | 1656 | |
klauss | 114:472502b31a12 | 1657 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "bye ", 4 ) ){ |
klauss | 92:92df17f538a8 | 1658 | miss_match = false; |
klauss | 92:92df17f538a8 | 1659 | int ext,port; |
klauss | 92:92df17f538a8 | 1660 | char *split, *ref; |
klauss | 114:472502b31a12 | 1661 | uint8_t write_buffer[ 300 ], data[ 300 ]; |
klauss | 114:472502b31a12 | 1662 | |
klauss | 92:92df17f538a8 | 1663 | ref = debug_buf; |
klauss | 114:472502b31a12 | 1664 | |
klauss | 92:92df17f538a8 | 1665 | strcat( debug_buf, "\r\r\r\n" ); |
klauss | 114:472502b31a12 | 1666 | |
klauss | 92:92df17f538a8 | 1667 | split = strtok( debug_buf + 4, " " ); |
klauss | 92:92df17f538a8 | 1668 | ext = atoi( split ); |
klauss | 92:92df17f538a8 | 1669 | port = convert_ext_to_port( ext ); |
klauss | 114:472502b31a12 | 1670 | |
klauss | 114:472502b31a12 | 1671 | if( debug_uart3 ) pc.printf("\r\next=%d port=%d request bye", ext, port ); |
klauss | 119:ee6a53069455 | 1672 | send2callboxes( build_cb_package( ext, port, CB_BYE, (char * )data, 0x20, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 114:472502b31a12 | 1673 | if( debug_uart3 ) pc.printf("\n\rBye enviado"); |
klauss | 114:472502b31a12 | 1674 | |
klauss | 114:472502b31a12 | 1675 | if( from_eth ){ |
klauss | 92:92df17f538a8 | 1676 | char eth_msg[ 512 ]; |
klauss | 92:92df17f538a8 | 1677 | snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d request bye\n\r", ext, port ); |
klauss | 119:ee6a53069455 | 1678 | if( tcp_session && !udp_query ) { |
klauss | 92:92df17f538a8 | 1679 | tcp_client.send_all( eth_msg, strlen( eth_msg ) ); |
klauss | 119:ee6a53069455 | 1680 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1681 | udp_query_send_msg( eth_msg ); |
klauss | 92:92df17f538a8 | 1682 | } |
klauss | 92:92df17f538a8 | 1683 | } |
klauss | 119:ee6a53069455 | 1684 | |
klauss | 92:92df17f538a8 | 1685 | debug_buf = ref; |
klauss | 92:92df17f538a8 | 1686 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1687 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 45:c80574f24dc3 | 1688 | } |
klauss | 114:472502b31a12 | 1689 | |
klauss | 98:43b45f26b430 | 1690 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "pcc ", 4 )) { |
klauss | 98:43b45f26b430 | 1691 | miss_match = false; |
klauss | 98:43b45f26b430 | 1692 | int ext,port; |
klauss | 98:43b45f26b430 | 1693 | char *split, *ref, *cmd; |
klauss | 119:ee6a53069455 | 1694 | |
klauss | 98:43b45f26b430 | 1695 | ref = debug_buf; |
klauss | 119:ee6a53069455 | 1696 | |
klauss | 98:43b45f26b430 | 1697 | strcat( debug_buf, "\r" ); |
klauss | 119:ee6a53069455 | 1698 | |
klauss | 98:43b45f26b430 | 1699 | split = strtok( debug_buf + 4, " " ); |
klauss | 98:43b45f26b430 | 1700 | ext = atoi( split ); |
klauss | 119:ee6a53069455 | 1701 | |
klauss | 98:43b45f26b430 | 1702 | split += strlen( split ) + 1; |
klauss | 98:43b45f26b430 | 1703 | split = strtok( NULL, " " ); |
klauss | 98:43b45f26b430 | 1704 | port = atoi( split ); |
klauss | 119:ee6a53069455 | 1705 | |
klauss | 98:43b45f26b430 | 1706 | split += strlen( split ) + 1; |
klauss | 98:43b45f26b430 | 1707 | cmd = split; |
klauss | 119:ee6a53069455 | 1708 | |
klauss | 98:43b45f26b430 | 1709 | promptcb_last_ext = ext; |
klauss | 98:43b45f26b430 | 1710 | promptcb_last_port = port; |
klauss | 119:ee6a53069455 | 1711 | |
klauss | 98:43b45f26b430 | 1712 | strcpy( promptcb_last_cmd, cmd ); |
klauss | 119:ee6a53069455 | 1713 | |
klauss | 119:ee6a53069455 | 1714 | for( register int i = strlen( cmd ); i < DEBUGBUFSIZE; i++ ) cmd[ i ] = 0; |
klauss | 119:ee6a53069455 | 1715 | |
klauss | 119:ee6a53069455 | 1716 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1717 | send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 119:ee6a53069455 | 1718 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado"); |
klauss | 119:ee6a53069455 | 1719 | |
klauss | 119:ee6a53069455 | 1720 | if( from_eth ) { |
klauss | 98:43b45f26b430 | 1721 | char eth_msg[ 512 ]; |
klauss | 98:43b45f26b430 | 1722 | snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1723 | if( tcp_session && !udp_query ) { |
klauss | 98:43b45f26b430 | 1724 | tcp_client.send_all( eth_msg, strlen( eth_msg ) ); |
klauss | 119:ee6a53069455 | 1725 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1726 | udp_query_send_msg( eth_msg ); |
klauss | 98:43b45f26b430 | 1727 | } |
klauss | 98:43b45f26b430 | 1728 | } |
klauss | 119:ee6a53069455 | 1729 | |
klauss | 98:43b45f26b430 | 1730 | debug_buf = ref; |
klauss | 98:43b45f26b430 | 1731 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1732 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1733 | } |
klauss | 114:472502b31a12 | 1734 | |
klauss | 114:472502b31a12 | 1735 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_cb ", 9 )) { |
klauss | 114:472502b31a12 | 1736 | miss_match = false; |
klauss | 114:472502b31a12 | 1737 | char *split; |
klauss | 114:472502b31a12 | 1738 | |
klauss | 114:472502b31a12 | 1739 | split = strtok( debug_buf + 9, " " ); |
klauss | 114:472502b31a12 | 1740 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1741 | { |
klauss | 114:472502b31a12 | 1742 | print_cb_all = true; |
klauss | 114:472502b31a12 | 1743 | } |
klauss | 114:472502b31a12 | 1744 | else |
klauss | 114:472502b31a12 | 1745 | { |
klauss | 114:472502b31a12 | 1746 | print_cb_var = true; |
klauss | 114:472502b31a12 | 1747 | print_this_cb = atoi( split ); |
klauss | 114:472502b31a12 | 1748 | } |
klauss | 114:472502b31a12 | 1749 | |
klauss | 114:472502b31a12 | 1750 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1751 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 1752 | } |
klauss | 119:ee6a53069455 | 1753 | |
klauss | 119:ee6a53069455 | 1754 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drop_ack ", 9 )) { |
klauss | 119:ee6a53069455 | 1755 | miss_match = false; |
klauss | 119:ee6a53069455 | 1756 | char *split; |
klauss | 119:ee6a53069455 | 1757 | |
klauss | 119:ee6a53069455 | 1758 | split = strtok( debug_buf + 9, " " ); |
klauss | 119:ee6a53069455 | 1759 | |
klauss | 119:ee6a53069455 | 1760 | drop_this_amount_of_ack_to_ast = atoi( split ); |
klauss | 119:ee6a53069455 | 1761 | |
klauss | 119:ee6a53069455 | 1762 | send_msg("Will be droped %d acks", drop_this_amount_of_ack_to_ast ); |
klauss | 119:ee6a53069455 | 1763 | |
klauss | 119:ee6a53069455 | 1764 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1765 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1766 | } |
klauss | 114:472502b31a12 | 1767 | |
klauss | 114:472502b31a12 | 1768 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "frtp ", 5 )) { |
klauss | 114:472502b31a12 | 1769 | miss_match = false; |
klauss | 114:472502b31a12 | 1770 | char *split; |
klauss | 114:472502b31a12 | 1771 | |
klauss | 114:472502b31a12 | 1772 | split = strtok( debug_buf + 5, " " ); |
klauss | 114:472502b31a12 | 1773 | frtp = true; |
klauss | 114:472502b31a12 | 1774 | frtp_target = atoi( split ); |
klauss | 114:472502b31a12 | 1775 | |
klauss | 114:472502b31a12 | 1776 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1777 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1778 | } |
klauss | 114:472502b31a12 | 1779 | |
klauss | 114:472502b31a12 | 1780 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "rrtp ", 5 )) { |
klauss | 114:472502b31a12 | 1781 | miss_match = false; |
klauss | 114:472502b31a12 | 1782 | char *split; |
klauss | 114:472502b31a12 | 1783 | |
klauss | 114:472502b31a12 | 1784 | split = strtok( debug_buf + 5, " " ); |
klauss | 114:472502b31a12 | 1785 | rescue_rtp = true; |
klauss | 114:472502b31a12 | 1786 | rescue_rtp_target = atoi( split ); |
klauss | 114:472502b31a12 | 1787 | |
klauss | 114:472502b31a12 | 1788 | split += strlen( split ) + 1; |
klauss | 114:472502b31a12 | 1789 | split = strtok( NULL, " " ); |
klauss | 114:472502b31a12 | 1790 | rescue_rtp_value = atoi( split ); |
klauss | 114:472502b31a12 | 1791 | |
klauss | 114:472502b31a12 | 1792 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1793 | for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1794 | } |
klauss | 114:472502b31a12 | 1795 | |
klauss | 114:472502b31a12 | 1796 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_cb ", 13 )) { |
klauss | 114:472502b31a12 | 1797 | miss_match = false; |
klauss | 114:472502b31a12 | 1798 | char *split; |
klauss | 114:472502b31a12 | 1799 | |
klauss | 114:472502b31a12 | 1800 | split = strtok( debug_buf + 13, " " ); |
klauss | 114:472502b31a12 | 1801 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1802 | { |
klauss | 114:472502b31a12 | 1803 | print_hex_cb_all = true; |
klauss | 114:472502b31a12 | 1804 | } |
klauss | 114:472502b31a12 | 1805 | else |
klauss | 114:472502b31a12 | 1806 | { |
klauss | 114:472502b31a12 | 1807 | print_hex_cb_var = true; |
klauss | 114:472502b31a12 | 1808 | print_hex_this_cb = atoi( split ); |
klauss | 114:472502b31a12 | 1809 | } |
klauss | 114:472502b31a12 | 1810 | |
klauss | 114:472502b31a12 | 1811 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1812 | for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1813 | } |
klauss | 114:472502b31a12 | 1814 | |
klauss | 114:472502b31a12 | 1815 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_sip ", 10 )) { |
klauss | 114:472502b31a12 | 1816 | miss_match = false; |
klauss | 114:472502b31a12 | 1817 | char *split; |
klauss | 114:472502b31a12 | 1818 | |
klauss | 114:472502b31a12 | 1819 | split = strtok( debug_buf + 10, " " ); |
klauss | 114:472502b31a12 | 1820 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1821 | { |
klauss | 114:472502b31a12 | 1822 | print_sip_all = true; |
klauss | 114:472502b31a12 | 1823 | } |
klauss | 114:472502b31a12 | 1824 | else |
klauss | 114:472502b31a12 | 1825 | { |
klauss | 114:472502b31a12 | 1826 | print_sip_var = true; |
klauss | 114:472502b31a12 | 1827 | print_this_sip = atoi( split ); |
klauss | 114:472502b31a12 | 1828 | } |
klauss | 114:472502b31a12 | 1829 | |
klauss | 114:472502b31a12 | 1830 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1831 | for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 98:43b45f26b430 | 1832 | } |
klauss | 114:472502b31a12 | 1833 | |
klauss | 114:472502b31a12 | 1834 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_sip ", 14 )) { |
klauss | 114:472502b31a12 | 1835 | miss_match = false; |
klauss | 114:472502b31a12 | 1836 | char *split; |
klauss | 114:472502b31a12 | 1837 | |
klauss | 114:472502b31a12 | 1838 | split = strtok( debug_buf + 14, " " ); |
klauss | 114:472502b31a12 | 1839 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1840 | { |
klauss | 114:472502b31a12 | 1841 | print_hex_sip_all = true; |
klauss | 114:472502b31a12 | 1842 | } |
klauss | 114:472502b31a12 | 1843 | else |
klauss | 114:472502b31a12 | 1844 | { |
klauss | 114:472502b31a12 | 1845 | print_hex_sip_var = true; |
klauss | 114:472502b31a12 | 1846 | print_hex_this_sip = atoi( split ); |
klauss | 114:472502b31a12 | 1847 | } |
klauss | 114:472502b31a12 | 1848 | |
klauss | 114:472502b31a12 | 1849 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1850 | for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1851 | } |
klauss | 114:472502b31a12 | 1852 | |
klauss | 114:472502b31a12 | 1853 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_call ", 11 ) ) |
klauss | 114:472502b31a12 | 1854 | { |
klauss | 114:472502b31a12 | 1855 | miss_match = false; |
klauss | 114:472502b31a12 | 1856 | char *split; |
klauss | 114:472502b31a12 | 1857 | |
klauss | 114:472502b31a12 | 1858 | split = strtok( debug_buf + 11, " " ); |
klauss | 114:472502b31a12 | 1859 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1860 | { |
klauss | 114:472502b31a12 | 1861 | print_call_all = true; |
klauss | 114:472502b31a12 | 1862 | } |
klauss | 114:472502b31a12 | 1863 | else |
klauss | 114:472502b31a12 | 1864 | { |
klauss | 114:472502b31a12 | 1865 | print_call_var = true; |
klauss | 114:472502b31a12 | 1866 | print_this_call = atoi( split ); |
klauss | 114:472502b31a12 | 1867 | } |
klauss | 114:472502b31a12 | 1868 | |
klauss | 114:472502b31a12 | 1869 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1870 | for( register uint16_t i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 114:472502b31a12 | 1871 | } |
klauss | 114:472502b31a12 | 1872 | |
klauss | 114:472502b31a12 | 1873 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "print_hex_call ", 15 ) ) |
klauss | 114:472502b31a12 | 1874 | { |
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 + 15, " " ); |
klauss | 114:472502b31a12 | 1879 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1880 | { |
klauss | 114:472502b31a12 | 1881 | print_hex_call_all = true; |
klauss | 114:472502b31a12 | 1882 | } |
klauss | 114:472502b31a12 | 1883 | else |
klauss | 114:472502b31a12 | 1884 | { |
klauss | 114:472502b31a12 | 1885 | print_hex_call_var = true; |
klauss | 114:472502b31a12 | 1886 | print_hex_this_call = 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_rtp ", 10 ) ) |
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 + 10, " " ); |
klauss | 114:472502b31a12 | 1899 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1900 | { |
klauss | 114:472502b31a12 | 1901 | print_rtp_all = true; |
klauss | 114:472502b31a12 | 1902 | } |
klauss | 114:472502b31a12 | 1903 | else |
klauss | 114:472502b31a12 | 1904 | { |
klauss | 114:472502b31a12 | 1905 | print_rtp_var = true; |
klauss | 114:472502b31a12 | 1906 | print_this_rtp = 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_rtp ", 14 ) ) |
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 + 14, " " ); |
klauss | 114:472502b31a12 | 1919 | if( 0 == ( strcasecmp( split, "all" ) ) ) |
klauss | 114:472502b31a12 | 1920 | { |
klauss | 114:472502b31a12 | 1921 | print_hex_rtp_all = true; |
klauss | 114:472502b31a12 | 1922 | } |
klauss | 114:472502b31a12 | 1923 | else |
klauss | 114:472502b31a12 | 1924 | { |
klauss | 114:472502b31a12 | 1925 | print_hex_rtp_var = true; |
klauss | 114:472502b31a12 | 1926 | print_hex_this_rtp = 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*) "log ", 4 )) { |
klauss | 114:472502b31a12 | 1934 | miss_match = false; |
klauss | 114:472502b31a12 | 1935 | |
klauss | 114:472502b31a12 | 1936 | char * split = strtok( debug_buf + 4, " " ); |
klauss | 114:472502b31a12 | 1937 | |
klauss | 114:472502b31a12 | 1938 | { |
klauss | 114:472502b31a12 | 1939 | print_cb_var = true; |
klauss | 114:472502b31a12 | 1940 | print_this_cb = atoi( split ); |
klauss | 114:472502b31a12 | 1941 | print_sip_var = true; |
klauss | 114:472502b31a12 | 1942 | print_this_sip = print_this_cb; |
klauss | 114:472502b31a12 | 1943 | print_call_var = true; |
klauss | 114:472502b31a12 | 1944 | print_this_call = print_this_cb; |
klauss | 114:472502b31a12 | 1945 | print_rtp_var = true; |
klauss | 114:472502b31a12 | 1946 | print_this_rtp = print_this_cb; |
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 | |
klauss | 117:e9facba9db27 | 1954 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "rush ", 5 )) { |
klauss | 99:e80850c51106 | 1955 | miss_match = false; |
klauss | 99:e80850c51106 | 1956 | int ext,port; |
klauss | 99:e80850c51106 | 1957 | char *split, *ref, cmd[ 32 ]; |
klauss | 119:ee6a53069455 | 1958 | |
klauss | 99:e80850c51106 | 1959 | ref = debug_buf; |
klauss | 119:ee6a53069455 | 1960 | |
klauss | 99:e80850c51106 | 1961 | strcat( debug_buf, "\r" ); |
klauss | 119:ee6a53069455 | 1962 | |
klauss | 99:e80850c51106 | 1963 | split = strtok( debug_buf + 5, " " ); |
klauss | 99:e80850c51106 | 1964 | ext = atoi( split ); |
klauss | 119:ee6a53069455 | 1965 | |
klauss | 99:e80850c51106 | 1966 | split += strlen( split ) + 1; |
klauss | 99:e80850c51106 | 1967 | split = strtok( NULL, " " ); |
klauss | 99:e80850c51106 | 1968 | port = atoi( split ); |
klauss | 119:ee6a53069455 | 1969 | |
klauss | 99:e80850c51106 | 1970 | strcpy( cmd, "ping\r\n" ); |
klauss | 119:ee6a53069455 | 1971 | |
klauss | 99:e80850c51106 | 1972 | promptcb_last_ext = ext; |
klauss | 99:e80850c51106 | 1973 | promptcb_last_port = port; |
klauss | 119:ee6a53069455 | 1974 | |
klauss | 99:e80850c51106 | 1975 | strcpy( promptcb_last_cmd, cmd ); |
klauss | 99:e80850c51106 | 1976 | strcat( cmd, "\r\r\r\n" ); |
klauss | 119:ee6a53069455 | 1977 | |
klauss | 119:ee6a53069455 | 1978 | for( register uint8_t i = 0; i < 3; i++ ) { |
klauss | 119:ee6a53069455 | 1979 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d cmd=%s", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1980 | send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 119:ee6a53069455 | 1981 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado"); |
klauss | 119:ee6a53069455 | 1982 | |
klauss | 119:ee6a53069455 | 1983 | if( from_eth ) { |
klauss | 99:e80850c51106 | 1984 | char eth_msg[ 512 ]; |
klauss | 99:e80850c51106 | 1985 | snprintf( eth_msg, 512 - 1, "\r\next=%d port=%d cmd=%s\r\nComando enviado\n\r", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 1986 | if( tcp_session && !udp_query ) { |
klauss | 99:e80850c51106 | 1987 | tcp_client.send_all( eth_msg, strlen( eth_msg ) ); |
klauss | 119:ee6a53069455 | 1988 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 1989 | udp_query_send_msg( eth_msg ); |
klauss | 99:e80850c51106 | 1990 | } |
klauss | 99:e80850c51106 | 1991 | } |
klauss | 99:e80850c51106 | 1992 | } |
klauss | 119:ee6a53069455 | 1993 | |
klauss | 99:e80850c51106 | 1994 | debug_buf = ref; |
klauss | 99:e80850c51106 | 1995 | bufptr = 0; |
klauss | 119:ee6a53069455 | 1996 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 99:e80850c51106 | 1997 | } |
klauss | 114:472502b31a12 | 1998 | |
klauss | 114:472502b31a12 | 1999 | |
klauss | 59:e1e300880d2d | 2000 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "_pcb",4 )) { |
klauss | 45:c80574f24dc3 | 2001 | miss_match = false; |
klauss | 48:195c97f12e8e | 2002 | debug_buf[ bufptr++ ] = 0x0D; |
klauss | 48:195c97f12e8e | 2003 | debug_buf[ bufptr++ ] = 0x00; |
klauss | 45:c80574f24dc3 | 2004 | |
klauss | 114:472502b31a12 | 2005 | 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 | 2006 | 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 | 2007 | if( debug_uart3 ) pc.printf("\n\rComando enviado\n\r"); |
klauss | 45:c80574f24dc3 | 2008 | } |
klauss | 62:07e5bdc9f8f7 | 2009 | |
klauss | 58:af7e8788f106 | 2010 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "cks",3 )) { |
klauss | 45:c80574f24dc3 | 2011 | miss_match = false; |
klauss | 81:3656f00ab3db | 2012 | pcks_s = true; |
klauss | 45:c80574f24dc3 | 2013 | } |
klauss | 45:c80574f24dc3 | 2014 | |
klauss | 58:af7e8788f106 | 2015 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "showcb",6 )) { |
klauss | 45:c80574f24dc3 | 2016 | miss_match = false; |
klauss | 81:3656f00ab3db | 2017 | pshowcb = true; |
klauss | 45:c80574f24dc3 | 2018 | } |
klauss | 114:472502b31a12 | 2019 | |
klauss | 58:af7e8788f106 | 2020 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_main ", 11 )) { |
klauss | 81:3656f00ab3db | 2021 | if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on", 2 )) { |
klauss | 45:c80574f24dc3 | 2022 | miss_match = false; |
klauss | 119:ee6a53069455 | 2023 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nDebug Main ON"); |
klauss | 119:ee6a53069455 | 2024 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2025 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Main On\n\r"); |
klauss | 45:c80574f24dc3 | 2026 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2027 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2028 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2029 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2030 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2031 | } |
klauss | 45:c80574f24dc3 | 2032 | } |
klauss | 81:3656f00ab3db | 2033 | debug_main = true; |
klauss | 45:c80574f24dc3 | 2034 | } |
klauss | 81:3656f00ab3db | 2035 | if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off", 3 )) { |
klauss | 45:c80574f24dc3 | 2036 | miss_match = false; |
klauss | 119:ee6a53069455 | 2037 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nDebug Main OFF"); |
klauss | 119:ee6a53069455 | 2038 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2039 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug Main Off\n\r"); |
klauss | 45:c80574f24dc3 | 2040 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2041 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2042 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2043 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2044 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2045 | } |
klauss | 45:c80574f24dc3 | 2046 | } |
klauss | 45:c80574f24dc3 | 2047 | debug_main = 0; |
klauss | 45:c80574f24dc3 | 2048 | } |
klauss | 45:c80574f24dc3 | 2049 | } |
klauss | 114:472502b31a12 | 2050 | |
klauss | 119:ee6a53069455 | 2051 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dout ", 5 ) ) { |
klauss | 119:ee6a53069455 | 2052 | if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ) { |
klauss | 81:3656f00ab3db | 2053 | miss_match = false; |
klauss | 119:ee6a53069455 | 2054 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nOut Debug ON"); |
klauss | 119:ee6a53069455 | 2055 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2056 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Out Debug On\n\r"); |
klauss | 81:3656f00ab3db | 2057 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2058 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2059 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2060 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2061 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2062 | } |
klauss | 81:3656f00ab3db | 2063 | } |
klauss | 81:3656f00ab3db | 2064 | debug_out_of_range = true; |
klauss | 81:3656f00ab3db | 2065 | } |
klauss | 119:ee6a53069455 | 2066 | if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ) { |
klauss | 81:3656f00ab3db | 2067 | miss_match = false; |
klauss | 119:ee6a53069455 | 2068 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nOut Debug OFF"); |
klauss | 119:ee6a53069455 | 2069 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2070 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Out Debug Off\n\r"); |
klauss | 81:3656f00ab3db | 2071 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2072 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2073 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2074 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2075 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2076 | } |
klauss | 81:3656f00ab3db | 2077 | } |
klauss | 81:3656f00ab3db | 2078 | debug_out_of_range = false; |
klauss | 81:3656f00ab3db | 2079 | } |
klauss | 81:3656f00ab3db | 2080 | } |
klauss | 114:472502b31a12 | 2081 | |
klauss | 119:ee6a53069455 | 2082 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dboot ", 6 ) ) { |
klauss | 119:ee6a53069455 | 2083 | if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "on", 2 ) ) { |
klauss | 99:e80850c51106 | 2084 | miss_match = false; |
klauss | 119:ee6a53069455 | 2085 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nBoot Debug ON"); |
klauss | 119:ee6a53069455 | 2086 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2087 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Boot Debug On\n\r"); |
klauss | 99:e80850c51106 | 2088 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2089 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2090 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2091 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2092 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2093 | } |
klauss | 99:e80850c51106 | 2094 | } |
klauss | 99:e80850c51106 | 2095 | debug_boot = true; |
klauss | 99:e80850c51106 | 2096 | } |
klauss | 119:ee6a53069455 | 2097 | if (xmemmatch( (uint8_t*)( debug_buf + 6 ), (uint8_t*) "off", 3 ) ) { |
klauss | 99:e80850c51106 | 2098 | miss_match = false; |
klauss | 119:ee6a53069455 | 2099 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nBoot Debug OFF"); |
klauss | 119:ee6a53069455 | 2100 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2101 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Boot Debug Off\n\r"); |
klauss | 99:e80850c51106 | 2102 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2103 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2104 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2105 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2106 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2107 | } |
klauss | 99:e80850c51106 | 2108 | } |
klauss | 99:e80850c51106 | 2109 | debug_boot = false; |
klauss | 99:e80850c51106 | 2110 | } |
klauss | 99:e80850c51106 | 2111 | } |
klauss | 114:472502b31a12 | 2112 | |
klauss | 119:ee6a53069455 | 2113 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfw ", 4 ) ) { |
klauss | 119:ee6a53069455 | 2114 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on", 2 ) ) { |
klauss | 99:e80850c51106 | 2115 | miss_match = false; |
klauss | 119:ee6a53069455 | 2116 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFW Debug ON"); |
klauss | 119:ee6a53069455 | 2117 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2118 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Debug On\n\r"); |
klauss | 99:e80850c51106 | 2119 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2120 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2121 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2122 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2123 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2124 | } |
klauss | 99:e80850c51106 | 2125 | } |
klauss | 99:e80850c51106 | 2126 | debug_fw = true; |
klauss | 99:e80850c51106 | 2127 | } |
klauss | 119:ee6a53069455 | 2128 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off", 3 ) ) { |
klauss | 99:e80850c51106 | 2129 | miss_match = false; |
klauss | 119:ee6a53069455 | 2130 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFW Debug OFF"); |
klauss | 119:ee6a53069455 | 2131 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2132 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Debug Off\n\r"); |
klauss | 99:e80850c51106 | 2133 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2134 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2135 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2136 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2137 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2138 | } |
klauss | 99:e80850c51106 | 2139 | } |
klauss | 99:e80850c51106 | 2140 | debug_fw = false; |
klauss | 99:e80850c51106 | 2141 | } |
klauss | 99:e80850c51106 | 2142 | } |
klauss | 114:472502b31a12 | 2143 | |
klauss | 119:ee6a53069455 | 2144 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dfwp ", 5 ) ) { |
klauss | 119:ee6a53069455 | 2145 | if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "on", 2 ) ) { |
klauss | 99:e80850c51106 | 2146 | miss_match = false; |
klauss | 119:ee6a53069455 | 2147 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFWPrint Debug ON"); |
klauss | 119:ee6a53069455 | 2148 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2149 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FWPrint Debug On\n\r"); |
klauss | 99:e80850c51106 | 2150 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2151 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2152 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2153 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2154 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2155 | } |
klauss | 99:e80850c51106 | 2156 | } |
klauss | 99:e80850c51106 | 2157 | debug_fw_print = true; |
klauss | 99:e80850c51106 | 2158 | } |
klauss | 119:ee6a53069455 | 2159 | if (xmemmatch( (uint8_t*)( debug_buf + 5 ), (uint8_t*) "off", 3 ) ) { |
klauss | 99:e80850c51106 | 2160 | miss_match = false; |
klauss | 119:ee6a53069455 | 2161 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\nFWPrint Debug OFF"); |
klauss | 119:ee6a53069455 | 2162 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2163 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FWPrint Debug Off\n\r"); |
klauss | 99:e80850c51106 | 2164 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2165 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2166 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2167 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2168 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2169 | } |
klauss | 99:e80850c51106 | 2170 | } |
klauss | 99:e80850c51106 | 2171 | debug_fw_print = false; |
klauss | 99:e80850c51106 | 2172 | } |
klauss | 99:e80850c51106 | 2173 | } |
klauss | 114:472502b31a12 | 2174 | |
klauss | 99:e80850c51106 | 2175 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "drx ", 4 )) { |
klauss | 99:e80850c51106 | 2176 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) { |
klauss | 45:c80574f24dc3 | 2177 | miss_match = false; |
klauss | 119:ee6a53069455 | 2178 | if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Rx ON"); |
klauss | 119:ee6a53069455 | 2179 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2180 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx On Rx on\n\r"); |
klauss | 45:c80574f24dc3 | 2181 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2182 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2183 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2184 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2185 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2186 | } |
klauss | 45:c80574f24dc3 | 2187 | } |
klauss | 81:3656f00ab3db | 2188 | debug_cb_rx = true; |
klauss | 45:c80574f24dc3 | 2189 | } |
klauss | 99:e80850c51106 | 2190 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) { |
klauss | 45:c80574f24dc3 | 2191 | miss_match = false; |
klauss | 119:ee6a53069455 | 2192 | if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Rx OFF"); |
klauss | 119:ee6a53069455 | 2193 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2194 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx On Rx off\n\r"); |
klauss | 45:c80574f24dc3 | 2195 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2196 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2197 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2198 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2199 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2200 | } |
klauss | 45:c80574f24dc3 | 2201 | } |
klauss | 99:e80850c51106 | 2202 | debug_cb_rx = false; |
klauss | 99:e80850c51106 | 2203 | } |
klauss | 99:e80850c51106 | 2204 | } |
klauss | 114:472502b31a12 | 2205 | |
klauss | 99:e80850c51106 | 2206 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "dtx ", 4 )) { |
klauss | 99:e80850c51106 | 2207 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "on",2 )) { |
klauss | 99:e80850c51106 | 2208 | miss_match = false; |
klauss | 119:ee6a53069455 | 2209 | if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Tx ON"); |
klauss | 119:ee6a53069455 | 2210 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2211 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx Tx on\n\r"); |
klauss | 99:e80850c51106 | 2212 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2213 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2214 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2215 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2216 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2217 | } |
klauss | 99:e80850c51106 | 2218 | } |
klauss | 99:e80850c51106 | 2219 | debug_cb_tx = true; |
klauss | 99:e80850c51106 | 2220 | } |
klauss | 99:e80850c51106 | 2221 | if (xmemmatch( (uint8_t*)( debug_buf + 4 ), (uint8_t*) "off",3 )) { |
klauss | 99:e80850c51106 | 2222 | miss_match = false; |
klauss | 119:ee6a53069455 | 2223 | if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug Cbx Tx OFF"); |
klauss | 119:ee6a53069455 | 2224 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2225 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug Cbx Tx off\n\r"); |
klauss | 99:e80850c51106 | 2226 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2227 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2228 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2229 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2230 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2231 | } |
klauss | 99:e80850c51106 | 2232 | } |
klauss | 99:e80850c51106 | 2233 | debug_cb_tx = false; |
klauss | 45:c80574f24dc3 | 2234 | } |
klauss | 45:c80574f24dc3 | 2235 | } |
klauss | 114:472502b31a12 | 2236 | |
klauss | 58:af7e8788f106 | 2237 | else if (xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "debug_file ", 11 )) { |
klauss | 45:c80574f24dc3 | 2238 | if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "on",2 )) { |
klauss | 45:c80574f24dc3 | 2239 | miss_match = false; |
klauss | 119:ee6a53069455 | 2240 | if( debug_uart3 && !( from_eth ) ) pc.printf("\tDebug File ON"); |
klauss | 119:ee6a53069455 | 2241 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2242 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\tDebug File On\n\r"); |
klauss | 45:c80574f24dc3 | 2243 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2244 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2245 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2246 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2247 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2248 | } |
klauss | 45:c80574f24dc3 | 2249 | } |
klauss | 119:ee6a53069455 | 2250 | debug_file = true; |
klauss | 45:c80574f24dc3 | 2251 | } |
klauss | 45:c80574f24dc3 | 2252 | if (xmemmatch( (uint8_t*)( debug_buf + 11 ), (uint8_t*) "off",3 )) { |
klauss | 45:c80574f24dc3 | 2253 | miss_match = false; |
klauss | 119:ee6a53069455 | 2254 | if( debug_uart3 && !( from_eth ) ) pc.printf("Debug File OFF"); |
klauss | 119:ee6a53069455 | 2255 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2256 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Debug File Off\n\r"); |
klauss | 45:c80574f24dc3 | 2257 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 2258 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2259 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2260 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2261 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2262 | } |
klauss | 45:c80574f24dc3 | 2263 | } |
klauss | 119:ee6a53069455 | 2264 | debug_file = false; |
klauss | 45:c80574f24dc3 | 2265 | } |
klauss | 45:c80574f24dc3 | 2266 | } |
klauss | 45:c80574f24dc3 | 2267 | |
klauss | 58:af7e8788f106 | 2268 | else if( xstrmatch( (uint8_t*)debug_buf, (uint8_t*) "help" )) { |
klauss | 45:c80574f24dc3 | 2269 | miss_match = false; |
klauss | 119:ee6a53069455 | 2270 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r****************************PROMPT HELP******************\n\r"); |
klauss | 119:ee6a53069455 | 2271 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2272 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "\n\r****************************PROMPT HELP******************\n\r" ); |
klauss | 119:ee6a53069455 | 2273 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2274 | |
klauss | 119:ee6a53069455 | 2275 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2276 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2277 | /* |
klauss | 119:ee6a53069455 | 2278 | int send = udp_client.sendTo( udp_server, debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2279 | |
klauss | 119:ee6a53069455 | 2280 | if( send != strlen( debug_buf ) ) { |
klauss | 119:ee6a53069455 | 2281 | if( debug_reconnect ) send_msg("Reconnect udp_query client"); |
klauss | 119:ee6a53069455 | 2282 | reconnect_prompt_udp_socket(); |
klauss | 119:ee6a53069455 | 2283 | miss_prompt_udp_send_pkg++; |
klauss | 119:ee6a53069455 | 2284 | } |
klauss | 119:ee6a53069455 | 2285 | */ |
klauss | 45:c80574f24dc3 | 2286 | } |
klauss | 44:cc4996469404 | 2287 | } |
klauss | 119:ee6a53069455 | 2288 | |
klauss | 119:ee6a53069455 | 2289 | if( debug_uart3 && !( from_eth ) ) pc.printf("ifconfig - mostra o arquivo de configuracao do sistema\n\r"); |
klauss | 119:ee6a53069455 | 2290 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2291 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ifconfig - mostra o arquivo de configuracao do sistema\n\r" ); |
klauss | 119:ee6a53069455 | 2292 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2293 | |
klauss | 119:ee6a53069455 | 2294 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2295 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2296 | } |
klauss | 45:c80574f24dc3 | 2297 | } |
klauss | 119:ee6a53069455 | 2298 | if( debug_uart3 && !( from_eth ) ) pc.printf("dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r"); |
klauss | 119:ee6a53069455 | 2299 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2300 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "dconfig - volta as configuracoes do sistema para o padrao de fabrica\n\r" ); |
klauss | 119:ee6a53069455 | 2301 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2302 | |
klauss | 119:ee6a53069455 | 2303 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2304 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2305 | } |
klauss | 119:ee6a53069455 | 2306 | } |
klauss | 119:ee6a53069455 | 2307 | 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 | 2308 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2309 | 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 | 2310 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2311 | |
klauss | 119:ee6a53069455 | 2312 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2313 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2314 | } |
klauss | 45:c80574f24dc3 | 2315 | } |
klauss | 119:ee6a53069455 | 2316 | 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 | 2317 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2318 | 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 | 2319 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2320 | |
klauss | 119:ee6a53069455 | 2321 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2322 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2323 | } |
klauss | 45:c80574f24dc3 | 2324 | } |
klauss | 119:ee6a53069455 | 2325 | if( debug_uart3 && !( from_eth ) ) pc.printf("format - formata o sistema de arquivos\n\r"); |
klauss | 119:ee6a53069455 | 2326 | if( debug_uart3 && !( from_eth ) ) pc.printf("reset - resta o sistema\n\r"); |
klauss | 119:ee6a53069455 | 2327 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2328 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "reset - resta o sistema\n\r" ); |
klauss | 119:ee6a53069455 | 2329 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2330 | |
klauss | 119:ee6a53069455 | 2331 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2332 | udp_query_send_msg( debug_buf ); |
klauss | 114:472502b31a12 | 2333 | } |
klauss | 114:472502b31a12 | 2334 | } |
klauss | 119:ee6a53069455 | 2335 | if( debug_uart3 && !( from_eth ) ) pc.printf("ipset [ip] - Configura o IP da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2336 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2337 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ipset [ip] - Configura o IP da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2338 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2339 | |
klauss | 119:ee6a53069455 | 2340 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2341 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2342 | } |
klauss | 45:c80574f24dc3 | 2343 | } |
klauss | 119:ee6a53069455 | 2344 | if( debug_uart3 && !( from_eth ) ) pc.printf("extset [ext] - Configura a ext da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2345 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2346 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "extset [ext] - Configura a ext da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2347 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2348 | |
klauss | 119:ee6a53069455 | 2349 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2350 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2351 | } |
klauss | 45:c80574f24dc3 | 2352 | } |
klauss | 119:ee6a53069455 | 2353 | if( debug_uart3 && !( from_eth ) ) pc.printf("msipport [port] - Configura a porta SIP da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2354 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2355 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "msipport [port] - Configura a porta SIP da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2356 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2357 | |
klauss | 119:ee6a53069455 | 2358 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2359 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2360 | } |
klauss | 45:c80574f24dc3 | 2361 | } |
klauss | 119:ee6a53069455 | 2362 | if( debug_uart3 && !( from_eth ) ) pc.printf("serverip [ip] - Configura o ip do servidor asterisk\n\r"); |
klauss | 119:ee6a53069455 | 2363 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2364 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "serverip [ip] - Configura o ip do servidor asterisk\n\r" ); |
klauss | 119:ee6a53069455 | 2365 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2366 | |
klauss | 119:ee6a53069455 | 2367 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2368 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2369 | } |
klauss | 45:c80574f24dc3 | 2370 | } |
klauss | 119:ee6a53069455 | 2371 | if( debug_uart3 && !( from_eth ) ) pc.printf("serextset [ext] - Configura a server ext da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2372 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2373 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "serextset [ext] - Configura a server ext da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2374 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2375 | |
klauss | 119:ee6a53069455 | 2376 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2377 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2378 | } |
klauss | 45:c80574f24dc3 | 2379 | } |
klauss | 119:ee6a53069455 | 2380 | if( debug_uart3 && !( from_eth ) ) pc.printf("ssport [port] - Configura a porta SIP do servidor asterisk\n\r"); |
klauss | 119:ee6a53069455 | 2381 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2382 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "ssport [port] - Configura a porta SIP do servidor asterisk\n\r" ); |
klauss | 119:ee6a53069455 | 2383 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2384 | |
klauss | 119:ee6a53069455 | 2385 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2386 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2387 | } |
klauss | 45:c80574f24dc3 | 2388 | } |
klauss | 119:ee6a53069455 | 2389 | if( debug_uart3 && !( from_eth ) ) pc.printf("maskset [mask] - Configura a mascara da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2390 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2391 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "maskset [mask] - Configura a mascara da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2392 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2393 | |
klauss | 119:ee6a53069455 | 2394 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2395 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2396 | } |
klauss | 45:c80574f24dc3 | 2397 | } |
klauss | 119:ee6a53069455 | 2398 | if( debug_uart3 && !( from_eth ) ) pc.printf("gatewayset [gateway] - Configura o gateway da cabeceira\n\r"); |
klauss | 119:ee6a53069455 | 2399 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2400 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "gatewayset [gateway] - Configura o gateway da cabeceira\n\r" ); |
klauss | 119:ee6a53069455 | 2401 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2402 | |
klauss | 119:ee6a53069455 | 2403 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2404 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2405 | } |
klauss | 45:c80574f24dc3 | 2406 | } |
klauss | 119:ee6a53069455 | 2407 | |
klauss | 119:ee6a53069455 | 2408 | if( debug_uart3 && !( from_eth ) ) pc.printf("fw_ip - Configura o IP do servidor de fw\n\r"); |
klauss | 119:ee6a53069455 | 2409 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2410 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "fw_ip - Configura o IP do servidor de fw\n\r" ); |
klauss | 119:ee6a53069455 | 2411 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2412 | |
klauss | 119:ee6a53069455 | 2413 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2414 | udp_query_send_msg( debug_buf ); |
klauss | 56:c64bcbaa621a | 2415 | } |
klauss | 56:c64bcbaa621a | 2416 | } |
klauss | 119:ee6a53069455 | 2417 | if( debug_uart3 && !( from_eth ) ) pc.printf("fw_port - Configura a porta do servidor de fw\n\r"); |
klauss | 119:ee6a53069455 | 2418 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2419 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "fw_port - Configura a porta do servidor de fw\n\r" ); |
klauss | 119:ee6a53069455 | 2420 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2421 | |
klauss | 119:ee6a53069455 | 2422 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2423 | udp_query_send_msg( debug_buf ); |
klauss | 99:e80850c51106 | 2424 | } |
klauss | 99:e80850c51106 | 2425 | } |
klauss | 119:ee6a53069455 | 2426 | |
klauss | 119:ee6a53069455 | 2427 | if( debug_uart3 && !( from_eth ) ) pc.printf("maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r"); |
klauss | 119:ee6a53069455 | 2428 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2429 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "maxext - Configura o maior ramal possivel de ser registrado nesse ramo\n\r" ); |
klauss | 119:ee6a53069455 | 2430 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2431 | |
klauss | 119:ee6a53069455 | 2432 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2433 | udp_query_send_msg( debug_buf ); |
klauss | 99:e80850c51106 | 2434 | } |
klauss | 99:e80850c51106 | 2435 | } |
klauss | 119:ee6a53069455 | 2436 | |
klauss | 119:ee6a53069455 | 2437 | if( debug_uart3 && !( from_eth ) ) pc.printf("minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r"); |
klauss | 119:ee6a53069455 | 2438 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2439 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "minext - Configura o menor ramal possivel de ser registrado nesse ramo\n\r" ); |
klauss | 119:ee6a53069455 | 2440 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2441 | |
klauss | 119:ee6a53069455 | 2442 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2443 | udp_query_send_msg( debug_buf ); |
klauss | 81:3656f00ab3db | 2444 | } |
klauss | 81:3656f00ab3db | 2445 | } |
klauss | 119:ee6a53069455 | 2446 | |
klauss | 119:ee6a53069455 | 2447 | if( debug_uart3 && !( from_eth ) ) pc.printf("showcb - lista os Cbx registrados na header\n\r"); |
klauss | 119:ee6a53069455 | 2448 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2449 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "showcb - lista os Cbx registrados na header\n\r" ); |
klauss | 119:ee6a53069455 | 2450 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2451 | |
klauss | 119:ee6a53069455 | 2452 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2453 | udp_query_send_msg( debug_buf ); |
klauss | 81:3656f00ab3db | 2454 | } |
klauss | 81:3656f00ab3db | 2455 | } |
klauss | 119:ee6a53069455 | 2456 | if( debug_uart3 && !( from_eth ) ) pc.printf("cks - exibe estatisticas de check sum\n\r"); |
klauss | 119:ee6a53069455 | 2457 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2458 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "cks - exibe estatisticas de check sum\n\r" ); |
klauss | 119:ee6a53069455 | 2459 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2460 | |
klauss | 119:ee6a53069455 | 2461 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2462 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2463 | } |
klauss | 45:c80574f24dc3 | 2464 | } |
klauss | 119:ee6a53069455 | 2465 | if( debug_uart3 && !( from_eth ) ) pc.printf("reset_cks - reseta estatisticas de check sum\n\r"); |
klauss | 119:ee6a53069455 | 2466 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2467 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "reset_cks - reseta estatisticas de check sum\n\r" ); |
klauss | 119:ee6a53069455 | 2468 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2469 | |
klauss | 119:ee6a53069455 | 2470 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2471 | udp_query_send_msg( debug_buf ); |
klauss | 52:12930cef17c4 | 2472 | } |
klauss | 52:12930cef17c4 | 2473 | } |
klauss | 119:ee6a53069455 | 2474 | |
klauss | 119:ee6a53069455 | 2475 | if( debug_uart3 && !( from_eth ) ) pc.printf(". - executa o comando anterior novamente\n\r"); |
klauss | 119:ee6a53069455 | 2476 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2477 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, ". - executa o comando anterior novamente\n\r" ); |
klauss | 119:ee6a53069455 | 2478 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2479 | |
klauss | 119:ee6a53069455 | 2480 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2481 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2482 | } |
klauss | 45:c80574f24dc3 | 2483 | } |
klauss | 119:ee6a53069455 | 2484 | if( debug_uart3 && !( from_eth ) ) pc.printf("debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r"); |
klauss | 119:ee6a53069455 | 2485 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2486 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "debug [on|off|show] - seleciona debugs gerais | lista de debugs \n\r" ); |
klauss | 119:ee6a53069455 | 2487 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2488 | |
klauss | 119:ee6a53069455 | 2489 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2490 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2491 | } |
klauss | 45:c80574f24dc3 | 2492 | } |
klauss | 119:ee6a53069455 | 2493 | if( debug_uart3 && !( from_eth ) ) pc.printf("{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r"); |
klauss | 119:ee6a53069455 | 2494 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2495 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "{ flood [ on | off ] | [+|-] } - simula envio de pacotes de audio\n\r"); |
klauss | 119:ee6a53069455 | 2496 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2497 | |
klauss | 119:ee6a53069455 | 2498 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2499 | udp_query_send_msg( debug_buf ); |
klauss | 62:07e5bdc9f8f7 | 2500 | } |
klauss | 62:07e5bdc9f8f7 | 2501 | } |
klauss | 119:ee6a53069455 | 2502 | |
klauss | 119:ee6a53069455 | 2503 | 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 | 2504 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2505 | 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 | 2506 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2507 | |
klauss | 119:ee6a53069455 | 2508 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2509 | udp_query_send_msg( debug_buf ); |
klauss | 65:0b653cfe95db | 2510 | } |
klauss | 65:0b653cfe95db | 2511 | } |
klauss | 119:ee6a53069455 | 2512 | |
klauss | 119:ee6a53069455 | 2513 | if( debug_uart3 && !( from_eth ) ) pc.printf("++ ext - Header flood on, ext flood on\n\r"); |
klauss | 119:ee6a53069455 | 2514 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2515 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "++ ext - Header flood on, ext flood on\n\r"); |
klauss | 119:ee6a53069455 | 2516 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2517 | |
klauss | 119:ee6a53069455 | 2518 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2519 | udp_query_send_msg( debug_buf ); |
klauss | 45:c80574f24dc3 | 2520 | } |
klauss | 45:c80574f24dc3 | 2521 | } |
klauss | 119:ee6a53069455 | 2522 | |
klauss | 119:ee6a53069455 | 2523 | if( debug_uart3 && !( from_eth ) ) pc.printf("-- ext - Header flood off, ext flood off\n\r"); |
klauss | 119:ee6a53069455 | 2524 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2525 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "++ ext - Header flood on, ext flood on\n\r"); |
klauss | 119:ee6a53069455 | 2526 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2527 | |
klauss | 119:ee6a53069455 | 2528 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2529 | udp_query_send_msg( debug_buf ); |
klauss | 66:3f1d22e69e7b | 2530 | } |
klauss | 66:3f1d22e69e7b | 2531 | } |
klauss | 119:ee6a53069455 | 2532 | |
klauss | 119:ee6a53069455 | 2533 | if( debug_uart3 && !( from_eth ) ) pc.printf("rx - Exibe ultimo pacote recebido dos CBx\n\r"); |
klauss | 119:ee6a53069455 | 2534 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2535 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "rx - Exibe ultimo pacote recebido dos CBx\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 | 119:ee6a53069455 | 2540 | } |
klauss | 119:ee6a53069455 | 2541 | } |
klauss | 119:ee6a53069455 | 2542 | if( debug_uart3 && !( from_eth ) ) pc.printf("tx - Exibe ultimo pacote enviado para os CBx\n\r"); |
klauss | 119:ee6a53069455 | 2543 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2544 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "tx - Exibe ultimo pacote enviado para os CBx\n\r"); |
klauss | 119:ee6a53069455 | 2545 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2546 | |
klauss | 119:ee6a53069455 | 2547 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2548 | udp_query_send_msg( debug_buf ); |
klauss | 64:5b011d5707d2 | 2549 | } |
klauss | 64:5b011d5707d2 | 2550 | } |
klauss | 119:ee6a53069455 | 2551 | 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 | 2552 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2553 | 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 | 2554 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2555 | |
klauss | 119:ee6a53069455 | 2556 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2557 | udp_query_send_msg( debug_buf ); |
klauss | 64:5b011d5707d2 | 2558 | } |
klauss | 64:5b011d5707d2 | 2559 | } |
klauss | 119:ee6a53069455 | 2560 | if( debug_uart3 && !( from_eth ) ) pc.printf("types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r"); |
klauss | 119:ee6a53069455 | 2561 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2562 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "types - Lista os types usados no protocolo de comunicacao Header -- CBx\n\r"); |
klauss | 119:ee6a53069455 | 2563 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2564 | |
klauss | 119:ee6a53069455 | 2565 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2566 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2567 | } |
klauss | 119:ee6a53069455 | 2568 | } |
klauss | 119:ee6a53069455 | 2569 | if( debug_uart3 && !( from_eth ) ) pc.printf("protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r"); |
klauss | 119:ee6a53069455 | 2570 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2571 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "protocol - Exibe formato do pacote seguindo o protocolo de comunicacao Header -- CBx\n\r"); |
klauss | 119:ee6a53069455 | 2572 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2573 | |
klauss | 119:ee6a53069455 | 2574 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2575 | udp_query_send_msg( debug_buf ); |
klauss | 64:5b011d5707d2 | 2576 | } |
klauss | 64:5b011d5707d2 | 2577 | } |
klauss | 119:ee6a53069455 | 2578 | |
klauss | 119:ee6a53069455 | 2579 | if( debug_uart3 && !( from_eth ) ) pc.printf("PROMPT VERSION: V%d\n\r", PVERSION); |
klauss | 119:ee6a53069455 | 2580 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2581 | snprintf( debug_buf,PROMPT_ETH_BUFFER_SIZE, "PROMPT VERSION: V%d\n\r", PVERSION); |
klauss | 119:ee6a53069455 | 2582 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2583 | while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2584 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2585 | udp_query_send_msg( debug_buf ); |
klauss | 104:62646ef786a3 | 2586 | } |
klauss | 104:62646ef786a3 | 2587 | } |
klauss | 119:ee6a53069455 | 2588 | //*------------ formatando a saida ----------------*// |
klauss | 119:ee6a53069455 | 2589 | strcpy( last_cmd, tmp_cmd ); |
klauss | 119:ee6a53069455 | 2590 | bufptr = 0; |
klauss | 119:ee6a53069455 | 2591 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 2592 | |
klauss | 119:ee6a53069455 | 2593 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2594 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2595 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "> " ); |
klauss | 119:ee6a53069455 | 2596 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2597 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2598 | udp_query_send_msg( "> " ); |
klauss | 104:62646ef786a3 | 2599 | } |
klauss | 104:62646ef786a3 | 2600 | } |
klauss | 105:a930035b6556 | 2601 | } |
klauss | 114:472502b31a12 | 2602 | |
klauss | 119:ee6a53069455 | 2603 | else if( xmemmatch( (uint8_t*)debug_buf, (uint8_t*) "callme ", 7 )) { |
klauss | 105:a930035b6556 | 2604 | miss_match = false; |
klauss | 105:a930035b6556 | 2605 | int ext,port; |
klauss | 105:a930035b6556 | 2606 | char cmd[ 16 ]; |
klauss | 119:ee6a53069455 | 2607 | |
klauss | 105:a930035b6556 | 2608 | ext = atoi( debug_buf + 7 ); |
klauss | 105:a930035b6556 | 2609 | port = convert_ext_to_port( ext ); |
klauss | 119:ee6a53069455 | 2610 | |
klauss | 105:a930035b6556 | 2611 | strcpy( cmd, ( ext % 2 ) ? "call init B" : "call init A" ); |
klauss | 119:ee6a53069455 | 2612 | |
klauss | 105:a930035b6556 | 2613 | if( ext % 2 ) ext--; |
klauss | 119:ee6a53069455 | 2614 | |
klauss | 105:a930035b6556 | 2615 | promptcb_last_ext = ext; |
klauss | 105:a930035b6556 | 2616 | promptcb_last_port = port; |
klauss | 119:ee6a53069455 | 2617 | |
klauss | 105:a930035b6556 | 2618 | int tmp = strlen( cmd ); |
klauss | 105:a930035b6556 | 2619 | cmd[ tmp ] = 0x0D; |
klauss | 105:a930035b6556 | 2620 | cmd[ tmp + 1 ] = 0x00; |
klauss | 105:a930035b6556 | 2621 | strcpy( promptcb_last_cmd, cmd ); |
klauss | 119:ee6a53069455 | 2622 | |
klauss | 119:ee6a53069455 | 2623 | if( debug_uart3 && !( from_eth ) ) pc.printf("\r\next=%d port=%d\r\ncmd=%s\r\n", ext, port, cmd ); |
klauss | 119:ee6a53069455 | 2624 | |
klauss | 119:ee6a53069455 | 2625 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r--------------------------------------------------------\n\r"); |
klauss | 119:ee6a53069455 | 2626 | for( uint16_t i = 0; i < strlen( cmd ) ; i++ ) if( debug_uart3 && !( from_eth ) ) pc.printf( "%02x ", cmd[ i ] ); |
klauss | 119:ee6a53069455 | 2627 | |
klauss | 119:ee6a53069455 | 2628 | send2callboxes( build_cb_package( ext, port, PROMPT, cmd, id_msg++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 119:ee6a53069455 | 2629 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r--------------------------------------------------------\n\r"); |
klauss | 119:ee6a53069455 | 2630 | for( uint16_t i = 0; i < 300 ; i++ ) { |
klauss | 119:ee6a53069455 | 2631 | if( debug_uart3 && !( from_eth ) ) pc.printf( "%02x ", write_buffer[ i ] ); |
klauss | 119:ee6a53069455 | 2632 | if( i != 0 && !( ( i + 1 ) % 30 ) ) if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r"); |
klauss | 119:ee6a53069455 | 2633 | } |
klauss | 119:ee6a53069455 | 2634 | |
klauss | 119:ee6a53069455 | 2635 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rComando enviado\n\r"); |
klauss | 119:ee6a53069455 | 2636 | |
klauss | 119:ee6a53069455 | 2637 | if( from_eth ) { |
klauss | 105:a930035b6556 | 2638 | char eth_msg[ 512 ]; |
klauss | 105:a930035b6556 | 2639 | 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 | 2640 | if( tcp_session && !udp_query ) { |
klauss | 105:a930035b6556 | 2641 | tcp_client.send_all( eth_msg, strlen( eth_msg ) ); |
klauss | 119:ee6a53069455 | 2642 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2643 | udp_query_send_msg( eth_msg ); |
klauss | 119:ee6a53069455 | 2644 | } |
klauss | 119:ee6a53069455 | 2645 | } |
klauss | 119:ee6a53069455 | 2646 | |
klauss | 119:ee6a53069455 | 2647 | bufptr = 0; |
klauss | 119:ee6a53069455 | 2648 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 2649 | } |
klauss | 119:ee6a53069455 | 2650 | |
klauss | 119:ee6a53069455 | 2651 | if( miss_match ) { |
klauss | 119:ee6a53069455 | 2652 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\r> %s: command not found\n\r", debug_buf ); |
klauss | 119:ee6a53069455 | 2653 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2654 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "> %s: command not found\n ", debug_buf ); |
klauss | 119:ee6a53069455 | 2655 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2656 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2657 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2658 | udp_query_send_msg( debug_buf ); |
klauss | 105:a930035b6556 | 2659 | } |
klauss | 105:a930035b6556 | 2660 | } |
klauss | 119:ee6a53069455 | 2661 | } else { |
klauss | 119:ee6a53069455 | 2662 | if( from_eth && strlen( debug_buf ) > 2 ) strcpy( last_cmd, tmp_cmd ); |
klauss | 119:ee6a53069455 | 2663 | |
klauss | 119:ee6a53069455 | 2664 | else if( strlen( debug_buf ) > 2 ) strcpy( last_cmd, tmp_cmd ); |
klauss | 119:ee6a53069455 | 2665 | } |
klauss | 119:ee6a53069455 | 2666 | } |
klauss | 119:ee6a53069455 | 2667 | |
klauss | 119:ee6a53069455 | 2668 | if( b == 0x0D || bufret == 1 || bufptr > DEBUGBUFSIZE ) { |
klauss | 119:ee6a53069455 | 2669 | bufret = 0; |
klauss | 119:ee6a53069455 | 2670 | |
klauss | 119:ee6a53069455 | 2671 | if( debug_uart3 && !( from_eth ) ) pc.putc(0x0A); |
klauss | 119:ee6a53069455 | 2672 | if( debug_uart3 && !( from_eth ) ) pc.putc(0x0D); |
klauss | 119:ee6a53069455 | 2673 | if( debug_uart3 && !( from_eth ) ) pc.printf("> "); |
klauss | 119:ee6a53069455 | 2674 | |
klauss | 119:ee6a53069455 | 2675 | if( from_eth ) |
klauss | 119:ee6a53069455 | 2676 | { |
klauss | 119:ee6a53069455 | 2677 | if( strlen( debug_buf ) > 0 ) |
klauss | 119:ee6a53069455 | 2678 | { |
klauss | 119:ee6a53069455 | 2679 | |
klauss | 119:ee6a53069455 | 2680 | if( debug_buf[ strlen( debug_buf ) - 1 ] == '\r' || debug_buf[ strlen( debug_buf ) - 1 ] == '\n' ) |
klauss | 119:ee6a53069455 | 2681 | { |
klauss | 119:ee6a53069455 | 2682 | //strcat( debug_buf, "> " ); |
klauss | 119:ee6a53069455 | 2683 | strcpy( debug_buf, "> " ); |
klauss | 119:ee6a53069455 | 2684 | } else { |
klauss | 119:ee6a53069455 | 2685 | //strcat( debug_buf, "\n\r> " ); |
klauss | 119:ee6a53069455 | 2686 | strcpy( debug_buf, "\n\r> " ); |
klauss | 119:ee6a53069455 | 2687 | } |
klauss | 119:ee6a53069455 | 2688 | }else{ |
klauss | 119:ee6a53069455 | 2689 | |
klauss | 119:ee6a53069455 | 2690 | } |
klauss | 117:e9facba9db27 | 2691 | |
klauss | 119:ee6a53069455 | 2692 | if( tcp_session && !udp_query ) |
klauss | 119:ee6a53069455 | 2693 | { |
klauss | 119:ee6a53069455 | 2694 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 2695 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2696 | |
klauss | 119:ee6a53069455 | 2697 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2698 | |
klauss | 119:ee6a53069455 | 2699 | } |
klauss | 119:ee6a53069455 | 2700 | for( register uint16_t i = 0; i < PROMPT_ETH_BUFFER_SIZE; i++ ) eth_buffer[ i ] = 0; |
klauss | 119:ee6a53069455 | 2701 | |
klauss | 119:ee6a53069455 | 2702 | debug_buf = __debug_buf__; |
klauss | 119:ee6a53069455 | 2703 | |
klauss | 119:ee6a53069455 | 2704 | bufptr = last_bufptr; |
klauss | 119:ee6a53069455 | 2705 | |
klauss | 119:ee6a53069455 | 2706 | } |
klauss | 119:ee6a53069455 | 2707 | else |
klauss | 119:ee6a53069455 | 2708 | { |
klauss | 104:62646ef786a3 | 2709 | bufptr = 0; |
klauss | 119:ee6a53069455 | 2710 | last_bufptr = 0; |
klauss | 119:ee6a53069455 | 2711 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 2712 | } |
klauss | 119:ee6a53069455 | 2713 | } |
klauss | 119:ee6a53069455 | 2714 | return( NULL ); |
klauss | 119:ee6a53069455 | 2715 | }//fim prompt_process |
klauss | 119:ee6a53069455 | 2716 | |
klauss | 119:ee6a53069455 | 2717 | // operantion with the system config files |
klauss | 119:ee6a53069455 | 2718 | void files( const char type ) |
klauss | 119:ee6a53069455 | 2719 | { |
klauss | 119:ee6a53069455 | 2720 | // show files |
klauss | 119:ee6a53069455 | 2721 | if (type == 's' ) { |
klauss | 119:ee6a53069455 | 2722 | |
klauss | 119:ee6a53069455 | 2723 | if( debug_uart3 && !( from_eth ) ) pc.printf("Header IP " ); |
klauss | 119:ee6a53069455 | 2724 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2725 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Header IP " ); |
klauss | 119:ee6a53069455 | 2726 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2727 | |
klauss | 119:ee6a53069455 | 2728 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2729 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2730 | } |
klauss | 119:ee6a53069455 | 2731 | } |
klauss | 119:ee6a53069455 | 2732 | |
klauss | 119:ee6a53069455 | 2733 | cat("/qspi/myip.txt"); |
klauss | 119:ee6a53069455 | 2734 | |
klauss | 119:ee6a53069455 | 2735 | if( debug_uart3 && !( from_eth ) ) pc.printf("Header ext "); |
klauss | 119:ee6a53069455 | 2736 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2737 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Header ext " ); |
klauss | 119:ee6a53069455 | 2738 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2739 | |
klauss | 119:ee6a53069455 | 2740 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2741 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2742 | } |
klauss | 119:ee6a53069455 | 2743 | } |
klauss | 119:ee6a53069455 | 2744 | |
klauss | 119:ee6a53069455 | 2745 | cat("/qspi/myext.txt"); |
klauss | 119:ee6a53069455 | 2746 | |
klauss | 119:ee6a53069455 | 2747 | if( debug_uart3 && !( from_eth ) ) pc.printf("Header port "); |
klauss | 119:ee6a53069455 | 2748 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2749 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Header port " ); |
klauss | 119:ee6a53069455 | 2750 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2751 | |
klauss | 119:ee6a53069455 | 2752 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2753 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2754 | } |
klauss | 119:ee6a53069455 | 2755 | } |
klauss | 119:ee6a53069455 | 2756 | |
klauss | 119:ee6a53069455 | 2757 | cat("/qspi/mysipport.txt"); |
klauss | 119:ee6a53069455 | 2758 | |
klauss | 119:ee6a53069455 | 2759 | if( debug_uart3 && !( from_eth ) ) pc.printf("Server IP "); |
klauss | 119:ee6a53069455 | 2760 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2761 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Server IP " ); |
klauss | 119:ee6a53069455 | 2762 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2763 | |
klauss | 119:ee6a53069455 | 2764 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2765 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2766 | } |
klauss | 119:ee6a53069455 | 2767 | } |
klauss | 119:ee6a53069455 | 2768 | |
klauss | 119:ee6a53069455 | 2769 | cat("/qspi/serverip.txt"); |
klauss | 119:ee6a53069455 | 2770 | |
klauss | 119:ee6a53069455 | 2771 | if( debug_uart3 && !( from_eth ) ) pc.printf("Server ext "); |
klauss | 119:ee6a53069455 | 2772 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2773 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Server ext " ); |
klauss | 119:ee6a53069455 | 2774 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2775 | |
klauss | 119:ee6a53069455 | 2776 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2777 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2778 | } |
klauss | 119:ee6a53069455 | 2779 | } |
klauss | 119:ee6a53069455 | 2780 | |
klauss | 119:ee6a53069455 | 2781 | cat("/qspi/peerext.txt"); |
klauss | 119:ee6a53069455 | 2782 | |
klauss | 119:ee6a53069455 | 2783 | if( debug_uart3 && !( from_eth ) ) pc.printf("Server port "); |
klauss | 119:ee6a53069455 | 2784 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2785 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Server port " ); |
klauss | 119:ee6a53069455 | 2786 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2787 | |
klauss | 119:ee6a53069455 | 2788 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2789 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2790 | } |
klauss | 105:a930035b6556 | 2791 | } |
klauss | 119:ee6a53069455 | 2792 | cat("/qspi/serverport.txt"); |
klauss | 119:ee6a53069455 | 2793 | |
klauss | 119:ee6a53069455 | 2794 | if( debug_uart3 && !( from_eth ) ) pc.printf("Mascara de rede "); |
klauss | 119:ee6a53069455 | 2795 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2796 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Mascara de rede " ); |
klauss | 119:ee6a53069455 | 2797 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2798 | |
klauss | 119:ee6a53069455 | 2799 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2800 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2801 | } |
klauss | 119:ee6a53069455 | 2802 | } |
klauss | 119:ee6a53069455 | 2803 | cat("/qspi/mymask.txt"); |
klauss | 119:ee6a53069455 | 2804 | |
klauss | 119:ee6a53069455 | 2805 | if( debug_uart3 && !( from_eth ) ) pc.printf("Gateway IP "); |
klauss | 119:ee6a53069455 | 2806 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2807 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Gateway IP " ); |
klauss | 119:ee6a53069455 | 2808 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2809 | |
klauss | 119:ee6a53069455 | 2810 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2811 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2812 | } |
klauss | 119:ee6a53069455 | 2813 | } |
klauss | 119:ee6a53069455 | 2814 | cat("/qspi/mygateway.txt"); |
klauss | 119:ee6a53069455 | 2815 | |
klauss | 119:ee6a53069455 | 2816 | if( debug_uart3 && !( from_eth ) ) pc.printf("UDP Port "); |
klauss | 119:ee6a53069455 | 2817 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2818 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "UDP Port " ); |
klauss | 119:ee6a53069455 | 2819 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2820 | |
klauss | 119:ee6a53069455 | 2821 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2822 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2823 | } |
klauss | 119:ee6a53069455 | 2824 | } |
klauss | 119:ee6a53069455 | 2825 | |
klauss | 119:ee6a53069455 | 2826 | cat("/qspi/udpport.txt"); |
klauss | 119:ee6a53069455 | 2827 | |
klauss | 119:ee6a53069455 | 2828 | if( debug_uart3 && !( from_eth ) ) pc.printf("TCP Port "); |
klauss | 119:ee6a53069455 | 2829 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2830 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "TCP Port " ); |
klauss | 119:ee6a53069455 | 2831 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2832 | |
klauss | 119:ee6a53069455 | 2833 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2834 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2835 | } |
klauss | 119:ee6a53069455 | 2836 | } |
klauss | 119:ee6a53069455 | 2837 | |
klauss | 119:ee6a53069455 | 2838 | cat("/qspi/tcpport.txt"); |
klauss | 119:ee6a53069455 | 2839 | |
klauss | 119:ee6a53069455 | 2840 | if( debug_uart3 && !( from_eth ) ) pc.printf("FW Server IP "); |
klauss | 119:ee6a53069455 | 2841 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2842 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Server IP " ); |
klauss | 119:ee6a53069455 | 2843 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2844 | |
klauss | 119:ee6a53069455 | 2845 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2846 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2847 | } |
klauss | 119:ee6a53069455 | 2848 | } |
klauss | 119:ee6a53069455 | 2849 | |
klauss | 119:ee6a53069455 | 2850 | cat("/qspi/fw_ip.txt"); |
klauss | 119:ee6a53069455 | 2851 | |
klauss | 119:ee6a53069455 | 2852 | if( debug_uart3 && !( from_eth ) ) pc.printf("FW Server Port "); |
klauss | 119:ee6a53069455 | 2853 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2854 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "FW Server Port " ); |
klauss | 119:ee6a53069455 | 2855 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2856 | |
klauss | 119:ee6a53069455 | 2857 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2858 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2859 | } |
klauss | 119:ee6a53069455 | 2860 | } |
klauss | 119:ee6a53069455 | 2861 | |
klauss | 119:ee6a53069455 | 2862 | cat("/qspi/fw_port.txt"); |
klauss | 119:ee6a53069455 | 2863 | |
klauss | 119:ee6a53069455 | 2864 | if( debug_uart3 && !( from_eth ) ) pc.printf("Max Ext "); |
klauss | 119:ee6a53069455 | 2865 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2866 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Max Ext " ); |
klauss | 119:ee6a53069455 | 2867 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2868 | |
klauss | 119:ee6a53069455 | 2869 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2870 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2871 | } |
klauss | 119:ee6a53069455 | 2872 | } |
klauss | 119:ee6a53069455 | 2873 | |
klauss | 119:ee6a53069455 | 2874 | cat("/qspi/maxext.txt"); |
klauss | 119:ee6a53069455 | 2875 | |
klauss | 119:ee6a53069455 | 2876 | if( debug_uart3 && !( from_eth ) ) pc.printf("Min Ext "); |
klauss | 119:ee6a53069455 | 2877 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2878 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Min Ext " ); |
klauss | 119:ee6a53069455 | 2879 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2880 | |
klauss | 119:ee6a53069455 | 2881 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2882 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2883 | } |
klauss | 119:ee6a53069455 | 2884 | } |
klauss | 119:ee6a53069455 | 2885 | |
klauss | 119:ee6a53069455 | 2886 | cat("/qspi/minext.txt"); |
klauss | 106:a34fcf9f0e02 | 2887 | |
klauss | 119:ee6a53069455 | 2888 | if( debug_uart3 && !( from_eth ) ) pc.printf("Shift Port "); |
klauss | 119:ee6a53069455 | 2889 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2890 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Shift Port " ); |
klauss | 119:ee6a53069455 | 2891 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2892 | |
klauss | 119:ee6a53069455 | 2893 | else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2894 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 2895 | } |
klauss | 119:ee6a53069455 | 2896 | } |
klauss | 119:ee6a53069455 | 2897 | |
klauss | 119:ee6a53069455 | 2898 | cat("/qspi/shift_port.txt"); |
klauss | 119:ee6a53069455 | 2899 | |
klauss | 119:ee6a53069455 | 2900 | |
klauss | 119:ee6a53069455 | 2901 | //*------------ formatando a saida ----------------*// |
klauss | 119:ee6a53069455 | 2902 | strcpy( last_cmd, tmp_cmd ); |
klauss | 119:ee6a53069455 | 2903 | bufptr = 0; |
klauss | 119:ee6a53069455 | 2904 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 2905 | |
klauss | 119:ee6a53069455 | 2906 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 2907 | |
klauss | 119:ee6a53069455 | 2908 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 2909 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "> " ); |
klauss | 119:ee6a53069455 | 2910 | if( tcp_session && !udp_query ) while( !( tcp_client.send_all( debug_buf, strlen( debug_buf ) ) ) ); |
klauss | 119:ee6a53069455 | 2911 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 2912 | udp_query_send_msg( "> " ); |
klauss | 119:ee6a53069455 | 2913 | |
klauss | 106:a34fcf9f0e02 | 2914 | } |
klauss | 106:a34fcf9f0e02 | 2915 | } |
klauss | 119:ee6a53069455 | 2916 | } |
klauss | 119:ee6a53069455 | 2917 | |
klauss | 119:ee6a53069455 | 2918 | if (type == 'c' ) { |
klauss | 119:ee6a53069455 | 2919 | // close all files |
klauss | 119:ee6a53069455 | 2920 | if( fip ) fclose( fip ); |
klauss | 119:ee6a53069455 | 2921 | if( fmask ) fclose( fmask ); |
klauss | 119:ee6a53069455 | 2922 | if( fgate ) fclose( fgate ); |
klauss | 119:ee6a53069455 | 2923 | if( fport )fclose( fport ); |
klauss | 119:ee6a53069455 | 2924 | if( fsip ) fclose( fsip ); |
klauss | 119:ee6a53069455 | 2925 | if( fsport ) fclose( fsport ); |
klauss | 119:ee6a53069455 | 2926 | if( fext ) fclose( fext ); |
klauss | 119:ee6a53069455 | 2927 | if( fserext ) fclose( fserext ); |
klauss | 119:ee6a53069455 | 2928 | if( fudpport ) fclose( fudpport ); |
klauss | 119:ee6a53069455 | 2929 | if( ftcpport ) fclose( ftcpport ); |
klauss | 119:ee6a53069455 | 2930 | if( fmax ) fclose( fmax ); |
klauss | 119:ee6a53069455 | 2931 | if( fmin ) fclose( fmin ); |
klauss | 119:ee6a53069455 | 2932 | if( ffwip ) fclose( ffwip ); |
klauss | 119:ee6a53069455 | 2933 | if( ffwport) fclose( ffwport ); |
klauss | 119:ee6a53069455 | 2934 | if( fshift_port ) fclose ( fshift_port ); |
klauss | 119:ee6a53069455 | 2935 | } |
klauss | 119:ee6a53069455 | 2936 | |
klauss | 119:ee6a53069455 | 2937 | |
klauss | 119:ee6a53069455 | 2938 | // Check if files exist, if not create the files |
klauss | 119:ee6a53069455 | 2939 | //fixme criar um bool pra cada file |
klauss | 119:ee6a53069455 | 2940 | if (type == 'i' ) |
klauss | 119:ee6a53069455 | 2941 | { |
klauss | 119:ee6a53069455 | 2942 | bool exists = true; |
klauss | 119:ee6a53069455 | 2943 | |
klauss | 119:ee6a53069455 | 2944 | fip = fopen("/qspi/myip.txt", "r"); |
klauss | 119:ee6a53069455 | 2945 | if( fip == NULL) { |
klauss | 119:ee6a53069455 | 2946 | set_ip( MY_IP ); |
klauss | 119:ee6a53069455 | 2947 | exists = false; |
klauss | 119:ee6a53069455 | 2948 | } |
klauss | 119:ee6a53069455 | 2949 | if ( fip ) fclose ( fip ); |
klauss | 119:ee6a53069455 | 2950 | fip = NULL; |
klauss | 119:ee6a53069455 | 2951 | |
klauss | 119:ee6a53069455 | 2952 | fserext = fopen("/qspi/myext.txt", "r"); |
klauss | 119:ee6a53069455 | 2953 | if( fserext == NULL ) { |
klauss | 119:ee6a53069455 | 2954 | set_header_ext( MY_EXT ); |
klauss | 119:ee6a53069455 | 2955 | exists = false; |
klauss | 119:ee6a53069455 | 2956 | } |
klauss | 119:ee6a53069455 | 2957 | if ( fserext ) fclose ( fserext ); |
klauss | 119:ee6a53069455 | 2958 | fserext = NULL; |
klauss | 119:ee6a53069455 | 2959 | |
klauss | 119:ee6a53069455 | 2960 | fport = fopen("/qspi/mysipport.txt", "r"); |
klauss | 119:ee6a53069455 | 2961 | if (fport == NULL) { |
klauss | 119:ee6a53069455 | 2962 | set_header_sip_port( MY_PORT ); |
klauss | 119:ee6a53069455 | 2963 | exists = false; |
klauss | 119:ee6a53069455 | 2964 | } |
klauss | 119:ee6a53069455 | 2965 | if ( fport ) fclose ( fport ); |
klauss | 119:ee6a53069455 | 2966 | fport = NULL; |
klauss | 119:ee6a53069455 | 2967 | |
klauss | 119:ee6a53069455 | 2968 | fsip = fopen("/qspi/serverip.txt", "r"); |
klauss | 119:ee6a53069455 | 2969 | if (fsip == NULL) { |
klauss | 119:ee6a53069455 | 2970 | set_server_ip( SERVER_IP ); |
klauss | 119:ee6a53069455 | 2971 | exists = false; |
klauss | 119:ee6a53069455 | 2972 | } |
klauss | 119:ee6a53069455 | 2973 | if ( fsip ) fclose ( fsip ); |
klauss | 119:ee6a53069455 | 2974 | fsip = NULL; |
klauss | 119:ee6a53069455 | 2975 | |
klauss | 119:ee6a53069455 | 2976 | fext = fopen("/qspi/peerext.txt", "r"); |
klauss | 119:ee6a53069455 | 2977 | if ( fext == NULL ) { |
klauss | 119:ee6a53069455 | 2978 | set_server_ext( PEER_EXT ); |
klauss | 119:ee6a53069455 | 2979 | exists = false; |
klauss | 119:ee6a53069455 | 2980 | } |
klauss | 119:ee6a53069455 | 2981 | if ( fext ) fclose ( fext ); |
klauss | 119:ee6a53069455 | 2982 | fext = NULL; |
klauss | 119:ee6a53069455 | 2983 | |
klauss | 119:ee6a53069455 | 2984 | fsport = fopen("/qspi/serverport.txt", "r"); |
klauss | 119:ee6a53069455 | 2985 | if (fsport == NULL) { |
klauss | 119:ee6a53069455 | 2986 | set_server_port( SERVER_PORT ); |
klauss | 119:ee6a53069455 | 2987 | exists = false; |
klauss | 119:ee6a53069455 | 2988 | } |
klauss | 119:ee6a53069455 | 2989 | if ( fsport ) fclose ( fsport ); |
klauss | 119:ee6a53069455 | 2990 | fsport = NULL; |
klauss | 119:ee6a53069455 | 2991 | |
klauss | 119:ee6a53069455 | 2992 | fmask = fopen("/qspi/mymask.txt", "r"); |
klauss | 119:ee6a53069455 | 2993 | if (fmask == NULL) { |
klauss | 119:ee6a53069455 | 2994 | set_mask( MY_MSK ); |
klauss | 119:ee6a53069455 | 2995 | exists = false; |
klauss | 119:ee6a53069455 | 2996 | } |
klauss | 119:ee6a53069455 | 2997 | if ( fmask ) fclose ( fmask ); |
klauss | 119:ee6a53069455 | 2998 | fmask = NULL; |
klauss | 119:ee6a53069455 | 2999 | |
klauss | 119:ee6a53069455 | 3000 | fgate = fopen("/qspi/mygateway.txt", "r"); |
klauss | 119:ee6a53069455 | 3001 | if (fgate == NULL) { |
klauss | 119:ee6a53069455 | 3002 | set_gateway( MY_GTW ); |
klauss | 119:ee6a53069455 | 3003 | exists = false; |
klauss | 119:ee6a53069455 | 3004 | } |
klauss | 119:ee6a53069455 | 3005 | if ( fgate ) fclose ( fgate ); |
klauss | 119:ee6a53069455 | 3006 | fgate = NULL; |
klauss | 119:ee6a53069455 | 3007 | |
klauss | 119:ee6a53069455 | 3008 | fudpport = fopen("/qspi/udpport.txt", "r" ); |
klauss | 119:ee6a53069455 | 3009 | if( fudpport == NULL ) { |
klauss | 119:ee6a53069455 | 3010 | set_udp_port_listener( UDP_PORT_LISTENER ); |
klauss | 119:ee6a53069455 | 3011 | exists = false; |
klauss | 119:ee6a53069455 | 3012 | } |
klauss | 119:ee6a53069455 | 3013 | if ( fudpport ) fclose ( fudpport ); |
klauss | 119:ee6a53069455 | 3014 | fudpport = NULL; |
klauss | 119:ee6a53069455 | 3015 | |
klauss | 119:ee6a53069455 | 3016 | ftcpport = fopen("/qspi/tcpport.txt", "r" ); |
klauss | 119:ee6a53069455 | 3017 | if( ftcpport == NULL ) { |
klauss | 119:ee6a53069455 | 3018 | set_tcp_port_listener( TCP_PORT_LISTENER ); |
klauss | 119:ee6a53069455 | 3019 | exists = false; |
klauss | 119:ee6a53069455 | 3020 | } |
klauss | 119:ee6a53069455 | 3021 | if ( ftcpport ) fclose ( ftcpport ); |
klauss | 119:ee6a53069455 | 3022 | ftcpport = NULL; |
klauss | 119:ee6a53069455 | 3023 | |
klauss | 119:ee6a53069455 | 3024 | ffwip = fopen("/qspi/fw_ip.txt", "r" ); |
klauss | 119:ee6a53069455 | 3025 | if( ffwip == NULL ) { |
klauss | 119:ee6a53069455 | 3026 | set_fw_ip( __FW_SERVER_IP__ ); |
klauss | 119:ee6a53069455 | 3027 | exists = false; |
klauss | 113:db67ae00550e | 3028 | } |
klauss | 119:ee6a53069455 | 3029 | if ( ffwip ) fclose ( ffwip ); |
klauss | 119:ee6a53069455 | 3030 | ffwip = NULL; |
klauss | 119:ee6a53069455 | 3031 | |
klauss | 119:ee6a53069455 | 3032 | ffwport = fopen("/qspi/fw_port.txt", "r" ); |
klauss | 119:ee6a53069455 | 3033 | if( ffwport == NULL ) { |
klauss | 119:ee6a53069455 | 3034 | set_fw_port( __FW_SERVER_PORT__ ); |
klauss | 119:ee6a53069455 | 3035 | exists = false; |
klauss | 119:ee6a53069455 | 3036 | } |
klauss | 119:ee6a53069455 | 3037 | if ( ffwport ) fclose ( ffwport ); |
klauss | 119:ee6a53069455 | 3038 | ffwport = NULL; |
klauss | 119:ee6a53069455 | 3039 | |
klauss | 119:ee6a53069455 | 3040 | fmax = fopen("/qspi/maxext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3041 | if( fmax == NULL ) { |
klauss | 119:ee6a53069455 | 3042 | set_max_ext( MAX_EXT ); |
klauss | 119:ee6a53069455 | 3043 | exists = false; |
klauss | 119:ee6a53069455 | 3044 | } |
klauss | 119:ee6a53069455 | 3045 | if ( fmax ) fclose ( fmax ); |
klauss | 119:ee6a53069455 | 3046 | fmax = NULL; |
klauss | 119:ee6a53069455 | 3047 | |
klauss | 119:ee6a53069455 | 3048 | fmin = fopen("/qspi/minext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3049 | if( fmin == NULL ) { |
klauss | 119:ee6a53069455 | 3050 | if( debug_file ) debug_msg("Don't exist /qspi/minext.txt"); |
klauss | 119:ee6a53069455 | 3051 | set_min_ext( MIN_EXT ); |
klauss | 119:ee6a53069455 | 3052 | exists = false; |
klauss | 119:ee6a53069455 | 3053 | } |
klauss | 119:ee6a53069455 | 3054 | if ( fmin ) fclose ( fmin ); |
klauss | 119:ee6a53069455 | 3055 | fmin = NULL; |
klauss | 119:ee6a53069455 | 3056 | |
klauss | 119:ee6a53069455 | 3057 | fshift_port = fopen("/qspi/shift_port.txt", "r" ); |
klauss | 119:ee6a53069455 | 3058 | if( fshift_port == NULL ) |
klauss | 119:ee6a53069455 | 3059 | { |
klauss | 119:ee6a53069455 | 3060 | if( debug_file ) debug_msg("Don't exist /qspi/shift_port.txt"); |
klauss | 119:ee6a53069455 | 3061 | set_shift_port( SHIFT_PORT ); |
klauss | 119:ee6a53069455 | 3062 | exists = false; |
klauss | 119:ee6a53069455 | 3063 | } |
klauss | 119:ee6a53069455 | 3064 | if ( fshift_port ) fclose ( fshift_port ); |
klauss | 119:ee6a53069455 | 3065 | fshift_port = NULL; |
klauss | 119:ee6a53069455 | 3066 | |
klauss | 119:ee6a53069455 | 3067 | if( !exists ) { |
klauss | 119:ee6a53069455 | 3068 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDefault configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3069 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 3070 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "Default configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3071 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 3072 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 3073 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 3074 | bufptr = 0; |
klauss | 119:ee6a53069455 | 3075 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 3076 | } |
klauss | 119:ee6a53069455 | 3077 | } |
klauss | 119:ee6a53069455 | 3078 | } |
klauss | 119:ee6a53069455 | 3079 | reset_leds(); |
klauss | 119:ee6a53069455 | 3080 | } |
klauss | 119:ee6a53069455 | 3081 | |
klauss | 119:ee6a53069455 | 3082 | if (type == 'r' ) { |
klauss | 119:ee6a53069455 | 3083 | // Just open for read |
klauss | 119:ee6a53069455 | 3084 | fip = fopen("/qspi/myip.txt", "r"); |
klauss | 119:ee6a53069455 | 3085 | fmask = fopen("/qspi/mymask.txt", "r"); |
klauss | 119:ee6a53069455 | 3086 | fgate = fopen("/qspi/mygateway.txt", "r"); |
klauss | 119:ee6a53069455 | 3087 | fport = fopen("/qspi/mysipport.txt", "r"); |
klauss | 119:ee6a53069455 | 3088 | fsip = fopen("/qspi/serverip.txt", "r"); |
klauss | 119:ee6a53069455 | 3089 | fsport = fopen("/qspi/serverport.txt", "r"); |
klauss | 119:ee6a53069455 | 3090 | fext = fopen( "/qspi/myext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3091 | fserext = fopen( "/qspi/peerext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3092 | fudpport = fopen( "/qspi/udpport.txt", "r" ); |
klauss | 119:ee6a53069455 | 3093 | ftcpport = fopen( "/qspi/tcpport.txt", "r" ); |
klauss | 119:ee6a53069455 | 3094 | ffwip = fopen("/qspi/fw_ip.txt", "r" ); |
klauss | 119:ee6a53069455 | 3095 | ffwport = fopen("/qspi/fw_port.txt", "r" ); |
klauss | 119:ee6a53069455 | 3096 | fmax = fopen("/qspi/maxext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3097 | fmin = fopen("/qspi/minext.txt", "r" ); |
klauss | 119:ee6a53069455 | 3098 | fshift_port = fopen("/qspi/shift_port.txt", "r" ); |
klauss | 119:ee6a53069455 | 3099 | |
klauss | 119:ee6a53069455 | 3100 | } |
klauss | 119:ee6a53069455 | 3101 | |
klauss | 119:ee6a53069455 | 3102 | if( type == 'w') { |
klauss | 119:ee6a53069455 | 3103 | |
klauss | 119:ee6a53069455 | 3104 | // Create and write the default configs |
klauss | 119:ee6a53069455 | 3105 | set_ip( MY_IP ); |
klauss | 119:ee6a53069455 | 3106 | |
klauss | 119:ee6a53069455 | 3107 | set_header_sip_port( MY_PORT ); |
klauss | 119:ee6a53069455 | 3108 | |
klauss | 119:ee6a53069455 | 3109 | set_header_ext( MY_EXT ); |
klauss | 119:ee6a53069455 | 3110 | |
klauss | 119:ee6a53069455 | 3111 | set_server_ip( SERVER_IP ); |
klauss | 119:ee6a53069455 | 3112 | |
klauss | 119:ee6a53069455 | 3113 | set_server_ext( PEER_EXT ); |
klauss | 119:ee6a53069455 | 3114 | |
klauss | 119:ee6a53069455 | 3115 | set_server_port( SERVER_PORT ); |
klauss | 119:ee6a53069455 | 3116 | |
klauss | 119:ee6a53069455 | 3117 | set_mask( MY_MSK ); |
klauss | 119:ee6a53069455 | 3118 | |
klauss | 119:ee6a53069455 | 3119 | set_gateway( MY_GTW ); |
klauss | 119:ee6a53069455 | 3120 | |
klauss | 119:ee6a53069455 | 3121 | set_udp_port_listener( UDP_PORT_LISTENER ); |
klauss | 119:ee6a53069455 | 3122 | |
klauss | 119:ee6a53069455 | 3123 | set_tcp_port_listener( TCP_PORT_LISTENER ); |
klauss | 119:ee6a53069455 | 3124 | |
klauss | 119:ee6a53069455 | 3125 | set_fw_ip( __FW_SERVER_IP__ ); |
klauss | 119:ee6a53069455 | 3126 | |
klauss | 119:ee6a53069455 | 3127 | set_fw_port( __FW_SERVER_PORT__ ); |
klauss | 119:ee6a53069455 | 3128 | |
klauss | 119:ee6a53069455 | 3129 | set_max_ext( MAX_EXT ); |
klauss | 119:ee6a53069455 | 3130 | |
klauss | 119:ee6a53069455 | 3131 | set_min_ext( MIN_EXT ); |
klauss | 119:ee6a53069455 | 3132 | |
klauss | 119:ee6a53069455 | 3133 | set_shift_port( SHIFT_PORT ); |
klauss | 119:ee6a53069455 | 3134 | |
klauss | 119:ee6a53069455 | 3135 | strcpy( last_cmd, tmp_cmd ); |
klauss | 119:ee6a53069455 | 3136 | |
klauss | 119:ee6a53069455 | 3137 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rDefault configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3138 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 3139 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rDefault configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3140 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 3141 | if( tcp_session && !udp_query ) { |
klauss | 117:e9facba9db27 | 3142 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 3143 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 3144 | udp_query_send_msg( debug_buf ); |
klauss | 116:39a41ebb675c | 3145 | } |
klauss | 117:e9facba9db27 | 3146 | bufptr = 0; |
klauss | 119:ee6a53069455 | 3147 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 116:39a41ebb675c | 3148 | } |
klauss | 119:ee6a53069455 | 3149 | |
klauss | 119:ee6a53069455 | 3150 | } |
klauss | 119:ee6a53069455 | 3151 | |
klauss | 119:ee6a53069455 | 3152 | if (type == 'e') |
klauss | 119:ee6a53069455 | 3153 | { |
klauss | 119:ee6a53069455 | 3154 | //Erase configs |
klauss | 119:ee6a53069455 | 3155 | fip = fopen("/qspi/myip.txt", "w"); |
klauss | 119:ee6a53069455 | 3156 | fmask = fopen("/qspi/mymask.txt", "w"); |
klauss | 119:ee6a53069455 | 3157 | fgate = fopen("/qspi/mygateway.txt", "w"); |
klauss | 119:ee6a53069455 | 3158 | fport = fopen("/qspi/mysipport.txt", "w"); |
klauss | 119:ee6a53069455 | 3159 | fsip = fopen("/qspi/serverip.txt", "w"); |
klauss | 119:ee6a53069455 | 3160 | fsport = fopen("/qspi/serverport.txt", "w"); |
klauss | 119:ee6a53069455 | 3161 | fext = fopen( "/qspi/myext.txt", "w" ); |
klauss | 119:ee6a53069455 | 3162 | fserext = fopen( "/qspi/peerext.txt", "w" ); |
klauss | 119:ee6a53069455 | 3163 | fudpport = fopen( "/qspi/udpport.txt", "w" ); |
klauss | 119:ee6a53069455 | 3164 | ftcpport = fopen( "/qspi/tcpport.txt", "w" ); |
klauss | 119:ee6a53069455 | 3165 | ffwip = fopen("/qspi/fw_ip.txt", "w" ); |
klauss | 119:ee6a53069455 | 3166 | ffwport = fopen("/qspi/fw_port.txt", "w" ); |
klauss | 119:ee6a53069455 | 3167 | fmax = fopen("/qspi/maxext.txt", "w" ); |
klauss | 119:ee6a53069455 | 3168 | fmin = fopen("/qspi/minext.txt", "w" ); |
klauss | 119:ee6a53069455 | 3169 | fshift_port = fopen("/qspi/shift_port.txt", "w" ); |
klauss | 119:ee6a53069455 | 3170 | |
klauss | 119:ee6a53069455 | 3171 | if( fip ) fprintf( fip, "%s\n\r", "" ); |
klauss | 119:ee6a53069455 | 3172 | if( fport ) fprintf( fport, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3173 | if( fext ) fprintf( fext, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3174 | |
klauss | 119:ee6a53069455 | 3175 | if( fsip ) fprintf( fsip, "%s\n\r", "" ); |
klauss | 119:ee6a53069455 | 3176 | if( fserext ) fprintf( fserext, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3177 | if( fsport ) fprintf( fsport, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3178 | |
klauss | 119:ee6a53069455 | 3179 | if( fmask ) fprintf( fmask, "%s\n\r","" ); |
klauss | 119:ee6a53069455 | 3180 | if( fgate ) fprintf( fgate, "%s\n\r", "" ); |
klauss | 119:ee6a53069455 | 3181 | |
klauss | 119:ee6a53069455 | 3182 | if( fudpport ) fprintf( fudpport, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3183 | if( ftcpport ) fprintf( ftcpport, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3184 | |
klauss | 119:ee6a53069455 | 3185 | if( ffwip ) fprintf( ffwip, "%s\n\r","" ); |
klauss | 119:ee6a53069455 | 3186 | if( ffwport ) fprintf( ffwport, "%i\n\r",0 ); |
klauss | 119:ee6a53069455 | 3187 | |
klauss | 119:ee6a53069455 | 3188 | if( fmax ) fprintf( fmax, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3189 | if( fmin ) fprintf( fmin, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3190 | |
klauss | 119:ee6a53069455 | 3191 | if( fshift_port ) fprintf( fshift_port, "%i\n\r", 0 ); |
klauss | 119:ee6a53069455 | 3192 | |
klauss | 119:ee6a53069455 | 3193 | files('c'); |
klauss | 119:ee6a53069455 | 3194 | |
klauss | 119:ee6a53069455 | 3195 | if( debug_uart3 && !( from_eth ) ) pc.printf("\n\rErased configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3196 | if( from_eth ) { |
klauss | 119:ee6a53069455 | 3197 | snprintf( debug_buf, PROMPT_ETH_BUFFER_SIZE, "\n\rErased configurations set!\n\r"); |
klauss | 119:ee6a53069455 | 3198 | debug_buf[ strlen( debug_buf ) - 1 ] = '\0'; |
klauss | 119:ee6a53069455 | 3199 | if( tcp_session && !udp_query ) { |
klauss | 119:ee6a53069455 | 3200 | tcp_client.send_all( debug_buf, strlen( debug_buf ) ); |
klauss | 119:ee6a53069455 | 3201 | } else if( udp_query ) { |
klauss | 119:ee6a53069455 | 3202 | udp_query_send_msg( debug_buf ); |
klauss | 119:ee6a53069455 | 3203 | } |
klauss | 119:ee6a53069455 | 3204 | bufptr = 0; |
klauss | 119:ee6a53069455 | 3205 | for( register int i = 0; i < DEBUGBUFSIZE; i++ ) debug_buf[ i ] = 0; |
klauss | 119:ee6a53069455 | 3206 | } |
klauss | 119:ee6a53069455 | 3207 | |
klauss | 119:ee6a53069455 | 3208 | } |
klauss | 119:ee6a53069455 | 3209 | } |
klauss | 119:ee6a53069455 | 3210 | |
klauss | 119:ee6a53069455 | 3211 | int init_fsystem(){ |
klauss | 119:ee6a53069455 | 3212 | // init file system and check if files exist |
klauss | 119:ee6a53069455 | 3213 | |
klauss | 119:ee6a53069455 | 3214 | int return_value = 0; |
klauss | 119:ee6a53069455 | 3215 | |
klauss | 119:ee6a53069455 | 3216 | if (!qspifs.isformatted()) { |
klauss | 119:ee6a53069455 | 3217 | qspifs.format(); |
klauss | 119:ee6a53069455 | 3218 | return_value |= BIT0; |
klauss | 119:ee6a53069455 | 3219 | } |
klauss | 119:ee6a53069455 | 3220 | // check if the files are created |
klauss | 119:ee6a53069455 | 3221 | files('i'); |
klauss | 119:ee6a53069455 | 3222 | files('c'); |
klauss | 119:ee6a53069455 | 3223 | |
klauss | 119:ee6a53069455 | 3224 | return ( return_value |= BIT1 ); |
klauss | 54:448d57291be6 | 3225 | } |