import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
-import iotrmi.Java.IoTRMICall;
-import iotrmi.Java.IoTRMIObject;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import iotrmi.Java.IoTRMIComm;
+import iotrmi.Java.IoTRMICommClient;
+import iotrmi.Java.IoTRMICommServer;
+import iotrmi.Java.IoTRMIUtil;
import iotcode.interfaces.LightBulbSmart;
public class LightBulbSmart_Stub implements LightBulbSmart {
- private IoTRMICall rmiCall;
- private String callbackAddress;
- private int[] ports;
- private final static int objectId = 0;
+ private int objectId = 1;
+ private IoTRMIComm rmiComm;
+ // Synchronization variables
+ private AtomicBoolean retValueReceived10 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived3 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived11 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived8 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived12 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived7 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived13 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived9 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived6 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived16 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived17 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived14 = new AtomicBoolean(false);
+ private AtomicBoolean retValueReceived15 = new AtomicBoolean(false);
- public LightBulbSmart_Stub(int _port, String _skeletonAddress, String _callbackAddress, int _rev, int[] _ports) throws Exception {
- callbackAddress = _callbackAddress;
- ports = _ports;
- rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev);
+ public LightBulbSmart_Stub(int _localPortSend, int _localPortRecv, int _portSend, int _portRecv, String _skeletonAddress, int _rev) throws Exception {
+ if (_localPortSend != 0 && _localPortRecv != 0) {
+ rmiComm = new IoTRMICommClient(_localPortSend, _localPortRecv, _portSend, _portRecv, _skeletonAddress, _rev);
+ } else
+ {
+ rmiComm = new IoTRMICommClient(_portSend, _portRecv, _skeletonAddress, _rev);
+ }
+ rmiComm.registerStub(objectId, 10, retValueReceived10);
+ rmiComm.registerStub(objectId, 3, retValueReceived3);
+ rmiComm.registerStub(objectId, 11, retValueReceived11);
+ rmiComm.registerStub(objectId, 8, retValueReceived8);
+ rmiComm.registerStub(objectId, 12, retValueReceived12);
+ rmiComm.registerStub(objectId, 7, retValueReceived7);
+ rmiComm.registerStub(objectId, 13, retValueReceived13);
+ rmiComm.registerStub(objectId, 9, retValueReceived9);
+ rmiComm.registerStub(objectId, 6, retValueReceived6);
+ rmiComm.registerStub(objectId, 16, retValueReceived16);
+ rmiComm.registerStub(objectId, 17, retValueReceived17);
+ rmiComm.registerStub(objectId, 14, retValueReceived14);
+ rmiComm.registerStub(objectId, 15, retValueReceived15);
+ IoTRMIUtil.mapStub.put(objectId, this);
+ }
+
+ public LightBulbSmart_Stub(IoTRMIComm _rmiComm, int _objectId) throws Exception {
+ rmiComm = _rmiComm;
+ objectId = _objectId;
+ rmiComm.registerStub(objectId, 10, retValueReceived10);
+ rmiComm.registerStub(objectId, 3, retValueReceived3);
+ rmiComm.registerStub(objectId, 11, retValueReceived11);
+ rmiComm.registerStub(objectId, 8, retValueReceived8);
+ rmiComm.registerStub(objectId, 12, retValueReceived12);
+ rmiComm.registerStub(objectId, 7, retValueReceived7);
+ rmiComm.registerStub(objectId, 13, retValueReceived13);
+ rmiComm.registerStub(objectId, 9, retValueReceived9);
+ rmiComm.registerStub(objectId, 6, retValueReceived6);
+ rmiComm.registerStub(objectId, 16, retValueReceived16);
+ rmiComm.registerStub(objectId, 17, retValueReceived17);
+ rmiComm.registerStub(objectId, 14, retValueReceived14);
+ rmiComm.registerStub(objectId, 15, retValueReceived15);
}
public void turnOn() {
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
}
public double getBrightnessRangeLowerBound() {
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived10.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived10.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
}
public boolean getState() {
Class<?> retType = boolean.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived3.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived3.set(false);
+ rmiComm.setGetReturnBytes();
+
return (boolean)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived11.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived11.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived8.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived8.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived12.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived12.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived7.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived7.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived13.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived13.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived9.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived9.set(false);
+ rmiComm.setGetReturnBytes();
+
return (int)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived6.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived6.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived16.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived16.set(false);
+ rmiComm.setGetReturnBytes();
+
return (int)retObj;
}
Class<?> retType = int.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived17.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived17.set(false);
+ rmiComm.setGetReturnBytes();
+
return (int)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { double.class, double.class, double.class };
Object[] paramObj = new Object[] { _hue, _saturation, _brightness };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
}
public void init() {
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
}
public double getSaturationRangeLowerBound() {
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived14.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived14.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = double.class;
Class<?>[] paramCls = new Class<?>[] { };
Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
+ // Waiting for return value
+ while (!retValueReceived15.get());
+ Object retObj = rmiComm.getReturnValue(retType, null);
+ retValueReceived15.set(false);
+ rmiComm.setGetReturnBytes();
+
return (double)retObj;
}
Class<?> retType = void.class;
Class<?>[] paramCls = new Class<?>[] { int.class };
Object[] paramObj = new Object[] { _temperature };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);
}
}