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