1 package iotcode.AudioRoom;
3 import java.io.IOException;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import iotrmi.Java.IoTRMICall;
8 import iotrmi.Java.IoTRMIObject;
10 import iotcode.interfaces.Room;
12 public class Room_Skeleton implements Room {
15 private IoTRMIObject rmiObj;
17 private String callbackAddress;
18 private final static int object0Id = 0; //RoomSmart
19 private static Integer[] object0Permission = { 0 };
20 private static List<Integer> set0Allowed;
23 public Room_Skeleton(Room _mainObj, String _callbackAddress, int _port) throws Exception {
25 callbackAddress = _callbackAddress;
26 rmiObj = new IoTRMIObject(_port);
27 set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
28 ___waitRequestInvokeMethod();
31 public int getRoomID() {
32 return mainObj.getRoomID();
35 public void ___getRoomID() throws IOException {
36 Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
38 Object retObj = getRoomID();
39 rmiObj.sendReturnObj(retObj);
42 private void ___waitRequestInvokeMethod() throws IOException {
44 rmiObj.getMethodBytes();
45 int _objectId = rmiObj.getObjectId();
46 int methodId = rmiObj.getMethodId();
47 if (_objectId == object0Id) {
48 if (!set0Allowed.contains(methodId)) {
49 throw new Error("Object with object Id: " + _objectId + " is not allowed to access method: " + methodId);
53 throw new Error("Object Id: " + _objectId + " not recognized!");
56 case 0: ___getRoomID(); break;
58 throw new Error("Method Id " + methodId + " not recognized!");