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) {
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");
--- /dev/null
+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();
+
+ }
+ }
+}