d6d34914d36229195ca2ec4ee9587e93ca405fc5
[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         if (deviceId == t1.getId()) {
14             return t1.localCommInput(data);
15         } else if (deviceId == t2.getId()) {
16             return t2.localCommInput(data);
17         }
18         else {
19             throw new Error("Cannot send to " + deviceId + " using this local comm");
20         }
21     }
22 }