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