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