Checking in new files for phone app and testing local control/communication.
authorrtrimana <rtrimana@uci.edu>
Wed, 16 May 2018 18:49:43 +0000 (11:49 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 16 May 2018 18:49:43 +0000 (11:49 -0700)
version2/src/Control-2bulbs.zip [new file with mode: 0644]
version2/src/java/light_fan_embed_benchmark_2bulbs/LightsController.java
version2/src/java/light_fan_embed_benchmark_2bulbs/LocalControl.java [new file with mode: 0644]

diff --git a/version2/src/Control-2bulbs.zip b/version2/src/Control-2bulbs.zip
new file mode 100644 (file)
index 0000000..1867d33
Binary files /dev/null and b/version2/src/Control-2bulbs.zip differ
index 0f7e59010a647fb740b36b5c80ca80cbef066fa9..4feb93075c8107c17fcb1cd465dcedade822136f 100644 (file)
@@ -64,7 +64,8 @@ class LightsController {
         Table t1 = null;
         try {
             t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 400, 6000);
-            t1.addLocalCommunication(399, "192.168.1.192", 7000);
+            // This is the controlling smartphone!
+            t1.addLocalCommunication(399, "192.168.1.108", 7000);
 
             t1.rebuild();
         } catch (Error e) {
@@ -98,7 +99,7 @@ class LightsController {
                        t1.update();
                        IoTString testValA1 = t1.getCommitted(ia);
                     //IoTString testValA1 = t1.getCommitted(keys.get(i));
-                    bulbs.get(i).setColor(200, 200, 200);
+                    //bulbs.get(i).setColor(200, 200, 200);
                     if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
                         bulbs.get(i).turnOn();
                                System.out.println("Turning on bulbs");
diff --git a/version2/src/java/light_fan_embed_benchmark_2bulbs/LocalControl.java b/version2/src/java/light_fan_embed_benchmark_2bulbs/LocalControl.java
new file mode 100644 (file)
index 0000000..0f772f1
--- /dev/null
@@ -0,0 +1,53 @@
+import iotcloud.*;
+import java.util.*;
+
+class LocalControl {
+
+    public static void main(String[] args) throws Exception {
+
+               String a = "bulb";
+               IoTString ia = new IoTString(a);
+
+        String valueA = "on";
+        IoTString iValueA = new IoTString(valueA);
+
+        String valueB = "off";
+        IoTString iValueB = new IoTString(valueB);
+
+        System.out.println("Starting System");
+        int counter = 0;
+
+
+        Table t1 = null;
+        try {
+            t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 399, 7000);
+            t1.addLocalCommunication(400, "192.168.1.192", 6000);
+            System.out.println("Rebuilding!");
+            t1.rebuild();
+            while (true) {
+                       t1.update();
+                               //IoTString testValA1 = t1.getCommitted(ia);
+                               t1.startTransaction();
+                               t1.addKV(ia, iValueA);
+                               t1.commitTransaction();
+                               t1.update();
+                Thread.sleep(1000);
+                System.out.println("Turning on");
+
+                       t1.update();
+                               //IoTString testValA1 = t1.getCommitted(ia);
+                               t1.startTransaction();
+                               t1.addKV(ia, iValueB);
+                               t1.commitTransaction();
+                               t1.update();
+                Thread.sleep(1000);
+                System.out.println("Turning off");
+            } 
+       } catch (Error e) {
+
+            e.printStackTrace();
+
+        }
+    }
+}