IoT for mbed1

Dependencies:   4DGL-uLCD-SE IoTsecuritySys PinDetect mbed-rtos mbed

Fork of IoT by Tal Landes

Revision:
7:758d4e6fc145
Parent:
6:33185f926189
Child:
8:429fa05b4952
diff -r 33185f926189 -r 758d4e6fc145 main.cpp
--- a/main.cpp	Mon Dec 07 20:08:40 2015 +0000
+++ b/main.cpp	Tue Dec 08 19:39:21 2015 +0000
@@ -7,7 +7,6 @@
 #include "PinDetect.h"
 #include "uLCD_4DGL.h"
 #include "SongPlayer.h"
-#include "PinDetect.h"
 #include "Speaker.h"
 #include "EthernetInterface.h"
 /* CODE_LENGTH needs to be double the amount of numbers you
@@ -137,7 +136,7 @@
         case Cleared:
             if(key_code == 12 ){
                 state = Armed;
-                Ethernet_massage_Send("UpdateStatus");
+                //Ethernet_massage_Send("UpdateStatus");
                 }
             else if (key_code == 11 ){
                 doorlock = 1;  
@@ -278,7 +277,7 @@
                         codeCounter = 0;
                         //code_enabled = true;
                         state = Second_Step;
-                        //Ethernet_massage_Send("UpdateStatus");
+                        Ethernet_massage_Send("UpdateStatus");
                     }
                     else{
                         ////////////////////////PC_Access.lock();
@@ -306,7 +305,7 @@
                         code_enabled = false;
                         state = Cleared;
                         Ethernet_massage_Send("TextCode");
-                        //Ethernet_massage_Send("UpdateStatus");
+                        Ethernet_massage_Send("UpdateStatus");
                     }
                     else{
                         ////////////////////////PC_Access.lock();
@@ -391,11 +390,11 @@
             if (IrVoltage <= 0.1) { //if value just nois reset timer
                 t.reset();
                 state = Armed;
-                //Ethernet_massage_Send("UpdateStatus");
+                Ethernet_massage_Send("UpdateStatus");
                 }
             if (t.read() >= 5) { //wait 5 seconds to make sure that sense someone 
                 state = IR_sensed; 
-                //Ethernet_massage_Send("UpdateStatus");
+                Ethernet_massage_Send("UpdateStatus");
                 }
             Thread::wait(1000);
         }
@@ -473,7 +472,7 @@
                         }
                         if (state == IR_sensed) {
                             state = Alarm_ON;
-                            //Ethernet_massage_Send("UpdateStatus");
+                            Ethernet_massage_Send("UpdateStatus");
                             Ethernet_massage_Send("TextAlarm");
                             }
 
@@ -567,7 +566,7 @@
     eth.connect();
 //pc.printf("IP Address is: %s\n\r", eth.getIPAddress());
     while (1) {
-                        Thread::wait(1000);
+                        Thread::wait(3000);
         int timeout;
 
         //t2.start();                 
@@ -586,7 +585,7 @@
                         buffer[ret] = '\0';
                         Consul_Access.wait();
                         ////////////////////////PC_Access.lock();
-                        pc.printf("Received %d chars from server:\n%s\n", ret, buffer);
+                        //pc.printf("Received %d chars from server:\n%s\n", ret, buffer);
                         ////PC_Access.unlock();
                         Consul_Access.release();
                         }
@@ -623,7 +622,7 @@
                             strcat(http_cmd, charCode);
                             strcat(http_cmd, " HTTP/1.0\n\n");
                             //////////////////////////PC_Access.lock();
-                            pc.printf("%s",http_cmd);
+                            //pc.printf("%s",http_cmd);
                             ////PC_Access.unlock();
                             sock.send_all(http_cmd, sizeof(http_cmd)-1);
                     }
@@ -637,7 +636,7 @@
                             strcat(http_cmd, charCode);
                             strcat(http_cmd, " HTTP/1.0\n\n");
                             //////////////////////////PC_Access.lock();
-                            pc.printf("%s",http_cmd);
+                            //pc.printf("%s",http_cmd);
                             ////PC_Access.unlock();
                             sock.send_all(http_cmd, sizeof(http_cmd)-1);
                     }
@@ -650,7 +649,7 @@
                             strcat(http_cmd, tempStatus);
                             strcat(http_cmd, " HTTP/1.0\n\n");
                             //////////////////////////PC_Access.lock();
-                            pc.printf("%s",http_cmd);
+                            //pc.printf("%s",http_cmd);
                             ////PC_Access.unlock();
                             sock.send_all(http_cmd, sizeof(http_cmd)-1);
                     }
@@ -666,7 +665,7 @@
                         buffer[ret] = '\0';
                         Consul_Access.wait();
                         ////////////////////////PC_Access.lock();
-                       pc.printf("Received %d chars from server:\n%s\n", ret, buffer);
+                       //pc.printf("Received %d chars from server:\n%s\n", ret, buffer);
                         ////PC_Access.unlock();
                         Consul_Access.release();
                         }