Moving Java drivers; Creating iotruntime socket connections for C++; First version...
[iot2.git] / benchmarks / drivers / MotionSensor / SmartthingsSensor_Skeleton.java
diff --git a/benchmarks/drivers/MotionSensor/SmartthingsSensor_Skeleton.java b/benchmarks/drivers/MotionSensor/SmartthingsSensor_Skeleton.java
deleted file mode 100644 (file)
index 4dc20e1..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-package iotcode.MotionSensor;
-
-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 SmartthingsSensor_Skeleton implements SmartthingsSensor {
-
-       private SmartthingsSensor mainObj;
-       private IoTRMIObject rmiObj;
-
-       private String callbackAddress;
-       private int objIdCnt = 0;
-       private IoTRMICall rmiCall;
-       private int[] ports;
-
-       private final static int object0Id = 0; //SmartthingsSensorSmart
-       private static Integer[] object0Permission = { 3, 2, 5, 6, 1, 4, 0 };
-       private static List<Integer> set0Allowed;
-       
-
-       public SmartthingsSensor_Skeleton(SmartthingsSensor _mainObj, String _callbackAddress, int _port) throws Exception {
-               mainObj = _mainObj;
-               callbackAddress = _callbackAddress;
-               rmiObj = new IoTRMIObject(_port);
-               set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
-               set0Allowed.add(-9998);
-               ___waitRequestInvokeMethod();
-       }
-
-       public void init() {
-               mainObj.init();
-       }
-
-       public int getValue() {
-               return mainObj.getValue();
-       }
-
-       public boolean isActiveValue() {
-               return mainObj.isActiveValue();
-       }
-
-       public long getTimestampOfLastReading() {
-               return mainObj.getTimestampOfLastReading();
-       }
-
-       public void setId(int id) {
-               mainObj.setId(id);
-       }
-
-       public int getId() {
-               return mainObj.getId();
-       }
-
-       public void registerCallback(SmartthingsSensorSmartCallback _callbackTo) {
-               mainObj.registerCallback(_callbackTo);
-       }
-
-       public void ___regCB() 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(ports[0], (String) paramObj[1], (int) paramObj[2]);
-       }
-
-       public void ___init() {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
-               new Class<?>[] {  });
-               init();
-       }
-
-       public void ___getValue() throws IOException {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
-               new Class<?>[] {  });
-               Object retObj = getValue();
-               rmiObj.sendReturnObj(retObj);
-       }
-
-       public void ___isActiveValue() throws IOException {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
-               new Class<?>[] {  });
-               Object retObj = isActiveValue();
-               rmiObj.sendReturnObj(retObj);
-       }
-
-       public void ___getTimestampOfLastReading() throws IOException {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
-               new Class<?>[] {  });
-               Object retObj = getTimestampOfLastReading();
-               rmiObj.sendReturnObj(retObj);
-       }
-
-       public void ___setId() {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
-               new Class<?>[] { null });
-               setId((int) paramObj[0]);
-       }
-
-       public void ___getId() throws IOException {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
-               new Class<?>[] {  });
-               Object retObj = getId();
-               rmiObj.sendReturnObj(retObj);
-       }
-
-       public void ___registerCallback() {
-               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
-               new Class<?>[] { null });
-               try {
-                       SmartthingsSensorSmartCallback stub0 = new SmartthingsSensorSmartCallback_CallbackStub(rmiCall, callbackAddress, objIdCnt, ports);
-                       objIdCnt++;
-                       registerCallback(stub0);
-               } catch(Exception ex) {
-                       ex.printStackTrace();
-                       throw new Error("Exception from callback object instantiation!");
-               }
-       }
-
-       private void ___waitRequestInvokeMethod() throws IOException {
-               while (true) {
-                       rmiObj.getMethodBytes();
-                       int _objectId = rmiObj.getObjectId();
-                       int methodId = rmiObj.getMethodId();
-                       if (_objectId == object0Id) {
-                               if (!set0Allowed.contains(methodId)) {
-                                       throw new Error("Object with object Id: " + _objectId + "  is not allowed to access method: " + methodId);
-                               }
-                       }
-                       else {
-                               throw new Error("Object Id: " + _objectId + " not recognized!");
-                       }
-                       switch (methodId) {
-                               case 0: ___init(); break;
-                               case 1: ___getValue(); break;
-                               case 2: ___isActiveValue(); break;
-                               case 3: ___getTimestampOfLastReading(); break;
-                               case 4: ___setId(); break;
-                               case 5: ___getId(); break;
-                               case 6: ___registerCallback(); break;
-                               case -9998: ___regCB(); break;
-                               default: 
-                               throw new Error("Method Id " + methodId + " not recognized!");
-                       }
-               }
-       }
-
-}