Completing the addition of iotcloud into the 4th benchmark - alarm control over the...
[iot2.git] / benchmarks / Java / HomeSecurityController / HomeSecurityController.java
index c146c6f61e4190cae0ea02309672f256f19972ef..6615f8313e2208816f11a4a26c58d078818aeb06 100644 (file)
@@ -147,7 +147,7 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
                                createKeyIoTCloud("alarm", NOT_ACTIVE);
                                System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
                        }
-                       // TODO: Just use alarm for now as a status to cloud
+                       // TODO: We can extend the usage of other keys to have a complete monitoring system for every device
                        /*for(SmartthingsSensorSmart smartSensor : smartSensorsSet.values()) {
                                
                                createKeyIoTCloud("sensor" + Integer.toString(id++), NOT_ACTIVE);
@@ -201,7 +201,7 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
         *   @return [void] None.
         */
        private void updateIoTCloud(String key, IoTString val) {
-
+               // No key creation here!
                try {
                        IoTString iotKey = new IoTString(key);
                        t1.update();
@@ -253,8 +253,6 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
                                senDetectStatus.put(sensorId, false);
                                System.out.println("DEBUG: Initialized sensor detection to false!");
                                // Initialize IoTCloud
-//                             createKeyIoTCloud("sensor" + Integer.toString(sensorId), NOT_ACTIVE);
-//                             System.out.println("DEBUG: Setting sensor" + sensorId + " to NOT-ACTIVE!");
                                sen.setId(sensorId++);
                                sen.registerCallback(this);
                                System.out.println("DEBUG: Registered sensor callback!");
@@ -296,10 +294,6 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
 
                        // Initialize detection to false
                        camDetectStatus.put(cam, false);
-
-                       // Initialize IoTCloud
-//                     createKeyIoTCloud("camera", NOT_ACTIVE);
-//                     System.out.println("DEBUG: Setting camera to NOT-ACTIVE!");
                }
        }
 
@@ -313,18 +307,10 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
                // Get and init the alarm (this single alarm set can serve multiple zones / rooms)
                Iterator alarmIt = alarmSet.iterator();
                AlarmSmart alm = (AlarmSmart) alarmIt.next();
-               // Initialize IoTCloud - only 1 alarm
-//             createKeyIoTCloud("alarm", NOT_ACTIVE);
-//             System.out.println("DEBUG: Setting alarm to NOT-ACTIVE!");
                // Initialize the alarm controller, do it here since it only needs to be done once per controller
                try {
                        alm.init();
                        System.out.println("DEBUG: Initialized alarm!");
-                       // TODO: Check that this initialization works for multiple times - might be that setZone() only works once!
-                       //for (RoomSmart room : roomSet.values()) {
-                       //      turnOffAlarms(room.getRoomID());
-                       //      System.out.println("DEBUG: Initialized alarm for room (turn off): " + room.getRoomID());
-                       //}
                } catch (Exception e) {
                        e.printStackTrace();
                }
@@ -347,9 +333,6 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
                                System.out.println("DEBUG: Initialized doorlock! ID: " + doorlockId);
                                doorlockStatus.put(doorlockId, false);
                                System.out.println("DEBUG: Initialized doorlock status to false!");
-                               // Initialize IoTCloud
-//                             createKeyIoTCloud("doorlock" + Integer.toString(doorlockId), NOT_ACTIVE);
-//                             System.out.println("DEBUG: Setting doorlock to NOT-ACTIVE!");
                                doorlock.setId(doorlockId++);
                                doorlock.registerCallback(this);
                                System.out.println("DEBUG: Registered doorlock callback!");
@@ -647,12 +630,6 @@ public class HomeSecurityController implements SmartthingsSensorCallback, Smartt
 
                        // Init all Smartthings sensors
                        initSmartthingsSensors(rm);
-                       //try {
-                       //      Thread.sleep(5000);
-                       //} catch (Exception e) {
-                       //      e.printStackTrace();
-                       //}
-
                }
                // Init all doorlocks
                initDoorLocks();