Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
125:8ff4dc96ad58
Parent:
124:c1b6c893e1c3
Child:
126:1f90756250fb
--- a/fw_handler.cpp	Wed May 13 14:25:57 2015 +0000
+++ b/fw_handler.cpp	Wed May 13 21:18:12 2015 +0000
@@ -9,12 +9,12 @@
     char buff_port[ 8 ] = "";
     int fw_port = 0;
 
-    FILE *fp = fopen( "/qspi/fw_ip.txt", "r");
-    if( fp == NULL ){
+    FILE *fip = fopen( "/qspi/fw_ip.txt", "r");
+    if( fip == NULL ){
         if( debug_file || debug_reconnect ) send_msg ("Failed to open /qspi/fw_ip.txt" );
         strncpy( buff_ip, __FW_SERVER_IP__, 20 );
     }else{
-        int read = fread( buff_ip, 1, 512, fp );
+        int read = fread( buff_ip, 1, 512, fip );
         if( read > 0 ){
             for( int i = 0; i < read; i++ ) 
                 if( buff_ip[ i ] == '\n' || buff_ip[ i ] == '\r' ){
@@ -27,22 +27,25 @@
             strncpy( buff_ip, __FW_SERVER_IP__, 20 );
         }
     }
-    if( fp != NULL ) fclose( fp );
+    if( fip != NULL ) fclose( fip );
     
-    fp = fopen( "/qspi/fw_port.txt", "r");
-    if( fp == NULL ) {
+    FILE * fport = fopen( "/qspi/fw_port.txt", "r");
+    
+    if( fport == NULL ) {
         if( debug_fw || debug_reconnect ) send_msg ("Failed to open /qspi/fw_port.txt" );
         fw_port = __FW_SERVER_PORT__;
     } else {
-        if( fread( (void *)buff_port, 1, 32, fp ) > 0 ) {
-            fw_port = atoi( buff_port );
+        if( fread ( (void *) buff_port, 1, 32, fport ) > 0 )
+        {
+            fw_port = atoi ( buff_port );
             if( debug_fw || debug_reconnect ) send_msg ( "fw server port %d", fw_port );
         } else {
             if( debug_fw || debug_reconnect ) send_msg ( "Failed to read /qspi/fw_port.txt" );
             fw_port = __FW_SERVER_PORT__;
         }
     }
-    if( fp != NULL ) fclose( fp );
+    if( fport != NULL ) fclose( fport );
+    
     int addr = fw_server.set_address( buff_ip , fw_port );
     if( debug_fw ) send_msg(" Valor de retorno set_address -- %d ", addr );
     fw_sock.set_blocking( false, 0 );