Phone app (based on Ali's Control for iotcloud benchmark) to control alarm in the...
[iot2.git] / benchmarks / other / PhoneInterface / Control / app / src / main / java / iotcloud / LocalComm.java
diff --git a/benchmarks/other/PhoneInterface/Control/app/src/main/java/iotcloud/LocalComm.java b/benchmarks/other/PhoneInterface/Control/app/src/main/java/iotcloud/LocalComm.java
new file mode 100644 (file)
index 0000000..c2eb11b
--- /dev/null
@@ -0,0 +1,25 @@
+package iotcloud;
+
+class LocalComm {
+    private Table t1;
+    private Table t2;
+
+    public LocalComm(Table _t1, Table _t2) {
+        t1 = _t1;
+        t2 = _t2;
+    }
+
+    public byte[] sendDataToLocalDevice(Long deviceId, byte[] data) throws InterruptedException{
+        System.out.println("Passing Locally");
+
+        if (deviceId == t1.getMachineId()) {
+            // return t1.localCommInput(data);
+        } else if (deviceId == t2.getMachineId()) {
+            // return t2.localCommInput(data);
+        } else {
+            throw new Error("Cannot send to " + deviceId + " using this local comm");
+        }
+
+        return new byte[0];
+    }
+}
\ No newline at end of file