Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
fw_handler.cpp
00001 #include "fw.h" 00002 00003 UDPSocket fw_sock; 00004 Endpoint fw_server; 00005 uint16_t miss_fw_send_pkg = 0; 00006 00007 int init_fw_handler ( void ) 00008 { 00009 char buffer_fw_server_ip [ 16 ] = ""; 00010 00011 cm -> get_fw_server_ip ( buffer_fw_server_ip ); 00012 00013 int addr = fw_server.set_address ( buffer_fw_server_ip , ( int ) cm -> get_fw_server_port () ); 00014 00015 if ( debug_fw ) vz_printf (" Valor de retorno set_address -- %d ", addr ); 00016 00017 int bind = fw_sock.bind ( __FW_HEADER_PORT__ ); 00018 00019 fw_sock.set_blocking ( false, 0 ); 00020 00021 if( debug_fw ) vz_printf (" Valor de retorno bind -- %d ", bind ); 00022 00023 return ( 0 ); 00024 } 00025 00026 void re_start_fw ( void ) 00027 { 00028 int close = fw_sock.close (); 00029 if ( debug_fw || debug_reconnect ) vz_printf (" Valor de retorno close-- %d ", close ); 00030 00031 init_fw_handler (); 00032 } 00033 00034 void fw_cbx_pkg ( const int ext, char * data ) 00035 { 00036 if ( data not_eq NULL ) 00037 { 00038 static uint8_t fw_cbx_pkg_id = 0x00; 00039 00040 data [ CB_BUFFER_SIZE - 1 ] = fw_cbx_pkg_id ++; 00041 00042 int send = fw_sock.sendTo ( fw_server, data, CB_BUFFER_SIZE ); 00043 00044 if ( send not_eq CB_BUFFER_SIZE ) 00045 { 00046 if ( debug_reconnect ) 00047 { 00048 vz_printf ( "[%d] Reconnect FW - %d", ext, send ); 00049 } 00050 00051 miss_fw_send_pkg ++; 00052 re_start_fw (); 00053 } 00054 } 00055 }
Generated on Tue Jul 12 2022 16:25:04 by
