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];
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);
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);
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);
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));
}
}
+ Thread.sleep(1000);
+
} catch (Error e) {
+ e.printStackTrace();
for (int i = 0; i < 3; i++) {
bulbs.get(i).setColor(0, 100, 100);
}