![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
main.cpp@57:78f7191a8b69, 2014-10-23 (annotated)
- Committer:
- klauss
- Date:
- Thu Oct 23 17:18:58 2014 +0000
- Revision:
- 57:78f7191a8b69
- Parent:
- 55:2f5e7374af9d
- Child:
- 58:af7e8788f106
prompt telnet sendo validado
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 0:4d17cd9c8f9d | 1 | #include "bits.h" |
klauss | 0:4d17cd9c8f9d | 2 | #include "utils.h" |
klauss | 0:4d17cd9c8f9d | 3 | #include "configs.h" |
klauss | 0:4d17cd9c8f9d | 4 | #include "UART3Interrupt.h" |
klauss | 0:4d17cd9c8f9d | 5 | #include "parallelcpld.h" |
Cola | 21:0bd688722e81 | 6 | #include "prompt.h" |
klauss | 0:4d17cd9c8f9d | 7 | #include "debug.h" |
klauss | 0:4d17cd9c8f9d | 8 | #include "utils.h" |
Cola | 21:0bd688722e81 | 9 | #include "flood.h" |
klauss | 33:735fd60e96d8 | 10 | #include "eth.h" |
klauss | 0:4d17cd9c8f9d | 11 | |
klauss | 0:4d17cd9c8f9d | 12 | volatile uint8_t status = 0x00; |
klauss | 0:4d17cd9c8f9d | 13 | |
klauss | 0:4d17cd9c8f9d | 14 | int main(){ |
klauss | 48:195c97f12e8e | 15 | wdt.Configure( 40.0 ); |
klauss | 0:4d17cd9c8f9d | 16 | start_cpld(); |
klauss | 0:4d17cd9c8f9d | 17 | config_lpc(); |
klauss | 0:4d17cd9c8f9d | 18 | |
klauss | 43:455522f98de5 | 19 | init_fsystem(); |
klauss | 43:455522f98de5 | 20 | |
klauss | 43:455522f98de5 | 21 | // pensar melhor em como saber se estou conectado na eth |
klauss | 48:195c97f12e8e | 22 | //int eth_status = __init_eth__( ð ); |
klauss | 48:195c97f12e8e | 23 | int eth_status = __init_eth__(); |
klauss | 30:8dfb6d8de53d | 24 | |
klauss | 8:e3bfe62a477e | 25 | if( eth_status ){ |
klauss | 48:195c97f12e8e | 26 | send_msg("Cannot connect to eth\n\r"); |
klauss | 43:455522f98de5 | 27 | }else{ |
klauss | 48:195c97f12e8e | 28 | send_msg("Connection eth - ok"); |
klauss | 43:455522f98de5 | 29 | init_prompt(); |
klauss | 8:e3bfe62a477e | 30 | } |
klauss | 0:4d17cd9c8f9d | 31 | Timer t; |
klauss | 0:4d17cd9c8f9d | 32 | t.start(); |
klauss | 33:735fd60e96d8 | 33 | Timer udp_timer; |
klauss | 0:4d17cd9c8f9d | 34 | |
klauss | 0:4d17cd9c8f9d | 35 | /* representa ramal do call box */ |
klauss | 0:4d17cd9c8f9d | 36 | int ext = 0; |
klauss | 0:4d17cd9c8f9d | 37 | |
klauss | 0:4d17cd9c8f9d | 38 | /* representa porta do call box */ |
klauss | 0:4d17cd9c8f9d | 39 | int port = 0; |
klauss | 0:4d17cd9c8f9d | 40 | /* buffer para onde se copia os dados vindos do cb para tratameno interno */ |
klauss | 0:4d17cd9c8f9d | 41 | uint8_t buffer[ __CB_BUFFER_SIZE__ ]; |
klauss | 0:4d17cd9c8f9d | 42 | |
klauss | 0:4d17cd9c8f9d | 43 | /* buffer de escrita do pacote de saida que sera enviado pro cb / servidor */ |
klauss | 0:4d17cd9c8f9d | 44 | uint8_t write_buffer[ __CB_BUFFER_SIZE__ ]; |
klauss | 0:4d17cd9c8f9d | 45 | |
klauss | 0:4d17cd9c8f9d | 46 | /* ponteiro que aponta para os dados vindo do CPLD */ |
klauss | 0:4d17cd9c8f9d | 47 | uint8_t * buffer_from_cb_ptr = ( uint8_t * )RXBuffer; |
klauss | 0:4d17cd9c8f9d | 48 | |
klauss | 0:4d17cd9c8f9d | 49 | /* referencia para os dados contidos no pacote, sem o header */ |
klauss | 0:4d17cd9c8f9d | 50 | uint8_t * data = NULL; |
klauss | 0:4d17cd9c8f9d | 51 | |
klauss | 0:4d17cd9c8f9d | 52 | /* gerencia o tipo do pacote para providenciar tratamento adequado */ |
klauss | 0:4d17cd9c8f9d | 53 | volatile uint8_t type = __DO_NOTHING__; |
klauss | 0:4d17cd9c8f9d | 54 | |
klauss | 0:4d17cd9c8f9d | 55 | /* representa a lista dos Call Boxes atualmente reconhecidos pela cabeceira */ |
klauss | 0:4d17cd9c8f9d | 56 | Vector * v_cb = new Vector(); |
klauss | 0:4d17cd9c8f9d | 57 | |
klauss | 0:4d17cd9c8f9d | 58 | /* representa a lista de ligacoes ativas na cabeceira */ |
klauss | 0:4d17cd9c8f9d | 59 | Vector * v_call = new Vector(); |
klauss | 0:4d17cd9c8f9d | 60 | |
klauss | 0:4d17cd9c8f9d | 61 | /* gerencia a distribuicao de timeslice para os call boxes */ |
klauss | 0:4d17cd9c8f9d | 62 | Timeslice * ts = new Timeslice(); |
klauss | 0:4d17cd9c8f9d | 63 | /* tenta instanciar o vetor de call boxes, acende o led 1 antes de encerrar o programa */ |
klauss | 0:4d17cd9c8f9d | 64 | reset_leds(); |
klauss | 0:4d17cd9c8f9d | 65 | if( v_cb == NULL ){ |
klauss | 0:4d17cd9c8f9d | 66 | led1 = 0; |
klauss | 0:4d17cd9c8f9d | 67 | while( v_cb == NULL ){ |
klauss | 0:4d17cd9c8f9d | 68 | Vector * v_cb = new Vector(); |
klauss | 0:4d17cd9c8f9d | 69 | led1 = led1; |
klauss | 0:4d17cd9c8f9d | 70 | if( t.read() > 5 ){ |
klauss | 48:195c97f12e8e | 71 | send_msg("Erro ao alocar o vetor de CBx"); |
klauss | 0:4d17cd9c8f9d | 72 | t.reset(); |
klauss | 0:4d17cd9c8f9d | 73 | } |
klauss | 0:4d17cd9c8f9d | 74 | } |
klauss | 0:4d17cd9c8f9d | 75 | }else if( v_call == NULL ){ |
klauss | 0:4d17cd9c8f9d | 76 | led2 = 0; |
klauss | 0:4d17cd9c8f9d | 77 | led1 = 1; |
klauss | 0:4d17cd9c8f9d | 78 | while( v_call == NULL ){ |
klauss | 0:4d17cd9c8f9d | 79 | Vector * v_call = new Vector(); |
klauss | 0:4d17cd9c8f9d | 80 | if( t.read() > 5 ){ |
klauss | 48:195c97f12e8e | 81 | send_msg("Erro ao alocar o vetor de Calls"); |
klauss | 0:4d17cd9c8f9d | 82 | t.reset(); |
klauss | 0:4d17cd9c8f9d | 83 | } |
klauss | 0:4d17cd9c8f9d | 84 | } |
klauss | 0:4d17cd9c8f9d | 85 | } |
klauss | 0:4d17cd9c8f9d | 86 | reset_leds(); |
klauss | 33:735fd60e96d8 | 87 | udp_timer.start(); |
klauss | 48:195c97f12e8e | 88 | send_msg("Ready"); |
klauss | 57:78f7191a8b69 | 89 | uint8_t before = t.read(); |
Cola | 21:0bd688722e81 | 90 | while( true ){ |
klauss | 49:4837ed2aad6b | 91 | //FIXME colocar uma condicao aqui |
klauss | 35:96885a7931f0 | 92 | prompt_process( NULL ); |
klauss | 33:735fd60e96d8 | 93 | wdt.kick(); |
Cola | 22:d2a4b5939115 | 94 | if (pcks_s == 1){ |
klauss | 48:195c97f12e8e | 95 | //pc.printf("\n\r PKG_CSK OK: %d", pkg_cksok); |
klauss | 48:195c97f12e8e | 96 | //pc.printf("\n\r PKG_CSK ERR: %d\n\r", pkg_ckserr); |
klauss | 48:195c97f12e8e | 97 | send_msg("PKG_CSK OK: %d :: PKG_CSK ERR: %d", pkg_cksok, pkg_ckserr ); |
Cola | 24:270b436a1bb0 | 98 | pcks_s =0; |
Cola | 24:270b436a1bb0 | 99 | } |
Cola | 24:270b436a1bb0 | 100 | |
klauss | 52:12930cef17c4 | 101 | if( reset_cks ){ |
klauss | 52:12930cef17c4 | 102 | pkg_cksok = 0; |
klauss | 52:12930cef17c4 | 103 | pkg_ckserr = 0; |
klauss | 52:12930cef17c4 | 104 | send_msg("PKG_CSK OK: %d :: PKG_CSK ERR: %d", pkg_cksok, pkg_ckserr ); |
klauss | 52:12930cef17c4 | 105 | reset_cks = false; |
klauss | 52:12930cef17c4 | 106 | } |
klauss | 52:12930cef17c4 | 107 | |
Cola | 24:270b436a1bb0 | 108 | if (pshowcb == 1){ |
klauss | 48:195c97f12e8e | 109 | send_msg("Registred %d CBx", v_cb->size() ); |
Cola | 24:270b436a1bb0 | 110 | for( register uint8_t i = 0; i < v_cb->size(); i++ ){ |
klauss | 30:8dfb6d8de53d | 111 | Call_Box * cb = ( Call_Box * )v_cb->get_element( i ); |
klauss | 48:195c97f12e8e | 112 | send_msg("Type :: %d -- Ext :: %d -- TimeSlice :: %d -- remain_timeslices :: %d :: v_call->size() :: %d :: Status :: %d :: SIP Status %d", type , cb->get_ext(), cb->get_timeslice(), ts->remain_timeslices(), v_call->size(), cb->status, cb->sip->status ); |
klauss | 48:195c97f12e8e | 113 | } |
klauss | 48:195c97f12e8e | 114 | pshowcb = 0; |
klauss | 48:195c97f12e8e | 115 | } |
klauss | 48:195c97f12e8e | 116 | if( cb_status ){ |
klauss | 48:195c97f12e8e | 117 | cb_status = false; |
klauss | 48:195c97f12e8e | 118 | send_msg("Registred %d CBx", v_cb->size() ); |
klauss | 48:195c97f12e8e | 119 | char str[ 1024 ]; |
klauss | 48:195c97f12e8e | 120 | |
klauss | 48:195c97f12e8e | 121 | if( v_cb->size() == 0 ){ |
klauss | 48:195c97f12e8e | 122 | send_msg("{-/-}"); |
klauss | 48:195c97f12e8e | 123 | }else if( v_cb->size() == 1 ){ |
klauss | 48:195c97f12e8e | 124 | Call_Box * cb = ( Call_Box * )v_cb->get_element( 0 ); |
klauss | 48:195c97f12e8e | 125 | send_msg("{ %d }", cb->get_ext() ); |
klauss | 48:195c97f12e8e | 126 | }else{ |
klauss | 48:195c97f12e8e | 127 | register uint8_t i; |
klauss | 48:195c97f12e8e | 128 | char aux[ 16 ]; |
klauss | 48:195c97f12e8e | 129 | Call_Box * cb = NULL; |
klauss | 48:195c97f12e8e | 130 | strcpy( str, "{ " ); |
klauss | 48:195c97f12e8e | 131 | for( i = 0; i < v_cb->size() - 1; i++ ){ |
klauss | 48:195c97f12e8e | 132 | cb = ( Call_Box * )v_cb->get_element( i ); |
klauss | 48:195c97f12e8e | 133 | sprintf( aux, "%5d, ", cb->get_ext() ); |
klauss | 48:195c97f12e8e | 134 | strcat( str, aux ); |
klauss | 48:195c97f12e8e | 135 | if( ( i != 0 ) && !( i % 10 ) ) strcat( str, "\n\r " ); |
klauss | 48:195c97f12e8e | 136 | } |
klauss | 48:195c97f12e8e | 137 | cb = ( Call_Box * )v_cb->get_element( i ); |
klauss | 48:195c97f12e8e | 138 | sprintf( aux, "%5d ", cb->get_ext() ); |
klauss | 48:195c97f12e8e | 139 | strcat( str, aux ); |
klauss | 48:195c97f12e8e | 140 | strcat( str, " }" ); |
klauss | 48:195c97f12e8e | 141 | send_msg( "%s", str ); |
Cola | 24:270b436a1bb0 | 142 | } |
Cola | 22:d2a4b5939115 | 143 | } |
Cola | 22:d2a4b5939115 | 144 | |
klauss | 30:8dfb6d8de53d | 145 | if( pflood == 1 ) flood(); |
klauss | 30:8dfb6d8de53d | 146 | |
klauss | 0:4d17cd9c8f9d | 147 | if( status != __WAITING__ ){ |
klauss | 0:4d17cd9c8f9d | 148 | __read_cb_buffer__( buffer, buffer_from_cb_ptr ); |
klauss | 0:4d17cd9c8f9d | 149 | status = __WAITING__; |
klauss | 0:4d17cd9c8f9d | 150 | |
klauss | 34:f19d9735428e | 151 | data = __parse_vz_pkg__( &ext, &port, &type, buffer ); |
klauss | 0:4d17cd9c8f9d | 152 | |
klauss | 3:cd9148672e25 | 153 | if( data != NULL ){ |
klauss | 31:bb5fb28a77df | 154 | if( debug_alive == 1 && debug_cb_rx ) debug_msg("Pkg from CBx :: %d -- Type :: %d", ext, type ); |
klauss | 7:019b08223b87 | 155 | if( type != __AUDIO__ ){ |
klauss | 0:4d17cd9c8f9d | 156 | Call_Box * cb = __find_CB__( v_cb, ext ); |
klauss | 0:4d17cd9c8f9d | 157 | if( cb != NULL ){ |
klauss | 3:cd9148672e25 | 158 | cb->reset_elapsed_time(); |
klauss | 0:4d17cd9c8f9d | 159 | if( ( data[ 0 ] ^ cb->get_msg_id() ) == BIT7 ){ |
klauss | 0:4d17cd9c8f9d | 160 | // some pkg reply |
klauss | 0:4d17cd9c8f9d | 161 | if( ( data[ 0 ] | BIT7 ) == cb->get_msg_id() ){ |
klauss | 7:019b08223b87 | 162 | if( type == __BOOT__ ) type = __REGISTRY__; |
klauss | 0:4d17cd9c8f9d | 163 | __send_to_cb__( __build_cb_package__( ext, port, type, |
klauss | 0:4d17cd9c8f9d | 164 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 0:4d17cd9c8f9d | 165 | type = __DO_NOTHING__; |
klauss | 30:8dfb6d8de53d | 166 | if( debug_main ) debug_msg("-- Renviado ultimo pkg --"); |
klauss | 0:4d17cd9c8f9d | 167 | }else if( data[ 0 ] == ( cb->get_msg_id() | BIT7 ) ){ |
klauss | 0:4d17cd9c8f9d | 168 | // ack from CBx |
klauss | 30:8dfb6d8de53d | 169 | if( debug_main ) debug_msg("-- ACK do meu pkg --"); |
klauss | 0:4d17cd9c8f9d | 170 | type = __DO_NOTHING__; |
klauss | 0:4d17cd9c8f9d | 171 | } |
klauss | 0:4d17cd9c8f9d | 172 | } |
klauss | 0:4d17cd9c8f9d | 173 | } |
klauss | 0:4d17cd9c8f9d | 174 | } |
klauss | 0:4d17cd9c8f9d | 175 | }else type = __DO_NOTHING__; |
klauss | 0:4d17cd9c8f9d | 176 | } |
klauss | 2:93bec7313ccc | 177 | //---------------------- |
klauss | 57:78f7191a8b69 | 178 | /* |
klauss | 57:78f7191a8b69 | 179 | if( (int)t.read() % 2 ){ |
klauss | 57:78f7191a8b69 | 180 | led3 = !led3; |
klauss | 57:78f7191a8b69 | 181 | } |
klauss | 57:78f7191a8b69 | 182 | */ |
klauss | 57:78f7191a8b69 | 183 | uint8_t now = t.read(); |
klauss | 57:78f7191a8b69 | 184 | if( before != now ){ |
klauss | 57:78f7191a8b69 | 185 | led3 = !led3; |
klauss | 57:78f7191a8b69 | 186 | before = now; |
klauss | 57:78f7191a8b69 | 187 | } |
klauss | 57:78f7191a8b69 | 188 | |
klauss | 27:98f824719d1c | 189 | if( t.read() > 5 ){ |
klauss | 49:4837ed2aad6b | 190 | static uint8_t count = 0; |
klauss | 53:bb492a8f115a | 191 | static int test_ext = 65531; |
klauss | 53:bb492a8f115a | 192 | static int test_port = 65531; |
klauss | 48:195c97f12e8e | 193 | //send_msg("from_eth = %s - tcp_session = %s", ( from_eth ) ? "true" : "false", ( tcp_session ) ? "true" : "false" ); |
klauss | 48:195c97f12e8e | 194 | if( debug_alive ){ |
klauss | 48:195c97f12e8e | 195 | send_msg("Registred %d CBx", v_cb->size() ); |
klauss | 48:195c97f12e8e | 196 | for( register uint8_t i = 0; i < v_cb->size(); i++ ){ |
klauss | 48:195c97f12e8e | 197 | Call_Box * cb = ( Call_Box * )v_cb->get_element( i ); |
klauss | 48:195c97f12e8e | 198 | send_msg("Type :: %d -- Ext :: %d -- TimeSlice :: %d -- remain_timeslices :: %d :: v_call->size() :: %d :: Status :: %d :: SIP Status %d", type , cb->get_ext(), cb->get_timeslice(), ts->remain_timeslices(), v_call->size(), cb->status, cb->sip->status ); |
klauss | 30:8dfb6d8de53d | 199 | } |
klauss | 33:735fd60e96d8 | 200 | } |
klauss | 48:195c97f12e8e | 201 | /* |
klauss | 30:8dfb6d8de53d | 202 | if( debug_alive == 1 ){ |
klauss | 48:195c97f12e8e | 203 | if( debug_main ) send_msg("Status - alive "); |
klauss | 30:8dfb6d8de53d | 204 | //uint32_t errper = 100*(pkg_ckserr/(pkg_ckserr + pkg_cksok)); |
klauss | 30:8dfb6d8de53d | 205 | //pc.printf("\n\r Error = %d", errper); |
Cola | 21:0bd688722e81 | 206 | } |
klauss | 48:195c97f12e8e | 207 | */ |
klauss | 0:4d17cd9c8f9d | 208 | t.reset(); |
Cola | 22:d2a4b5939115 | 209 | CAB_LED = !CAB_LED; |
klauss | 27:98f824719d1c | 210 | |
klauss | 48:195c97f12e8e | 211 | if( debug_cks ) send_msg("PKG_CSK OK: %d :: PKG_CSK ERR: %d", pkg_cksok, pkg_ckserr ); |
klauss | 40:990683572031 | 212 | |
klauss | 40:990683572031 | 213 | //<><><><><><><><><><> |
klauss | 43:455522f98de5 | 214 | count++; |
klauss | 49:4837ed2aad6b | 215 | if( !( count % 15 ) ){ |
klauss | 44:cc4996469404 | 216 | if( eth_status ){ |
klauss | 44:cc4996469404 | 217 | wdt.kick(); |
klauss | 48:195c97f12e8e | 218 | //eth_status = __init_eth__( ð ); |
klauss | 48:195c97f12e8e | 219 | eth_status = __init_eth__(); |
klauss | 44:cc4996469404 | 220 | if( eth_status ){ |
klauss | 44:cc4996469404 | 221 | if( debug_main ) debug_msg("Cannot connect to eth"); |
klauss | 44:cc4996469404 | 222 | }else{ |
klauss | 44:cc4996469404 | 223 | if( debug_main ) debug_msg("Connection eth - ok"); |
klauss | 44:cc4996469404 | 224 | init_prompt(); |
klauss | 44:cc4996469404 | 225 | } |
klauss | 44:cc4996469404 | 226 | } |
klauss | 44:cc4996469404 | 227 | } |
klauss | 54:448d57291be6 | 228 | //if( count == 4 ){ |
klauss | 43:455522f98de5 | 229 | //debug_msg("Colocar simulacoes de cbx aqui"); |
klauss | 54:448d57291be6 | 230 | //main_test = true; |
klauss | 54:448d57291be6 | 231 | //} |
klauss | 53:bb492a8f115a | 232 | |
klauss | 54:448d57291be6 | 233 | if( main_test ){ |
klauss | 53:bb492a8f115a | 234 | send_msg( "Validando telemetria" ); |
klauss | 53:bb492a8f115a | 235 | for( register uint16_t i = 0; i < __CB_BUFFER_SIZE__; i++ ) buffer[ i ] = 0x42; |
klauss | 55:2f5e7374af9d | 236 | buffer[ 119 ] = 0; |
klauss | 43:455522f98de5 | 237 | data = buffer; |
klauss | 53:bb492a8f115a | 238 | ext = test_ext; |
klauss | 53:bb492a8f115a | 239 | port = test_port; |
klauss | 53:bb492a8f115a | 240 | type = __TELEMETRY__; |
klauss | 48:195c97f12e8e | 241 | main_test = false; |
klauss | 46:a670f187a704 | 242 | } |
klauss | 53:bb492a8f115a | 243 | |
klauss | 48:195c97f12e8e | 244 | /* |
klauss | 46:a670f187a704 | 245 | if( count == 5 * 2 ){ |
klauss | 46:a670f187a704 | 246 | //debug_msg("Colocar simulacoes de cbx aqui"); |
klauss | 46:a670f187a704 | 247 | data = buffer; |
klauss | 46:a670f187a704 | 248 | ext = 891; |
klauss | 46:a670f187a704 | 249 | port = 5001; |
klauss | 46:a670f187a704 | 250 | type = __INVITE__; |
klauss | 46:a670f187a704 | 251 | debug_msg("registro enviado"); |
klauss | 45:c80574f24dc3 | 252 | }*/ |
klauss | 0:4d17cd9c8f9d | 253 | } |
klauss | 0:4d17cd9c8f9d | 254 | //---------------------- |
klauss | 0:4d17cd9c8f9d | 255 | switch( type ){ |
klauss | 0:4d17cd9c8f9d | 256 | case __DO_NOTHING__ :{} |
klauss | 0:4d17cd9c8f9d | 257 | break; |
klauss | 0:4d17cd9c8f9d | 258 | |
klauss | 0:4d17cd9c8f9d | 259 | case __CB_BYE__ : { |
klauss | 0:4d17cd9c8f9d | 260 | Call_Box * cb = __find_CB__( v_cb, ext ); |
klauss | 0:4d17cd9c8f9d | 261 | if( cb != NULL ){ |
klauss | 0:4d17cd9c8f9d | 262 | data[ 0 ] |= BIT7; |
klauss | 0:4d17cd9c8f9d | 263 | cb->set_msg_id( data[ 0 ] ); |
klauss | 30:8dfb6d8de53d | 264 | if( debug_main ) debug_msg( " Request bye from CBx " ); |
klauss | 0:4d17cd9c8f9d | 265 | for( register uint8_t i = 0; i < v_call->size(); i++ ){ |
klauss | 0:4d17cd9c8f9d | 266 | VZ_call * call = (VZ_call *)v_call->get_element( i ); |
klauss | 0:4d17cd9c8f9d | 267 | if( call->get_cb_ext() == ext ){ |
klauss | 4:de46f0d9b14d | 268 | cb->send_bye(); |
klauss | 0:4d17cd9c8f9d | 269 | ts->return_timeslice( cb->get_timeslice() ); |
klauss | 0:4d17cd9c8f9d | 270 | cb->set_timeslice( 0x00 ); |
klauss | 0:4d17cd9c8f9d | 271 | set_status( cb->status, cb_idle ); |
klauss | 13:ae278302dffe | 272 | v_call->remove_element( i ); |
klauss | 13:ae278302dffe | 273 | set_status( cb->sip->status, sip_idle); |
klauss | 0:4d17cd9c8f9d | 274 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 0:4d17cd9c8f9d | 275 | __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, |
klauss | 0:4d17cd9c8f9d | 276 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 13:ae278302dffe | 277 | set_status( cb->sip->status, sip_idle ); |
klauss | 3:cd9148672e25 | 278 | delete( call ); |
klauss | 29:7246460b73f8 | 279 | cb->re_start_timer(); |
klauss | 0:4d17cd9c8f9d | 280 | } |
klauss | 0:4d17cd9c8f9d | 281 | } |
klauss | 0:4d17cd9c8f9d | 282 | } |
klauss | 7:019b08223b87 | 283 | }break; |
klauss | 7:019b08223b87 | 284 | |
klauss | 0:4d17cd9c8f9d | 285 | case __INVITE__ : { |
klauss | 30:8dfb6d8de53d | 286 | if( debug_main ) debug_msg("Request Invite received from Cbx %i", ext); |
klauss | 0:4d17cd9c8f9d | 287 | Call_Box * cb = __find_CB__( v_cb, ext ); |
klauss | 0:4d17cd9c8f9d | 288 | if( cb == NULL ){ |
klauss | 31:bb5fb28a77df | 289 | if( debug_main ) debug_msg("Adding CBx :: %i", ext ); |
klauss | 0:4d17cd9c8f9d | 290 | cb = new Call_Box( ext, port ); |
klauss | 0:4d17cd9c8f9d | 291 | v_cb->add( cb ); |
klauss | 0:4d17cd9c8f9d | 292 | set_status( cb->status, cb_idle ); |
klauss | 0:4d17cd9c8f9d | 293 | cb->registry(); |
klauss | 0:4d17cd9c8f9d | 294 | } |
klauss | 13:ae278302dffe | 295 | cb->reset_elapsed_time(); |
klauss | 10:22da1a0ac1e1 | 296 | if( v_call->size() != 0 ){ |
klauss | 10:22da1a0ac1e1 | 297 | data[ 0 ] |= BIT7; |
klauss | 10:22da1a0ac1e1 | 298 | cb->set_msg_id( data[ 0 ] ); |
klauss | 10:22da1a0ac1e1 | 299 | set_status(cb->status,cb_idle); |
klauss | 10:22da1a0ac1e1 | 300 | cb->set_timeslice( 0x00 ); |
klauss | 10:22da1a0ac1e1 | 301 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 10:22da1a0ac1e1 | 302 | __send_to_cb__( __build_cb_package__( ext, port, __INVITE__, |
klauss | 10:22da1a0ac1e1 | 303 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 30:8dfb6d8de53d | 304 | if( debug_main ) debug_msg( "denying call - another call box on call" ); |
klauss | 10:22da1a0ac1e1 | 305 | break; |
klauss | 10:22da1a0ac1e1 | 306 | } |
klauss | 0:4d17cd9c8f9d | 307 | set_status( cb->status, cb_trying ); |
klauss | 30:8dfb6d8de53d | 308 | if( debug_main ) debug_msg("Request invite cbx status :: %d", cb->status ); |
klauss | 32:43041f5e27c4 | 309 | |
klauss | 32:43041f5e27c4 | 310 | //FIXME essa logica deve estar la embaixo, fora do switch maior, a ideia eh |
klauss | 32:43041f5e27c4 | 311 | // quando receber um pedido de invite, apenas manda o invite pro server |
klauss | 32:43041f5e27c4 | 312 | // dai rodar, ver se alguem mandou alguma coisa e voltar a tratar com o |
klauss | 32:43041f5e27c4 | 313 | // * ver se ja esta tudo ok, a ideia é fazer esse pedido de invite funcionar |
klauss | 32:43041f5e27c4 | 314 | // assincrono. |
klauss | 0:4d17cd9c8f9d | 315 | switch( cb->status ){ |
klauss | 0:4d17cd9c8f9d | 316 | case cb_on_call : { |
klauss | 0:4d17cd9c8f9d | 317 | // a priori, nao fazer nada |
klauss | 0:4d17cd9c8f9d | 318 | //data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 0:4d17cd9c8f9d | 319 | //__send_to_cb__( __build_cb_package__( ext, port, __BYE__, |
klauss | 0:4d17cd9c8f9d | 320 | // ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 0:4d17cd9c8f9d | 321 | }break; |
klauss | 0:4d17cd9c8f9d | 322 | |
klauss | 0:4d17cd9c8f9d | 323 | case cb_ringing : { |
klauss | 0:4d17cd9c8f9d | 324 | // tratar sip 2 |
klauss | 0:4d17cd9c8f9d | 325 | }break; |
klauss | 0:4d17cd9c8f9d | 326 | |
klauss | 0:4d17cd9c8f9d | 327 | case cb_trying : { |
klauss | 0:4d17cd9c8f9d | 328 | data[ 0 ] |= BIT7; |
klauss | 0:4d17cd9c8f9d | 329 | cb->set_msg_id( data[ 0 ] ); |
klauss | 0:4d17cd9c8f9d | 330 | cb->set_timeslice( ts->get_timeslice() ); |
klauss | 0:4d17cd9c8f9d | 331 | if( cb->get_timeslice() == 0x00 ){ |
klauss | 0:4d17cd9c8f9d | 332 | //sem timeslice pra tratar com o * |
klauss | 9:ffa64f38ef9c | 333 | set_status(cb->status,cb_idle); |
klauss | 0:4d17cd9c8f9d | 334 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 0:4d17cd9c8f9d | 335 | __send_to_cb__( __build_cb_package__( ext, port, __INVITE__, |
klauss | 0:4d17cd9c8f9d | 336 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 13:ae278302dffe | 337 | set_status( cb->sip->status, sip_idle); |
klauss | 31:bb5fb28a77df | 338 | if( debug_main ) debug_msg( "-- Trying -- without TS -- %s ", write_buffer ); |
klauss | 0:4d17cd9c8f9d | 339 | }else{ |
klauss | 0:4d17cd9c8f9d | 340 | set_status(cb->status,cb_busy); |
klauss | 0:4d17cd9c8f9d | 341 | data[ __TIMESLICE_PLACE__ ] = cb->get_timeslice(); |
klauss | 0:4d17cd9c8f9d | 342 | __send_to_cb__( __build_cb_package__( ext, port, __INVITE__, |
klauss | 0:4d17cd9c8f9d | 343 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 0:4d17cd9c8f9d | 344 | |
klauss | 31:bb5fb28a77df | 345 | if( debug_main ) debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); |
klauss | 0:4d17cd9c8f9d | 346 | |
klauss | 3:cd9148672e25 | 347 | cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) ); |
klauss | 0:4d17cd9c8f9d | 348 | VZ_call * call = cb->invite(); |
klauss | 0:4d17cd9c8f9d | 349 | |
klauss | 0:4d17cd9c8f9d | 350 | if( call != NULL ){ |
klauss | 0:4d17cd9c8f9d | 351 | v_call->add( call ); |
klauss | 0:4d17cd9c8f9d | 352 | set_status(cb->status,cb_on_call); |
klauss | 0:4d17cd9c8f9d | 353 | |
klauss | 31:bb5fb28a77df | 354 | if( debug_main ) debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); |
klauss | 0:4d17cd9c8f9d | 355 | __send_to_cb__( __build_cb_package__( ext, port, __INVITE__, |
klauss | 0:4d17cd9c8f9d | 356 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 31:bb5fb28a77df | 357 | if( debug_main ) debug_msg( "-- Trying -- accepting call request --" ); |
klauss | 0:4d17cd9c8f9d | 358 | }else{ |
klauss | 4:de46f0d9b14d | 359 | set_status( cb->status,cb_idle); |
klauss | 0:4d17cd9c8f9d | 360 | ts->return_timeslice( cb->get_timeslice() ); |
klauss | 0:4d17cd9c8f9d | 361 | cb->set_timeslice( 0x00 ); |
klauss | 0:4d17cd9c8f9d | 362 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 31:bb5fb28a77df | 363 | if( debug_main ) debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); |
klauss | 0:4d17cd9c8f9d | 364 | __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, |
klauss | 0:4d17cd9c8f9d | 365 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 31:bb5fb28a77df | 366 | if( debug_main ) debug_msg( "-- Trying -- denying call request --" ); |
klauss | 13:ae278302dffe | 367 | set_status( cb->sip->status, sip_idle); |
klauss | 0:4d17cd9c8f9d | 368 | } |
klauss | 0:4d17cd9c8f9d | 369 | } |
klauss | 4:de46f0d9b14d | 370 | }break; |
klauss | 0:4d17cd9c8f9d | 371 | case cb_busy : { |
klauss | 25:2cf5e8dd4035 | 372 | set_status( cb->status,cb_idle); |
klauss | 25:2cf5e8dd4035 | 373 | ts->return_timeslice( cb->get_timeslice() ); |
klauss | 25:2cf5e8dd4035 | 374 | cb->set_timeslice( 0x00 ); |
klauss | 25:2cf5e8dd4035 | 375 | data[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 30:8dfb6d8de53d | 376 | if( debug_main ) debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); |
klauss | 25:2cf5e8dd4035 | 377 | __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, |
klauss | 25:2cf5e8dd4035 | 378 | ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 30:8dfb6d8de53d | 379 | if( debug_main ) debug_msg( "-- Trying -- denying call request << Busy Here >> --" ); |
klauss | 25:2cf5e8dd4035 | 380 | set_status( cb->sip->status, sip_idle ); |
klauss | 0:4d17cd9c8f9d | 381 | }break; |
klauss | 0:4d17cd9c8f9d | 382 | } |
klauss | 0:4d17cd9c8f9d | 383 | }break; |
klauss | 4:de46f0d9b14d | 384 | case __REGISTRY__ : { |
klauss | 4:de46f0d9b14d | 385 | Call_Box * cb = NULL; |
klauss | 2:93bec7313ccc | 386 | |
klauss | 4:de46f0d9b14d | 387 | data[ 0 ] |= BIT7 ; |
klauss | 4:de46f0d9b14d | 388 | cb = __find_CB__( v_cb, ext ); |
klauss | 4:de46f0d9b14d | 389 | if( cb != NULL ){ |
klauss | 4:de46f0d9b14d | 390 | cb->reset_elapsed_time(); |
klauss | 30:8dfb6d8de53d | 391 | if( debug_main ) debug_msg(" reset_elapsed_time CBx -- %d", ext ); |
klauss | 0:4d17cd9c8f9d | 392 | }else{ |
klauss | 30:8dfb6d8de53d | 393 | if( debug_main ) debug_msg("Adding Cbx :: %d -- Type :: %d", ext, type ); |
klauss | 4:de46f0d9b14d | 394 | cb = new Call_Box( ext, port ); |
klauss | 4:de46f0d9b14d | 395 | v_cb->add( cb ); |
klauss | 30:8dfb6d8de53d | 396 | if( debug_main ) debug_msg("Added CBx -- %d", ext ); |
klauss | 0:4d17cd9c8f9d | 397 | } |
klauss | 30:8dfb6d8de53d | 398 | if( debug_main ) debug_msg("::registered %d - %d::", ext, port ); |
klauss | 4:de46f0d9b14d | 399 | cb->registry(); |
klauss | 4:de46f0d9b14d | 400 | }break; |
klauss | 4:de46f0d9b14d | 401 | case __BOOT__ : { |
klauss | 4:de46f0d9b14d | 402 | __send_to_cb__( __build_cb_package__( ext, port, __REGISTRY__, |
klauss | 4:de46f0d9b14d | 403 | ( char * )data, data[ 0 ], __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 4:de46f0d9b14d | 404 | }break; |
klauss | 4:de46f0d9b14d | 405 | case __TELEMETRY__ : { |
klauss | 53:bb492a8f115a | 406 | if( debug_telemetry ) send_msg("::telemetry from %d - %d::", ext, port ); |
klauss | 53:bb492a8f115a | 407 | build_telemetry_report( ext, port, ( char *)data ); |
klauss | 4:de46f0d9b14d | 408 | }break; |
klauss | 36:728498a78e1e | 409 | |
klauss | 36:728498a78e1e | 410 | case __PROMPT__ : { |
klauss | 48:195c97f12e8e | 411 | send_msg( "Prompt pkg from ( %i, %i ) ::", ext, port ); |
klauss | 48:195c97f12e8e | 412 | /* |
klauss | 48:195c97f12e8e | 413 | if( tcp_session ){ // udp ? |
klauss | 48:195c97f12e8e | 414 | char tmp[ 255 ]; |
klauss | 48:195c97f12e8e | 415 | sprintf( tmp, "Prompt pkg from ( %i, %i ) :: ", ext, port ); |
klauss | 48:195c97f12e8e | 416 | tcp_client.send_all( tmp, strlen( tmp ) ); |
klauss | 48:195c97f12e8e | 417 | } |
klauss | 48:195c97f12e8e | 418 | */ |
klauss | 48:195c97f12e8e | 419 | for( register int i = 0; i < __CB_BUFFER_SIZE__; i++ ){ |
klauss | 36:728498a78e1e | 420 | pc.printf("%3i ", data[ i ] ); |
klauss | 48:195c97f12e8e | 421 | } |
klauss | 48:195c97f12e8e | 422 | //FIXMEj isso nao vai funcionar em udp, mudar pra send_msg |
klauss | 36:728498a78e1e | 423 | pc.printf("\n\r"); |
klauss | 48:195c97f12e8e | 424 | |
klauss | 48:195c97f12e8e | 425 | if( tcp_session ){ |
klauss | 48:195c97f12e8e | 426 | char aux[ __CB_BUFFER_SIZE__ + 3 ]; |
klauss | 48:195c97f12e8e | 427 | strncpy( aux, (char * )data, __CB_BUFFER_SIZE__ ); |
klauss | 48:195c97f12e8e | 428 | strcat( aux, "\n\r\0" ); |
klauss | 48:195c97f12e8e | 429 | tcp_client.send_all( ( char *)data, strlen( (char * )data ) ); |
klauss | 48:195c97f12e8e | 430 | } |
klauss | 36:728498a78e1e | 431 | }break; |
klauss | 0:4d17cd9c8f9d | 432 | case __AUDIO__ : { |
klauss | 0:4d17cd9c8f9d | 433 | Call_Box * cb; |
klauss | 0:4d17cd9c8f9d | 434 | VZ_call * call = NULL; |
klauss | 0:4d17cd9c8f9d | 435 | cb = NULL; |
klauss | 0:4d17cd9c8f9d | 436 | call = __find_Call__( v_call, ext ); |
klauss | 0:4d17cd9c8f9d | 437 | if( call != NULL ){ |
klauss | 30:8dfb6d8de53d | 438 | char * pkg = call->build_eth_package( data + 2 ); |
klauss | 0:4d17cd9c8f9d | 439 | call->send_message( pkg ); |
klauss | 0:4d17cd9c8f9d | 440 | cb = __find_CB__( v_cb, ext ); |
klauss | 0:4d17cd9c8f9d | 441 | if( cb != NULL ) cb->reset_elapsed_time(); |
klauss | 18:01a93677e40c | 442 | }else{ |
klauss | 30:8dfb6d8de53d | 443 | if( debug_main ) debug_msg("received missed package from CBx :: %i -- Type :: %i", ext, type ); |
klauss | 0:4d17cd9c8f9d | 444 | } |
klauss | 0:4d17cd9c8f9d | 445 | }break; |
klauss | 9:ffa64f38ef9c | 446 | }// fim switch |
klauss | 0:4d17cd9c8f9d | 447 | for( register int i = 0; i < v_call->size(); i++ ){ |
klauss | 0:4d17cd9c8f9d | 448 | VZ_call * call = ( VZ_call * )v_call->get_element( i ); |
klauss | 0:4d17cd9c8f9d | 449 | int length = 0; |
klauss | 0:4d17cd9c8f9d | 450 | char * tmp = call->get_eth_message( &length ); |
klauss | 0:4d17cd9c8f9d | 451 | if( tmp != NULL ){ |
klauss | 0:4d17cd9c8f9d | 452 | Call_Box * cb = NULL; |
klauss | 0:4d17cd9c8f9d | 453 | int cb_port = 0xffff; |
klauss | 0:4d17cd9c8f9d | 454 | cb = __find_CB__( v_cb, call->get_cb_ext() ); |
klauss | 4:de46f0d9b14d | 455 | |
klauss | 4:de46f0d9b14d | 456 | if( cb != NULL ){ |
klauss | 4:de46f0d9b14d | 457 | cb_port = cb->get_port(); |
klauss | 30:8dfb6d8de53d | 458 | }else if( debug_main ) debug_msg("received missed package from CBx :: %i -- Type :: %i", ext, type ); |
klauss | 4:de46f0d9b14d | 459 | |
klauss | 0:4d17cd9c8f9d | 460 | uint8_t * pkg2cb = __build_cb_package__( call->get_cb_ext(), cb_port, __AUDIO__, |
klauss | 0:4d17cd9c8f9d | 461 | tmp, __AUDIO__, length, write_buffer ); |
klauss | 4:de46f0d9b14d | 462 | |
klauss | 0:4d17cd9c8f9d | 463 | __send_to_cb__( pkg2cb ); |
klauss | 0:4d17cd9c8f9d | 464 | } |
klauss | 14:22a35f575502 | 465 | } |
klauss | 28:94aec56c6329 | 466 | if( v_call->size() == 0 ) registry_aging( v_cb, buffer, write_buffer ); |
klauss | 4:de46f0d9b14d | 467 | |
klauss | 0:4d17cd9c8f9d | 468 | int ret = sip_manager( v_cb, v_call, write_buffer ); |
klauss | 0:4d17cd9c8f9d | 469 | if( ret > 0x00 ){ |
klauss | 0:4d17cd9c8f9d | 470 | Call_Box * cb = __find_CB__( v_cb, ret ); |
klauss | 4:de46f0d9b14d | 471 | if( cb != NULL ){ |
klauss | 4:de46f0d9b14d | 472 | if( cb->status == cb_on_call ){ |
klauss | 4:de46f0d9b14d | 473 | ts->return_timeslice( cb->get_timeslice() ); |
klauss | 4:de46f0d9b14d | 474 | cb->set_timeslice( 0x00 ); |
klauss | 4:de46f0d9b14d | 475 | set_status(cb->status,cb_idle); |
klauss | 4:de46f0d9b14d | 476 | buffer[ __TIMESLICE_PLACE__ ] = 0x00; |
klauss | 4:de46f0d9b14d | 477 | cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) ); |
klauss | 4:de46f0d9b14d | 478 | for( register uint8_t i = 0; i < v_call->size(); i++ ){ |
klauss | 4:de46f0d9b14d | 479 | VZ_call * call = ( VZ_call * )v_call->get_element( i ); |
klauss | 4:de46f0d9b14d | 480 | if( call->get_cb_ext() == ret ){ |
klauss | 4:de46f0d9b14d | 481 | v_call->remove_element( i ); |
klauss | 4:de46f0d9b14d | 482 | delete( call ); |
klauss | 4:de46f0d9b14d | 483 | } |
klauss | 2:93bec7313ccc | 484 | } |
klauss | 4:de46f0d9b14d | 485 | __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, |
klauss | 4:de46f0d9b14d | 486 | ( char * )buffer, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); |
klauss | 38:af5ecd6997ab | 487 | //FIXME talvez eu nao precise dessa linha mudar o set_status( cb->sip->status, sip_idle ); pra ver o que acontece |
klauss | 38:af5ecd6997ab | 488 | //cb->reset_sip(); |
klauss | 13:ae278302dffe | 489 | set_status( cb->sip->status, sip_idle ); |
klauss | 29:7246460b73f8 | 490 | cb->re_start_timer(); |
klauss | 0:4d17cd9c8f9d | 491 | } |
klauss | 30:8dfb6d8de53d | 492 | }else if( debug_main ) debug_msg("Missed bye request from * CBx :: %d -- Type :: %d", ext, type ); |
klauss | 0:4d17cd9c8f9d | 493 | } |
klauss | 13:ae278302dffe | 494 | |
klauss | 10:22da1a0ac1e1 | 495 | call_manager( v_call, v_cb, buffer, write_buffer, ts ); |
klauss | 0:4d17cd9c8f9d | 496 | |
klauss | 0:4d17cd9c8f9d | 497 | static uint8_t flag = 0; |
klauss | 0:4d17cd9c8f9d | 498 | if( v_call->size() == 0 ){ |
klauss | 0:4d17cd9c8f9d | 499 | if (flag == 0) { flag = 1; } |
klauss | 0:4d17cd9c8f9d | 500 | ts->reset(); |
klauss | 49:4837ed2aad6b | 501 | }else{ |
klauss | 0:4d17cd9c8f9d | 502 | if (flag == 1) { flag = 0; } |
klauss | 0:4d17cd9c8f9d | 503 | } |
klauss | 33:735fd60e96d8 | 504 | |
klauss | 45:c80574f24dc3 | 505 | /* |
klauss | 40:990683572031 | 506 | int length; |
klauss | 33:735fd60e96d8 | 507 | if( udp_timer.read() > 1 && !listen_udp ){ |
klauss | 40:990683572031 | 508 | data = (uint8_t *)listen_eth_udp( (char *)buffer, &length ); |
klauss | 33:735fd60e96d8 | 509 | if( length ){ |
klauss | 33:735fd60e96d8 | 510 | listen_udp = true; |
klauss | 33:735fd60e96d8 | 511 | debug_msg(""); |
klauss | 33:735fd60e96d8 | 512 | }else udp_timer.reset(); |
klauss | 33:735fd60e96d8 | 513 | } |
klauss | 33:735fd60e96d8 | 514 | if( listen_udp ){ |
klauss | 40:990683572031 | 515 | data = (uint8_t *)listen_eth_udp( (char *)buffer, &length ); |
klauss | 33:735fd60e96d8 | 516 | if( udp_timer.read() > 30 ){ |
klauss | 33:735fd60e96d8 | 517 | listen_udp = false; |
klauss | 33:735fd60e96d8 | 518 | udp_timer.reset(); |
klauss | 33:735fd60e96d8 | 519 | } |
klauss | 33:735fd60e96d8 | 520 | } |
klauss | 45:c80574f24dc3 | 521 | */ |
klauss | 30:8dfb6d8de53d | 522 | type = __DO_NOTHING__; |
klauss | 0:4d17cd9c8f9d | 523 | } |
klauss | 0:4d17cd9c8f9d | 524 | } |