Versão limpa em 04/09/2014. Telnet funcionando.

Dependencies:   EthernetInterface mbed-rtos mbed NTPClient

Revision:
37:51fed2a3e009
Parent:
34:f1927c94cf8f
Child:
42:d6f9ce115eaf
diff -r 66e4deb9c249 -r 51fed2a3e009 Codes/EventDetector.cpp
--- a/Codes/EventDetector.cpp	Fri May 22 21:32:00 2015 +0000
+++ b/Codes/EventDetector.cpp	Thu Jul 30 21:42:06 2015 +0000
@@ -276,22 +276,27 @@
     //rfid[7] = (char)outlet_number + '0';
     
     // Com leitor de RFID
-    char rfid[9];
-    rfid[0] = '\0';
+    char rfid[9], aux2[5];
+    //rfid[0] = '\0';
     //send hitag request
     //capture hitag response
     //printf("OUTLET=%d\n",outlet_index+1);
         
-    //Capture::ReadRFID(outlet_number+1,rfid);
+   
     if (Settings::get_ReadRfid()){
-        if (! Capture::ReadRFID(outlet_number+1,rfid) ){ // não leu tag RFID
-            //printf("Entrou\n");
-            flagrfid = 1;
-        }
+        
+        Capture::ReadRFID(outlet_number,rfid);
+        
+        if (strcmp(rfid, "00000000") != 0){ // get rfid number 
+           //printf("Leu RFID [%s]\n", rfid);
+           flagrfid = 1;
+       }
     }
     if (! flagrfid){
-        strcpy(rfid, "1234560");
-        rfid[7] = (char)outlet_number + '0';        
+        strcpy(rfid, "FFFF");
+        sprintf(aux2, "%04d", outlet_number);
+        strcat(rfid, aux2);
+        //rfid[7] = (char)outlet_number + '0';        
     }
     //printf("#%s#\n", rfid);