+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