X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=version2%2Fsrc%2Fjava%2Flight_fan_embed_benchmark%2FLightsController.java;h=46df781187376e224e522ab6ef8bdce863c6cb3a;hb=60b838f9715c26fc3510d5ed6f62c9ef12d2c839;hp=a8b7be2398f9032c8399ee10f8f4131e357e8eba;hpb=f915d1e5640ed43f356169ebae10319e98437188;p=iotcloud.git diff --git a/version2/src/java/light_fan_embed_benchmark/LightsController.java b/version2/src/java/light_fan_embed_benchmark/LightsController.java index a8b7be2..46df781 100644 --- a/version2/src/java/light_fan_embed_benchmark/LightsController.java +++ b/version2/src/java/light_fan_embed_benchmark/LightsController.java @@ -5,8 +5,6 @@ class LightsController { public static void main(String[] args) throws Exception { - Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1); - t1.rebuild(); // Bulb 1 byte[] bulbMacAdd1 = new byte[8]; @@ -19,7 +17,7 @@ class LightsController { bulbMacAdd1[6] = (byte)0x00; bulbMacAdd1[7] = (byte)0x00; - IoTDeviceAddress devAddr1 = new IoTDeviceAddress("192.168.1.4", 56700, 56700, false, false); + IoTDeviceAddress devAddr1 = new IoTDeviceAddress("192.168.2.216", 56700, 56700, false, false); IoTUDP udp1 = new IoTUDP(devAddr1); LightBulb bulb1 = new LifxLightBulb(udp1, bulbMacAdd1); @@ -35,7 +33,7 @@ class LightsController { bulbMacAdd2[6] = (byte)0x00; bulbMacAdd2[7] = (byte)0x00; - IoTDeviceAddress devAddr2 = new IoTDeviceAddress("192.168.1.32", 56701, 56700, false, false); + IoTDeviceAddress devAddr2 = new IoTDeviceAddress("192.168.2.126", 56701, 56700, false, false); IoTUDP udp2 = new IoTUDP(devAddr2); LightBulb bulb2 = new LifxLightBulb(udp2, bulbMacAdd2); @@ -51,7 +49,7 @@ class LightsController { bulbMacAdd3[6] = (byte)0x00; bulbMacAdd3[7] = (byte)0x00; - IoTDeviceAddress devAddr3 = new IoTDeviceAddress("192.168.1.33", 56702, 56700, false, false); + IoTDeviceAddress devAddr3 = new IoTDeviceAddress("192.168.2.232", 56702, 56700, false, false); IoTUDP udp3 = new IoTUDP(devAddr3); LightBulb bulb3 = new LifxLightBulb(udp3, bulbMacAdd3); @@ -89,26 +87,64 @@ class LightsController { System.out.println("Starting System"); int counter = 0; + + Table t1 = null; + try { + t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1); + t1.rebuild(); + } catch (Error e) { + + e.printStackTrace(); + for (int i = 0; i < 3; i++) { + bulbs.get(i).setColor(0, 100, 100); + } + + + + while (true) { + for (int i = 0; i < 3; i++) { + bulbs.get(i).turnOff(); + } + Thread.sleep(1000); + + for (int i = 0; i < 3; i++) { + bulbs.get(i).turnOn(); + } + Thread.sleep(1000); + } + } + + + + + // Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 400, -1); + // t2.rebuild(); + + while (true) { try { - counter++; - if (counter == 10) { - counter = 0; + System.out.println("Loop"); + + String pingTimer = Long.toString(System.currentTimeMillis()); + IoTString ipingTimer = new IoTString(pingTimer); + + // t1.update(); + t1.startTransaction(); + t1.addKV(ipingTimerKey, ipingTimer); + t1.commitTransaction(); + + // // t2.update(); + // t2.startTransaction(); + // t2.addKV(ipingTimerKey, ipingTimer); + // t2.commitTransaction(); + + - String pingTimer = Long.toString(System.currentTimeMillis()); - IoTString ipingTimer = new IoTString(pingTimer); - t1.update(); - t1.startTransaction(); - t1.addKV(ipingTimerKey, ipingTimer); - t1.commitTransaction(); - } - t1.update(); - Thread.sleep(1000); for (int i = 0; i < 3; i++) { IoTString testValA1 = t1.getCommitted(keys.get(i)); @@ -119,8 +155,11 @@ class LightsController { } } + Thread.sleep(1000); + } catch (Error e) { + e.printStackTrace(); for (int i = 0; i < 3; i++) { bulbs.get(i).setColor(0, 100, 100); }