Updates
[iotcloud.git] / version2 / src / java / iotcloud / LocalComm.java
1 package iotcloud;
2
3 class LocalComm {
4     private Table t1;
5     private Table t2;
6
7     public LocalComm(Table _t1, Table _t2) {
8         t1 = _t1;
9         t2 = _t2;
10     }
11
12     public byte[] sendDataToLocalDevice(Long deviceId, byte[] data) {
13         System.out.println("Passing Locally");
14
15         if (deviceId == t1.getId()) {
16             return t1.localCommInput(data);
17         } else if (deviceId == t2.getId()) {
18             return t2.localCommInput(data);
19         } else {
20             throw new Error("Cannot send to " + deviceId + " using this local comm");
21         }
22     }
23 }