Benchmark added
[iotcloud.git] / version2 / src / java / light_fan_benchmark / WemoController.java
index 16db7ae49c0d86ccd86ea612eb1d6baedfa6c251..424a036634aa144bcd279ae831bf159a143bbacf 100644 (file)
@@ -1,9 +1,38 @@
+import iotcloud.*;
+
 class WemoController {
     public static void main(String[] args) throws Exception {
+
+        Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 351, -1);
+        t1.rebuild();
+
+
+        String a = "fan";
+        IoTString ia = new IoTString(a);
+        t1.createNewKey(ia, 351);
+
+
+
         IoTDeviceAddress devAddr = new IoTDeviceAddress("192.168.1.5", 49153, 49153, false, false);
         Wemo wemo = new Wemo(devAddr);
 
-        wemo.turnOn();
-    }
 
+
+        String valueA = "on";
+        IoTString iValueA = new IoTString(valueA);
+
+        System.out.println("Starting System");
+
+        while (true) {
+            t1.update();
+            Thread.sleep(1000);
+
+            IoTString testValA1 = t1.getCommitted(ia);
+            if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
+                wemo.turnOn();
+            } else {
+                wemo.turnOff();
+            }
+        }
+    }
 }
\ No newline at end of file