projects
/
iotcloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e79302b
)
Benchmark added
author
Ali Younis
<ayounis@uci.edu>
Sun, 7 May 2017 21:41:11 +0000
(14:41 -0700)
committer
Ali Younis
<ayounis@uci.edu>
Sun, 7 May 2017 21:41:11 +0000
(14:41 -0700)
version2/src/java/light_fan_benchmark/BulbController.java
patch
|
blob
|
history
version2/src/java/light_fan_benchmark/BulbSwitch.java
patch
|
blob
|
history
version2/src/java/light_fan_benchmark/WemoController.java
patch
|
blob
|
history
diff --git
a/version2/src/java/light_fan_benchmark/BulbController.java
b/version2/src/java/light_fan_benchmark/BulbController.java
index c1049d8dab25c5249d82b9aaaf0962f63077a31f..1b4b815f9386f297dd4fd30ae0f9c24e981f3b17 100644
(file)
--- a/
version2/src/java/light_fan_benchmark/BulbController.java
+++ b/
version2/src/java/light_fan_benchmark/BulbController.java
@@
-14,6
+14,7
@@
class BulbController {
+
byte[] bulbMacAdd = new byte[8];
bulbMacAdd[0] = (byte)0xD0;
bulbMacAdd[1] = (byte)0x73;
byte[] bulbMacAdd = new byte[8];
bulbMacAdd[0] = (byte)0xD0;
bulbMacAdd[1] = (byte)0x73;
@@
-25,7
+26,7
@@
class BulbController {
bulbMacAdd[7] = (byte)0x00;
bulbMacAdd[7] = (byte)0x00;
- IoTDeviceAddress devAddr = new IoTDeviceAddress("192.168.1.
5
", 56700, 56700, false, false);
+ IoTDeviceAddress devAddr = new IoTDeviceAddress("192.168.1.
17
", 56700, 56700, false, false);
IoTUDP udp = new IoTUDP(devAddr);
LightBulb bulb = new LifxLightBulb(udp, bulbMacAdd);
IoTUDP udp = new IoTUDP(devAddr);
LightBulb bulb = new LifxLightBulb(udp, bulbMacAdd);
diff --git
a/version2/src/java/light_fan_benchmark/BulbSwitch.java
b/version2/src/java/light_fan_benchmark/BulbSwitch.java
index 208482fc9eb7fc4bad17403c3cf72750a8f7a918..172446d9c7f2c951a0972140aec5a51948891081 100644
(file)
--- a/
version2/src/java/light_fan_benchmark/BulbSwitch.java
+++ b/
version2/src/java/light_fan_benchmark/BulbSwitch.java
@@
-10,30
+10,32
@@
class BulbSwitch {
System.out.println(Integer.parseInt(args[0]));
Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", Integer.parseInt(args[0]), -1);
System.out.println(Integer.parseInt(args[0]));
Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", Integer.parseInt(args[0]), -1);
- t1.
update();
+ t1.
rebuild(); // update
String a = "bulb";
String a = "bulb";
+ String b = "fan";
+ IoTString ib = new IoTString(b);
IoTString ia = new IoTString(a);
IoTString ia = new IoTString(a);
+
t1.createNewKey(ia, 321);
String valueA = "on";
t1.createNewKey(ia, 321);
String valueA = "on";
+ String valueB = "off";
IoTString iValueA = new IoTString(valueA);
IoTString iValueA = new IoTString(valueA);
+ IoTString iValueB = new IoTString(valueB);
- String valueB = "off";
- IoTString iValueB = new IoTString(valueB);
System.out.println("Starting System");
System.out.println("Starting System");
-
Scanner keyboard = new Scanner(System.in);
Scanner keyboard = new Scanner(System.in);
-
while (true) {
while (true) {
- System.out.println("Enter 0 for off, 1 for on");
+ System.out.println("Enter 0 for off, 1 for on for bulb");
+ System.out.println("Enter 3 for off, 2 for on for fan");
int myint = keyboard.nextInt();
if (myint == 0) {
int myint = keyboard.nextInt();
if (myint == 0) {
@@
-42,12
+44,23
@@
class BulbSwitch {
t1.addKV(ia, iValueB);
t1.commitTransaction();
t1.addKV(ia, iValueB);
t1.commitTransaction();
- } else {
+ } else
if (myint == 1)
{
t1.update();
t1.startTransaction();
t1.addKV(ia, iValueA);
t1.commitTransaction();
t1.update();
t1.startTransaction();
t1.addKV(ia, iValueA);
t1.commitTransaction();
-
+ }
+ else if (myint == 2) {
+ t1.update();
+ t1.startTransaction();
+ t1.addKV(ib, iValueA);
+ t1.commitTransaction();
+ }
+ else if (myint == 3) {
+ t1.update();
+ t1.startTransaction();
+ t1.addKV(ib, iValueB);
+ t1.commitTransaction();
}
}
}
}
diff --git
a/version2/src/java/light_fan_benchmark/WemoController.java
b/version2/src/java/light_fan_benchmark/WemoController.java
index 16db7ae49c0d86ccd86ea612eb1d6baedfa6c251..424a036634aa144bcd279ae831bf159a143bbacf 100644
(file)
--- a/
version2/src/java/light_fan_benchmark/WemoController.java
+++ b/
version2/src/java/light_fan_benchmark/WemoController.java
@@
-1,9
+1,38
@@
+import iotcloud.*;
+
class WemoController {
public static void main(String[] args) throws Exception {
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);
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
}
\ No newline at end of file