From: rtrimana <rtrimana@uci.edu>
Date: Wed, 16 May 2018 18:49:43 +0000 (-0700)
Subject: Checking in new files for phone app and testing local control/communication.
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8228837b8464715f2af9edda141c8cf5bef9f590;p=iotcloud.git

Checking in new files for phone app and testing local control/communication.
---

diff --git a/version2/src/Control-2bulbs.zip b/version2/src/Control-2bulbs.zip
new file mode 100644
index 0000000..1867d33
Binary files /dev/null and b/version2/src/Control-2bulbs.zip differ
diff --git a/version2/src/java/light_fan_embed_benchmark_2bulbs/LightsController.java b/version2/src/java/light_fan_embed_benchmark_2bulbs/LightsController.java
index 0f7e590..4feb930 100644
--- a/version2/src/java/light_fan_embed_benchmark_2bulbs/LightsController.java
+++ b/version2/src/java/light_fan_embed_benchmark_2bulbs/LightsController.java
@@ -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
index 0000000..0f772f1
--- /dev/null
+++ b/version2/src/java/light_fan_embed_benchmark_2bulbs/LocalControl.java
@@ -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();
+
+        }
+    }
+}