+++ /dev/null
-package SmartLightsController;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import iotrmi.Java.IoTRMICall;
-import iotrmi.Java.IoTRMIObject;
-
-import iotcode.interfaces.*;
-
-public class CameraSmartCallback_CallbackStub implements CameraSmartCallback {
-
- private IoTRMICall rmiCall;
- private String callbackAddress;
- private int[] ports;
-
- private int objectId = 0;
- // Callback properties
- private IoTRMIObject rmiObj;
- List<Camera> listCallbackObj;
- private static int objIdCnt = 0;
- private final static int object0Id = 0; //CameraSmart
- private static Integer[] object0Permission = { 8, 7, 9, 6, 2, 1, 4, 3, 0, 10, 5 };
- private static List<Integer> set0Allowed;
-
-
- public CameraSmartCallback_CallbackStub(IoTRMICall _rmiCall, String _callbackAddress, int _objectId, int[] _ports) throws Exception {
- callbackAddress = _callbackAddress;
- objectId = _objectId;
- rmiCall = _rmiCall;
- ports = _ports;
- set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
- listCallbackObj = new ArrayList<Camera>();
- ___initCallBack();
- }
-
- public void newCameraFrameAvailable(Camera _camera) {
- try {
- Camera_CallbackSkeleton skel0 = new Camera_CallbackSkeleton(_camera, callbackAddress, objIdCnt++);
- listCallbackObj.add(skel0);
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Exception when generating skeleton objects!");
- }
-
- int methodId = 0;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int.class };
- Object[] paramObj = new Object[] { new Integer(1) };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public void ___initCallBack() {
- Thread thread = new Thread() {
- public void run() {
- try {
- rmiObj = new IoTRMIObject(ports[1]);
- while (true) {
- byte[] method = rmiObj.getMethodBytes();
- int methodId = IoTRMIObject.getMethodId(method);
- if (!set0Allowed.contains(methodId)) {
- throw new Error("Callback object for Camera is not allowed to access method: " + methodId);
- }
- int objId = IoTRMIObject.getObjectId(method);
- Camera_CallbackSkeleton skel = (Camera_CallbackSkeleton) listCallbackObj.get(objId);
- if (skel != null) {
- skel.invokeMethod(rmiObj);
- } else {
- throw new Error("Camera: Object with Id " + objId + " not found!");
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Error instantiating class Camera_CallbackSkeleton!");
- }
- }
- };
- thread.start();
-
- int methodId = -9999;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int[].class, String.class, int.class };
- Object[] paramObj = new Object[] { ports, callbackAddress, 0 };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
-}
+++ /dev/null
-package SmartLightsController;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import iotrmi.Java.IoTRMICall;
-import iotrmi.Java.IoTRMIObject;
-
-import iotcode.interfaces.*;
-
-public class CameraSmartCallback_Stub implements CameraSmartCallback {
-
- private IoTRMICall rmiCall;
- private String callbackAddress;
- private int[] ports;
-
- private final static int objectId = 0;
- // Callback properties
- private IoTRMIObject rmiObj;
- List<Camera> listCallbackObj;
- private static int objIdCnt = 0;
- private final static int object0Id = 0; //CameraSmart
- private static Integer[] object0Permission = { 8, 7, 9, 6, 2, 1, 4, 3, 0, 10, 5 };
- private static List<Integer> set0Allowed;
-
-
- public CameraSmartCallback_Stub(int _port, String _skeletonAddress, String _callbackAddress, int _rev, int[] _ports) throws Exception {
- callbackAddress = _callbackAddress;
- ports = _ports;
- rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev);
- set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
- listCallbackObj = new ArrayList<Camera>();
- ___initCallBack();
- }
-
- public void newCameraFrameAvailable(Camera _camera) {
- try {
- Camera_CallbackSkeleton skel0 = new Camera_CallbackSkeleton(_camera, callbackAddress, objIdCnt++);
- listCallbackObj.add(skel0);
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Exception when generating skeleton objects!");
- }
-
- int methodId = 0;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int.class };
- Object[] paramObj = new Object[] { new Integer(1) };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public void ___initCallBack() {
- Thread thread = new Thread() {
- public void run() {
- try {
- rmiObj = new IoTRMIObject(ports[0]);
- while (true) {
- byte[] method = rmiObj.getMethodBytes();
- int methodId = IoTRMIObject.getMethodId(method);
- if (!set0Allowed.contains(methodId)) {
- throw new Error("Callback object for Camera is not allowed to access method: " + methodId);
- }
- int objId = IoTRMIObject.getObjectId(method);
- Camera_CallbackSkeleton skel = (Camera_CallbackSkeleton) listCallbackObj.get(objId);
- if (skel != null) {
- skel.invokeMethod(rmiObj);
- } else {
- throw new Error("Camera: Object with Id " + objId + " not found!");
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Error instantiating class Camera_CallbackSkeleton!");
- }
- }
- };
- thread.start();
-
- int methodId = -9999;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int[].class, String.class, int.class };
- Object[] paramObj = new Object[] { ports, callbackAddress, 0 };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
-}
+++ /dev/null
-package SmartLightsController;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import iotrmi.Java.IoTRMICall;
-import iotrmi.Java.IoTRMIObject;
-
-import iotcode.interfaces.*;
-
-public class CameraSmart_CallbackStub implements CameraSmart {
-
- private IoTRMICall rmiCall;
- private String callbackAddress;
- private int[] ports;
-
- private int objectId = 0;
- // Callback properties
- private IoTRMIObject rmiObj;
- List<CameraCallback> listCallbackObj;
- private static int objIdCnt = 0;
- private final static int object0Id = 0; //CameraSmartCallback
- private static Integer[] object0Permission = { 0 };
- private static List<Integer> set0Allowed;
-
-
- public CameraSmart_CallbackStub(IoTRMICall _rmiCall, String _callbackAddress, int _objectId, int[] _ports) throws Exception {
- callbackAddress = _callbackAddress;
- objectId = _objectId;
- rmiCall = _rmiCall;
- ports = _ports;
- set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
- listCallbackObj = new ArrayList<CameraCallback>();
- ___initCallBack();
- }
-
- public int getMaxFPS() {
- int methodId = 8;
- Class<?> retType = int.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (int)retObj;
- }
-
- public boolean setFPS(int _fps) {
- int methodId = 7;
- Class<?> retType = boolean.class;
- Class<?>[] paramCls = new Class<?>[] { int.class };
- Object[] paramObj = new Object[] { _fps };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (boolean)retObj;
- }
-
- public int getMinFPS() {
- int methodId = 9;
- Class<?> retType = int.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (int)retObj;
- }
-
- public boolean setResolution(Resolution _res) {
- int methodId = 6;
- Class<?> retType = boolean.class;
- int paramEnum0[] = new int[1];
- paramEnum0[0] = _res.ordinal();
- Class<?>[] paramCls = new Class<?>[] { int[].class };
- Object[] paramObj = new Object[] { paramEnum0 };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (boolean)retObj;
- }
-
- public void stop() {
- int methodId = 2;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public void start() {
- int methodId = 1;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public long getTimestamp() {
- int methodId = 4;
- Class<?> retType = long.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (long)retObj;
- }
-
- public byte[] getLatestFrame() {
- int methodId = 3;
- Class<?> retType = byte[].class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- return (byte[])retObj;
- }
-
- public void init() {
- int methodId = 0;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public void registerCallback(CameraCallback _callbackTo) {
- try {
- CameraCallback_CallbackSkeleton skel0 = new CameraCallback_CallbackSkeleton(_callbackTo, callbackAddress, objIdCnt++);
- listCallbackObj.add(skel0);
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Exception when generating skeleton objects!");
- }
-
- int methodId = 10;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int.class };
- Object[] paramObj = new Object[] { new Integer(1) };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public void ___initCallBack() {
- Thread thread = new Thread() {
- public void run() {
- try {
- rmiObj = new IoTRMIObject(ports[1]);
- while (true) {
- byte[] method = rmiObj.getMethodBytes();
- int methodId = IoTRMIObject.getMethodId(method);
- if (!set0Allowed.contains(methodId)) {
- throw new Error("Callback object for CameraCallback is not allowed to access method: " + methodId);
- }
- int objId = IoTRMIObject.getObjectId(method);
- CameraCallback_CallbackSkeleton skel = (CameraCallback_CallbackSkeleton) listCallbackObj.get(objId);
- if (skel != null) {
- skel.invokeMethod(rmiObj);
- } else {
- throw new Error("CameraCallback: Object with Id " + objId + " not found!");
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new Error("Error instantiating class CameraCallback_CallbackSkeleton!");
- }
- }
- };
- thread.start();
-
- int methodId = -9998;
- Class<?> retType = void.class;
- Class<?>[] paramCls = new Class<?>[] { int[].class, String.class, int.class };
- Object[] paramObj = new Object[] { ports, callbackAddress, 0 };
- rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- }
-
- public List<Resolution> getSupportedResolutions() {
- int methodId = 5;
- Class<?> retType = int[].class;
- Class<?>[] paramCls = new Class<?>[] { };
- Object[] paramObj = new Object[] { };
- Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
- int[] retEnum = (int[]) retObj;
- Resolution[] enumVals = Resolution.values();
- int retLen = retEnum.length;
- List<Resolution> enumRetVal = new ArrayList<Resolution>();
- for (int i = 0; i < retLen; i++) {
- enumRetVal.add(enumVals[retEnum[i]]);
- }
- return enumRetVal;
- }
-
-}
+++ /dev/null
-package SmartLightsController;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-import iotrmi.Java.IoTRMICall;
-import iotrmi.Java.IoTRMIObject;
-
-import iotcode.interfaces.*;
-
-public class Camera_CallbackSkeleton implements Camera {
-
- private Camera mainObj;
- private int objectId = 0;
- private String callbackAddress;
- private static int objIdCnt = 0;
- private IoTRMICall rmiCall;
- private int[] ports;
-
-
-
- public Camera_CallbackSkeleton(Camera _mainObj, String _callbackAddress, int _objectId) throws Exception {
- callbackAddress = _callbackAddress;
- mainObj = _mainObj;
- objectId = _objectId;
- }
-
- public void init() {
- mainObj.init();
- }
-
- public void start() {
- mainObj.start();
- }
-
- public void stop() {
- mainObj.stop();
- }
-
- public byte[] getLatestFrame() {
- return mainObj.getLatestFrame();
- }
-
- public long getTimestamp() {
- return mainObj.getTimestamp();
- }
-
- public List<Resolution> getSupportedResolutions() {
- return mainObj.getSupportedResolutions();
- }
-
- public boolean setResolution(Resolution _res) {
- return mainObj.setResolution(_res);
- }
-
- public boolean setFPS(int _fps) {
- return mainObj.setFPS(_fps);
- }
-
- public int getMaxFPS() {
- return mainObj.getMaxFPS();
- }
-
- public int getMinFPS() {
- return mainObj.getMinFPS();
- }
-
- public void registerCallback(CameraSmartCallback _callbackTo) {
- mainObj.registerCallback(_callbackTo);
- }
-
- public void ___regCB(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int[].class, String.class, int.class },new Class<?>[] { null, null, null });
- ports = (int[]) paramObj[0];
- rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], ports[1]);
- }
-
- public void ___init(IoTRMIObject rmiObj) {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- init();
- }
-
- public void ___start(IoTRMIObject rmiObj) {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- start();
- }
-
- public void ___stop(IoTRMIObject rmiObj) {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- stop();
- }
-
- public void ___getLatestFrame(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- Object retObj = getLatestFrame();
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___getTimestamp(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- Object retObj = getTimestamp();
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___getSupportedResolutions(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- List<Resolution> retEnum = getSupportedResolutions();
- int retLen = retEnum.size();
- int[] retEnumVal = new int[retLen];
- for (int i = 0; i < retLen; i++) {
- retEnumVal[i] = retEnum.get(i).ordinal();
- }
- Object retObj = retEnumVal;
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___setResolution(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int[].class },
- new Class<?>[] { null });
- int paramInt0[] = (int[]) paramObj[0];
- Resolution[] enumVals = Resolution.values();
- Resolution paramEnum0 = enumVals[paramInt0[0]];
- Object retObj = setResolution(paramEnum0);
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___setFPS(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null });
- Object retObj = setFPS((int) paramObj[0]);
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___getMaxFPS(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- Object retObj = getMaxFPS();
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___getMinFPS(IoTRMIObject rmiObj) throws IOException {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
- new Class<?>[] { });
- Object retObj = getMinFPS();
- rmiObj.sendReturnObj(retObj);
- }
-
- public void ___registerCallback(IoTRMIObject rmiObj) {
- Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
- new Class<?>[] { null });
- try {
- CameraSmartCallback stub0 = new CameraSmartCallback_CallbackStub(rmiCall, callbackAddress, objIdCnt, ports);
- objIdCnt++;
- registerCallback(stub0);
- } catch(Exception ex) {
- ex.printStackTrace();
- throw new Error("Exception from callback object instantiation!");
- }
- }
-
- public void invokeMethod(IoTRMIObject rmiObj) throws IOException {
- int methodId = rmiObj.getMethodId();
- switch (methodId) {
- case 0: ___init(rmiObj); break;
- case 1: ___start(rmiObj); break;
- case 2: ___stop(rmiObj); break;
- case 3: ___getLatestFrame(rmiObj); break;
- case 4: ___getTimestamp(rmiObj); break;
- case 5: ___getSupportedResolutions(rmiObj); break;
- case 6: ___setResolution(rmiObj); break;
- case 7: ___setFPS(rmiObj); break;
- case 8: ___getMaxFPS(rmiObj); break;
- case 9: ___getMinFPS(rmiObj); break;
- case 10: ___registerCallback(rmiObj); break;
- case -9998: ___regCB(rmiObj); break;
- default:
- throw new Error("Method Id " + methodId + " not recognized!");
- }
- }
-
-}