1 package HomeSecurityController;
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.*;
12 public class AlarmSmart_Stub implements AlarmSmart {
14 private IoTRMICall rmiCall;
15 private String callbackAddress;
18 private final static int objectId = 0;
21 public AlarmSmart_Stub(int _port, String _skeletonAddress, String _callbackAddress, int _rev, int[] _ports) throws Exception {
22 callbackAddress = _callbackAddress;
24 rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev);
27 public boolean doesHaveZoneTimers() {
29 Class<?> retType = boolean.class;
30 Class<?>[] paramCls = new Class<?>[] { };
31 Object[] paramObj = new Object[] { };
32 Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
33 return (boolean)retObj;
36 public List<ZoneState> getZoneStates() {
38 Class<?> retType = int.class;
39 Class<?>[] paramCls = new Class<?>[] { };
40 Object[] paramObj = new Object[] { };
41 Object retLenObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
42 int retLen = (int) retLenObj;
43 Class<?>[] retCls = new Class<?>[3*retLen];
44 Class<?>[] retClsVal = new Class<?>[3*retLen];
46 for(int i = 0; i < retLen; i++) {
47 retCls[retPos] = int.class;
48 retClsVal[retPos++] = null;
49 retCls[retPos] = boolean.class;
50 retClsVal[retPos++] = null;
51 retCls[retPos] = int.class;
52 retClsVal[retPos++] = null;
54 Object[] retObj = rmiCall.getStructObjects(retCls, retClsVal);
55 List<ZoneState> structRet = new ArrayList<ZoneState>();
57 for(int i = 0; i < retLen; i++) {
58 ZoneState structRetMem = new ZoneState();
59 structRetMem.zoneNumber = (int) retObj[retObjPos++];
60 structRetMem.onOffState = (boolean) retObj[retObjPos++];
61 structRetMem.duration = (int) retObj[retObjPos++];
62 structRet.add(structRetMem);
69 Class<?> retType = void.class;
70 Class<?>[] paramCls = new Class<?>[] { };
71 Object[] paramObj = new Object[] { };
72 rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
75 public void setZone(int _zone, boolean _onOff, int _onDurationSeconds) {
77 Class<?> retType = void.class;
78 Class<?>[] paramCls = new Class<?>[] { int.class, boolean.class, int.class };
79 Object[] paramObj = new Object[] { _zone, _onOff, _onDurationSeconds };
80 rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
83 public int getNumberOfZones() {
85 Class<?> retType = int.class;
86 Class<?>[] paramCls = new Class<?>[] { };
87 Object[] paramObj = new Object[] { };
88 Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);