1 package iotcode.MotionSensor;
3 import java.io.IOException;
5 import java.util.ArrayList;
6 import java.util.Arrays;
8 import java.util.HashMap;
9 import java.util.concurrent.atomic.AtomicBoolean;
10 import iotrmi.Java.IoTRMIComm;
11 import iotrmi.Java.IoTRMICommClient;
12 import iotrmi.Java.IoTRMICommServer;
13 import iotrmi.Java.IoTRMIUtil;
15 import iotcode.interfaces.*;
17 public class SmartthingsSensorSmartCallback_Stub implements SmartthingsSensorSmartCallback {
19 private int objectId = 3;
20 private IoTRMIComm rmiComm;
21 // Synchronization variables
24 public SmartthingsSensorSmartCallback_Stub(int _localPortSend, int _localPortRecv, int _portSend, int _portRecv, String _skeletonAddress, int _rev) throws Exception {
25 if (_localPortSend != 0 && _localPortRecv != 0) {
26 rmiComm = new IoTRMICommClient(_localPortSend, _localPortRecv, _portSend, _portRecv, _skeletonAddress, _rev);
29 rmiComm = new IoTRMICommClient(_portSend, _portRecv, _skeletonAddress, _rev);
31 IoTRMIUtil.mapStub.put(objectId, this);
34 public SmartthingsSensorSmartCallback_Stub(IoTRMIComm _rmiComm, int _objectId) throws Exception {
39 public void newReadingAvailable(int _sensorId, int _value, boolean _activeValue) {
41 Class<?> retType = void.class;
42 Class<?>[] paramCls = new Class<?>[] { int.class, int.class, boolean.class };
43 Object[] paramObj = new Object[] { _sensorId, _value, _activeValue };
44 rmiComm.remoteCall(objectId, methodId, paramCls, paramObj);