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