--- /dev/null
+ADDITIONAL_ZIP_FILE=No
--- /dev/null
+package Lifxtest;
+
+import iotruntime.slave.IoTSet;
+import iotruntime.slave.IoTRelation;
+import iotruntime.slave.IoTDeviceAddress;
+import iotruntime.IoTUDP;
+
+import java.io.IOException;
+import java.net.*;
+import iotcode.interfaces.LightBulbTest;
+import iotcode.annotation.*;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Map;
+
+import java.rmi.*;
+import java.rmi.server.UnicastRemoteObject;
+
+import iotcode.interfaces.LightBulbTest;
+
+public class Lifxtest {
+
+ @config private IoTSet<LightBulbTest> lifx_light_bulb;
+
+ public void init() throws InterruptedException {
+
+ for(LightBulbTest lifx : lifx_light_bulb.values()) {
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ lifx.init();
+ }
+ });
+ thread.start();
+ Thread.sleep(1000);
+
+ for (int i = 0; i < 5; i++) {
+ lifx.turnOff();
+ System.out.println("Turning off!");
+ Thread.sleep(1000);
+ lifx.turnOn();
+ System.out.println("Turning on!");
+ Thread.sleep(1000);
+ }
+
+ for (int i = 2500; i < 9000; i += 100) {
+ System.out.println("Adjusting Temp: " + Integer.toString(i));
+ lifx.setTemperature(i);
+ Thread.sleep(100);
+ }
+
+ for (int i = 9000; i > 2500; i -= 100) {
+ System.out.println("Adjusting Temp: " + Integer.toString(i));
+ lifx.setTemperature(i);
+ Thread.sleep(100);
+ }
+
+ for (int i = 100; i > 0; i -= 10) {
+ System.out.println("Adjusting Brightness: " + Integer.toString(i));
+ lifx.setColor(lifx.getHue(), lifx.getSaturation(), i);
+ Thread.sleep(500);
+ }
+
+ for (int i = 0; i < 100; i += 10) {
+ System.out.println("Adjusting Brightness: " + Integer.toString(i));
+ lifx.setColor(lifx.getHue(), lifx.getSaturation(), i);
+ Thread.sleep(500);
+ }
+
+ thread.join();
+ }
+ }
+}
--- /dev/null
+package Lifxtest;
+
+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.LightBulbTest;
+
+public class LightBulbTest_Stub implements LightBulbTest {
+
+ private IoTRMICall rmiCall;
+ private String callbackAddress;
+ private int[] ports;
+
+ private final static int objectId = 0;
+
+
+ public LightBulbTest_Stub(int _port, String _skeletonAddress, String _callbackAddress, int _rev, int[] _ports) throws Exception {
+ callbackAddress = _callbackAddress;
+ ports = _ports;
+ rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev);
+ }
+
+ public void turnOn() {
+ int methodId = 2;
+ Class<?> retType = void.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ }
+
+ public double getBrightness() {
+ int methodId = 6;
+ Class<?> retType = double.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ return (double)retObj;
+ }
+
+ public void turnOff() {
+ int methodId = 1;
+ Class<?> retType = void.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ }
+
+ public boolean getState() {
+ int methodId = 3;
+ Class<?> retType = boolean.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ return (boolean)retObj;
+ }
+
+ public void setColor(double _hue, double _saturation, double _brightness) {
+ int methodId = 4;
+ 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);
+ }
+
+ public double getSaturation() {
+ int methodId = 8;
+ Class<?> retType = double.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ return (double)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 setTemperature(int _temperature) {
+ int methodId = 5;
+ Class<?> retType = void.class;
+ Class<?>[] paramCls = new Class<?>[] { int.class };
+ Object[] paramObj = new Object[] { _temperature };
+ rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ }
+
+ public double getHue() {
+ int methodId = 7;
+ Class<?> retType = double.class;
+ Class<?>[] paramCls = new Class<?>[] { };
+ Object[] paramObj = new Object[] { };
+ Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+ return (double)retObj;
+ }
+
+ public int getTemperature() {
+ 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;
+ }
+
+}
--- /dev/null
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):.
+JARFLAGS = cf
+JARFLAGS_SMARTLIGHTS = cf Lifxtest.jar
+
+all: lifxtest
+
+PHONY += lifxtest
+lifxtest:
+ $(JAVAC) $(JFLAGS) *.java
+ cp Lifxtest.config $(BIN_DIR)/Lifxtest
+ cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class
+
+.PHONY: $(PHONY)
include $(BASE)/common.mk
-all: interfaces annotation drivers Lifxtest SmartLights Irrigation Speaker
-
-nocheck: interfaces annotation nocheckdrivers nocheckLifxtest nocheckSmartLights nocheckIrrigation nocheckSpeaker nocheckBrillotest
+all: interfaces annotation drivers Lifxtest
PHONY += interfaces
interfaces:
--- /dev/null
+package iotcode.annotation;
+
+import java.lang.annotation.*;
+
+/** @config annotation
+ * This annotation is for the runtime system to instrument IoTSet and IoTRelation
+ * Re-instated on 12/12/2016
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-12-12
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface config {
+}
--- /dev/null
+package iotcode.annotation;
+
+import java.lang.annotation.*;
+
+/** @constraint annotation
+ * This annotation is for the runtime system to instrument IoTSet and IoTRelation
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2015-12-01
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface constraint {
+}
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
-
// IoT Packages
-//import iotcode.annotation.*;
+import iotcode.annotation.*;
import iotcode.interfaces.LightBulb;
import iotruntime.IoTUDP;
import iotruntime.slave.IoTDeviceAddress;
// String to byte conversion
import javax.xml.bind.DatatypeConverter;
-import iotchecker.qual.*;
-
public class LifxLightBulb implements LightBulb {
/*******************************************************************************************************************************************
--- /dev/null
+package iotcode.LifxLightBulb;
+
+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.LightBulb;
+
+public class LightBulb_Skeleton implements LightBulb {
+
+ private LightBulb mainObj;
+ private IoTRMIObject rmiObj;
+
+ private final static int object0Id = 0; //LightBulbTest
+ private static Integer[] object0Permission = { 2, 1, 3, 4, 0, 5 };
+ private static List<Integer> set0Allowed;
+
+
+ public LightBulb_Skeleton(LightBulb _mainObj, int _port) throws Exception {
+ mainObj = _mainObj;
+ rmiObj = new IoTRMIObject(_port);
+ set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
+ ___waitRequestInvokeMethod();
+ }
+
+ public void init() {
+ mainObj.init();
+ }
+
+ public void turnOff() {
+ mainObj.turnOff();
+ }
+
+ public void turnOn() {
+ mainObj.turnOn();
+ }
+
+ public boolean getState() {
+ return mainObj.getState();
+ }
+
+ public void setColor(double _hue, double _saturation, double _brightness) {
+ mainObj.setColor(_hue, _saturation, _brightness);
+ }
+
+ public void setTemperature(int _temperature) {
+ mainObj.setTemperature(_temperature);
+ }
+
+ public double getBrightness() {
+ return mainObj.getBrightness();
+ }
+
+ public double getHue() {
+ return mainObj.getHue();
+ }
+
+ public double getSaturation() {
+ return mainObj.getSaturation();
+ }
+
+ public int getTemperature() {
+ return mainObj.getTemperature();
+ }
+
+ public double getBrightnessRangeLowerBound() {
+ return mainObj.getBrightnessRangeLowerBound();
+ }
+
+ public double getBrightnessRangeUpperBound() {
+ return mainObj.getBrightnessRangeUpperBound();
+ }
+
+ public double getHueRangeLowerBound() {
+ return mainObj.getHueRangeLowerBound();
+ }
+
+ public double getHueRangeUpperBound() {
+ return mainObj.getHueRangeUpperBound();
+ }
+
+ public double getSaturationRangeLowerBound() {
+ return mainObj.getSaturationRangeLowerBound();
+ }
+
+ public double getSaturationRangeUpperBound() {
+ return mainObj.getSaturationRangeUpperBound();
+ }
+
+ public int getTemperatureRangeLowerBound() {
+ return mainObj.getTemperatureRangeLowerBound();
+ }
+
+ public int getTemperatureRangeUpperBound() {
+ return mainObj.getTemperatureRangeUpperBound();
+ }
+
+ public void ___init() {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ init();
+ }
+
+ public void ___turnOff() {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ turnOff();
+ }
+
+ public void ___turnOn() {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ turnOn();
+ }
+
+ public void ___getState() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getState();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___setColor() {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { double.class, double.class, double.class },
+ new Class<?>[] { null, null, null });
+ setColor((double) paramObj[0], (double) paramObj[1], (double) paramObj[2]);
+ }
+
+ public void ___setTemperature() {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
+ new Class<?>[] { null });
+ setTemperature((int) paramObj[0]);
+ }
+
+ public void ___getBrightness() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getBrightness();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getHue() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getHue();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getSaturation() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getSaturation();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getTemperature() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getTemperature();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getBrightnessRangeLowerBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getBrightnessRangeLowerBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getBrightnessRangeUpperBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getBrightnessRangeUpperBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getHueRangeLowerBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getHueRangeLowerBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getHueRangeUpperBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getHueRangeUpperBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getSaturationRangeLowerBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getSaturationRangeLowerBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getSaturationRangeUpperBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getSaturationRangeUpperBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getTemperatureRangeLowerBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getTemperatureRangeLowerBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ public void ___getTemperatureRangeUpperBound() throws IOException {
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { },
+ new Class<?>[] { });
+ Object retObj = getTemperatureRangeUpperBound();
+ rmiObj.sendReturnObj(retObj);
+ }
+
+ 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: ___turnOff(); break;
+ case 2: ___turnOn(); break;
+ case 3: ___getState(); break;
+ case 4: ___setColor(); break;
+ case 5: ___setTemperature(); break;
+ case 6: ___getBrightness(); break;
+ case 7: ___getHue(); break;
+ case 8: ___getSaturation(); break;
+ case 9: ___getTemperature(); break;
+ case 10: ___getBrightnessRangeLowerBound(); break;
+ case 11: ___getBrightnessRangeUpperBound(); break;
+ case 12: ___getHueRangeLowerBound(); break;
+ case 13: ___getHueRangeUpperBound(); break;
+ case 14: ___getSaturationRangeLowerBound(); break;
+ case 15: ___getSaturationRangeUpperBound(); break;
+ case 16: ___getTemperatureRangeLowerBound(); break;
+ case 17: ___getTemperatureRangeUpperBound(); break;
+ default:
+ throw new Error("Method Id " + methodId + " not recognized!");
+ }
+ }
+ }
+
+}
--- /dev/null
+BASE = ../..
+
+include $(BASE)/common.mk
+
+BOOFDIR := ../libs/boofcv_libs
+BOOFJARS := $(BOOFDIR)/BoofCV-feature-0.21.jar:$(BOOFDIR)/BoofCV-io-0.21.jar:$(BOOFDIR)/BoofCV-visualize-0.21.jar:$(BOOFDIR)/BoofCV-ip-0.21.jar
+JLAYERDIR := ../libs/jlayer_libs
+JLAYERJARS := $(JLAYERDIR)/jl1.0.1.jar
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):$(PHONEJARS):$(BOOFJARS):$(JLAYERJARS)
+JARFLAGS = cf
+INTFACE_DIR = iotcode/interfaces
+
+all: light
+
+# Compile
+#
+PHONY += light
+light:
+ $(JAVAC) $(JFLAGS) LifxLightBulb/*.java
+ cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+ cd $(BIN_DIR)/iotcode/LifxLightBulb; $(JAR) $(JARFLAGS) LifxLightBulb.jar ../../iotcode/LifxLightBulb/*.class ../../iotcode/interfaces/LightBulb*.class
+
+.PHONY: $(PHONY)
--- /dev/null
+package iotcode.interfaces;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public interface LightBulb {
+ public void init();
+ public void turnOff();
+ public void turnOn();
+ public boolean getState();
+ public void setColor(double _hue, double _saturation, double _brightness);
+ public void setTemperature(int _temperature);
+ public double getBrightness();
+ public double getHue();
+ public double getSaturation();
+ public int getTemperature();
+ public double getBrightnessRangeLowerBound();
+ public double getBrightnessRangeUpperBound();
+ public double getHueRangeLowerBound();
+ public double getHueRangeUpperBound();
+ public double getSaturationRangeLowerBound();
+ public double getSaturationRangeUpperBound();
+ public int getTemperatureRangeLowerBound();
+ public int getTemperatureRangeUpperBound();
+}
--- /dev/null
+package iotcode.interfaces;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public interface LightBulbTest {
+
+ public void turnOn();
+ public double getBrightness();
+ public void turnOff();
+ public boolean getState();
+ public void setColor(double _hue, double _saturation, double _brightness);
+ public double getSaturation();
+ public void init();
+ public void setTemperature(int _temperature);
+ public double getHue();
+ public int getTemperature();
+}
--- /dev/null
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):.
+
+all: interfaces
+
+PHONY += interfaces
+interfaces:
+ $(JAVAC) $(JFLAGS) *.java
+
+.PHONY: $(PHONY)
--- /dev/null
+package iotcode.interfaces;
+
+// Standard Java Packages
+import java.util.ArrayList;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Class Camera interface for camera devices.
+ * This Interface supports single lens cameras, can only produce 1 frame at a time
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+
+public interface Camera extends Remote {
+
+ /** Enumeration of the standard resolutions supported by general cameras
+ *
+ */
+ public enum Resolution {
+ RES_1080P,
+ RES_720P,
+ RES_VGA
+ };
+
+
+ /** Method to get the latest image frame data of the camera.
+ *
+ * @param None.
+ *
+ * @return [byte[]] Image frame byte data of buffered image.
+ */
+ public byte[] getLatestFrame() throws RemoteException;
+
+
+ /** Method to get the time-stamp of when the image was taken.
+ *
+ * @param None.
+ *
+ * @return [Date] Time-stamp of when the image was taken.
+ */
+ public Date getTimestamp() throws RemoteException;
+
+ /** Method to start the camera.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void start() throws RemoteException;
+
+
+ /** Method to stop the camera.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void stop() throws RemoteException;
+
+ /** Method to set the resolution of the camera.
+ *
+ * @param _res [Camera.Resolution]: the new resolution of the camera
+ *
+ * @return true if the resolution was set
+ */
+ public boolean setResolution(Camera.Resolution _res) throws RemoteException;
+
+
+ /** Method to set the frames per second of the camera.
+ *
+ * @param _fps [int]: the new frames per second of the camera
+ *
+ * @return true if the frames per second was set
+ */
+ public boolean setFPS(int _fps) throws RemoteException;
+
+
+ /** Method to get the max supported frames per second by the camera.
+ *
+ * @param None.
+ *
+ * @return [int] the max frames per second supported by the camera.
+ */
+ public int getMaxFPS() throws RemoteException;
+
+
+ /** Method to get the min supported frames per second by the camera.
+ *
+ * @param None.
+ *
+ * @return [int] the min frames per second supported by the camera.
+ */
+ public int getMinFPS() throws RemoteException;
+
+
+ /** Method to get the supported resolutions of the camera.
+ *
+ * @param None.
+ *
+ * @return [List<Camera.Resolution>] the supported resolutions of the camera.
+ */
+ public List<Camera.Resolution> getSupportedResolutions() throws RemoteException;
+
+
+ /** Register an object to retrieve callbacks when new camera data is available.
+ *
+ * @param _callbackTo [CameraCallback].
+ *
+ * @return [void] None.
+ */
+ public void registerCallback(@NonLocalRemote CameraCallback _callbackTo) throws RemoteException;
+
+
+ /** Method to initialize the camera, if the bulb needs to be camera.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Camera Callback for when a camera changes state (new frame available).
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+
+public interface CameraCallback extends Remote {
+
+ /** Callback method for when a new camera frame is available.
+ * Called when a new frame is ready by the camera and the camera
+ * can be checked for the frame data.
+ *
+ * @param _camera [Camera] .
+ *
+ * @return [void] None.
+ */
+ public void newCameraFrameAvailable(@NonLocalRemote Camera _camera) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Gateway public interface, e.g. for PhoneGateway
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-27
+ */
+
+public interface GPSGateway extends Remote {
+
+ /** Method to start the gateway.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void start() throws RemoteException;
+
+
+ /** Method to stop the gateway.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void stop() throws RemoteException;
+
+
+ /** Method to initialize the gateway.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+
+ /** Register an object to retrieve callbacks when new data is available.
+ *
+ * @param _callbackTo [PhoneGatewayCallback].
+ *
+ * @return [void] None.
+ */
+ public void registerCallback(@NonLocalRemote GPSGatewayCallback _callbackTo) throws RemoteException;
+
+
+ /** Get room identifier
+ *
+ * @param None.
+ *
+ * @return [int] Room identifier.
+ */
+ public int getRoomID() throws RemoteException;
+
+
+ /** Get ring status
+ *
+ * @param None.
+ *
+ * @return [boolean] Ring status (true/false).
+ */
+ public boolean getRingStatus() throws RemoteException;
+
+ /** Set boolean of new room identifier availability
+ *
+ * @param [boolean] Room identifier availability (true if there is new room ID)
+ *
+ * @return [void] None.
+ */
+ public void setNewRoomIDAvailable(boolean bValue) throws RemoteException;
+
+ /** Set boolean of new ring status availability
+ *
+ * @param [boolean] Ring status availability (true if there is new ring status)
+ *
+ * @return [void] None.
+ */
+ public void setNewRingStatusAvailable(boolean bValue) throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Interface GPSGatewayCallback for allowing callbacks from the GPSGateway class.
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-28
+ */
+
+public interface GPSGatewayCallback extends Remote {
+
+ /** Callback method for when room ID is retrieved.
+ *
+ * @param _wgw [GPSGateway].
+ * @return [void] None.
+ */
+ public void newRoomIDRetrieved(@NonLocalRemote GPSGateway _wgw) throws RemoteException;
+
+ /** Callback method for when ring status is retrieved.
+ *
+ * @param _wgw [GPSGateway].
+ * @return [void] None.
+ */
+ public void newRingStatusRetrieved(@NonLocalRemote GPSGateway _wgw) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Class LEDFlasher interface for LEDFlasher Brillo devices.
+ * <p>
+ * This interface is generated by IoTBrilloWeaveCodeGenerator.
+ * These comments were added after code generation.
+ *
+ * @author Rahmadi Trimananda <rtrimana @ uci.edu>
+ * @version 1.0
+ * @since 2016-06-13
+ */
+public interface LEDFlasher extends Remote {
+
+ public void init() throws RemoteException;
+ public void _accessControlBlackList_block(String applicationId, Integer expirationTimeoutSec, String userId) throws RemoteException;
+ public void _accessControlBlackList_list() throws RemoteException;
+ public void _accessControlBlackList_unblock(String applicationId, String userId) throws RemoteException;
+ public void _ledflasher_animate(Float duration, String type) throws RemoteException;
+ public void _metrics_disableAnalyticsReporting() throws RemoteException;
+ public void _metrics_enableAnalyticsReporting() throws RemoteException;
+ public void _updater_checkForUpdates() throws RemoteException;
+ public void _updater_trackChannel(String channel) throws RemoteException;
+ public void base_identify() throws RemoteException;
+ public void base_reboot() throws RemoteException;
+ public void base_updateBaseConfiguration(String localAnonymousAccessMaxRole, Boolean localDiscoveryEnabled, Boolean localPairingEnabled) throws RemoteException;
+ public void base_updateDeviceInfo(String description, String location, String name) throws RemoteException;
+ public void onOff_setConfig(String state) throws RemoteException;
+
+}
--- /dev/null
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Lawn extends Remote {
+
+}
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Class LightBulb interface for the light bulb devices.
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+
+
+public interface LightBulb extends Remote {
+
+ /** Method to turn the light bulb on (Physically illuminate the area).
+ *
+ * @param None.
+ *
+ * @return [void] None.
+ */
+
+ public void turnOff() throws RemoteException;
+
+ /** Method to turn the light bulb off.
+ *
+ * @return [void] None.
+ */
+ public void turnOn() throws RemoteException;
+
+
+ /** Method to get the current on/off state of the light bulb.
+ *
+ * @return [boolean] True means bulb on.
+ */
+ public boolean getState() throws RemoteException;
+
+
+ /** Method to set the light bulb color using Standard Hue, Saturation and Brightness
+ * conventions. See "http://www.tydac.ch/color/" for reference.
+ *
+ * @param _hue [double]: Hue value (in degrees).
+ * @param _saturation [double]: Saturation value (percentage).
+ * @param _brightness [double]: Brightness value (percentage).
+ *
+ * @return [void] None.
+ */
+ public void setColor(double _hue, double _saturation, double _brightness) throws RemoteException;
+
+
+ /** Method to set the color temperature.
+ *
+ * @param _temperature [int]: Color temperature in degrees kelvin.
+ *
+ * @return [void] None.
+ */
+ public void setTemperature(int _temperature) throws RemoteException;
+
+
+ /** Method to get the current hue value of the bulb.
+ *
+ * @return [double] Current hue value of the bulb in degrees.
+ */
+ public double getHue() throws RemoteException;
+
+
+ /** Method to get the current saturation value of the bulb.
+ *
+ * @return [double] Current saturation value of the bulb as a percentage.
+ */
+ public double getSaturation() throws RemoteException;
+
+
+ /** Method to get the current brightness value of the bulb.
+ *
+ * @return [double] Current brightness value of the bulb as a percentage.
+ */
+ public double getBrightness() throws RemoteException;
+
+
+ /** Method to get the current color temperature value of the bulb.
+ *
+ * @return [double] Current color temperature value of the bulb in kelvin.
+ */
+ public int getTemperature() throws RemoteException;
+
+
+ /** Method to get the hue range lower bound supported by the bulb.
+ *
+ * @return [double] Hue lower bound in degrees.
+ */
+ public double getHueRangeLowerBound() throws RemoteException;
+
+
+ /** Method to get the hue range upper bound supported by the bulb.
+ *
+ * @return [double] Hue upper bound in degrees.
+ */
+ public double getHueRangeUpperBound() throws RemoteException;
+
+
+ /** Method to get the saturation range lower bound supported by the bulb.
+ *
+ * @return [double] Saturation lower bound as a percentage.
+ */
+ public double getSaturationRangeLowerBound() throws RemoteException;
+
+
+ /** Method to get the saturation range upper bound supported by the bulb.
+ *
+ * @return [double] Saturation upper bound as a percentage.
+ */
+ public double getSaturationRangeUpperBound() throws RemoteException;
+
+
+ /** Method to get the brightness range lower bound supported by the bulb.
+ *
+ * @return [double] Brightness lower bound as a percentage.
+ */
+ public double getBrightnessRangeLowerBound() throws RemoteException;
+
+
+ /** Method to get the brightness range upper bound supported by the bulb.
+ *
+ * @return [double] Brightness upper bound as a percentage.
+ */
+ public double getBrightnessRangeUpperBound() throws RemoteException;
+
+
+ /** Method to get the temperature range lower bound supported by the bulb.
+ *
+ * @return [int] Temperature lower bound as a percentage.
+ */
+ public int getTemperatureRangeLowerBound() throws RemoteException;
+
+
+ /** Method to get the temperature range upper bound supported by the bulb.
+ *
+ * @return [int] Temperature upper bound as a percentage.
+ */
+ public int getTemperatureRangeUpperBound() throws RemoteException;
+
+
+ /** Method to initialize the bulb, if the bulb needs to be initialized.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):$(CHECKERJARS):.
+
+# checker option
+#
+CHECKER_OPT = -processor iotchecker.IoTJavaChecker
+
+ASTUBS = -Astubs=../../checker/astubs/
+
+all: check
+
+PHONY += check
+check:
+ $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
+
+PHONY += nocheck
+nocheck:
+ $(JAVAC) $(JFLAGS) *.java
+
+.PHONY: $(PHONY)
--- /dev/null
+package iotcode.interfaces;
+
+// Standard Java Packages
+import java.util.Date;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.*;
+
+
+/** Class Moisture sensor interface for Moisture sensor devices.
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-19
+ */
+public interface MoistureSensor extends Remote {
+
+ /** Method to get the latests moisture reading from the sensor
+ *
+ * @return [float] Moisture as a percentage.
+ */
+ public float getMoisture() throws RemoteException;
+
+
+ /** Method to get the latests moisture reading timestamp from the sensor
+ *
+ * @return [Date] timestamp of latest moisture reading, null if no reading occurred yet.
+ */
+ public Date getTimestampOfLastReading() throws RemoteException;
+
+
+ /** Method to initialize the moisture sensor.
+ *
+ * @param None.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+
+ /** Register an object to retrieve callbacks when new sensor reading is available
+ *
+ * @param _callbackTo [MoistureSensorCallback].
+ *
+ * @return [void] None.
+ */
+ public void registerCallback(@NonLocalRemote MoistureSensorCallback _callbackTo) throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.*;
+
+
+/** Camera Callback for when a camera changes state (new frame available).
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+
+public interface MoistureSensorCallback extends Remote {
+
+ /** Callback method for when a new moisture reading is available.
+ * Called when a new reading is ready by the sensor and the sensor
+ * can be checked for the frame data.
+ *
+ * @param _sensor [MoistureSensor] .
+ *
+ * @return [void] None.
+ */
+ public void newReadingAvailable(@NonLocalRemote MoistureSensor _sensor) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Interface Room for all room implementations
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+public interface Room extends Remote {
+
+ /** Method to return room ID.
+ *
+ * @param None.
+ *
+ * @return [int] Room identifier.
+ */
+ public int getRoomID() throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Speaker Interface Class
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-29
+ */
+public interface Speaker extends Remote {
+
+ /** Init method
+ *
+ * @param None.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+ /** Method to start playback
+ *
+ * @param None.
+ *
+ * @return [boolean] True/false to start playback.
+ */
+ public boolean startPlayback() throws RemoteException;
+
+ /** Method to stop playback
+ *
+ * @param None.
+ *
+ * @return [boolean] True/false to stop playback.
+ */
+ public boolean stopPlayback() throws RemoteException;
+
+
+ /** Method to getPlaybackState
+ *
+ * @param None.
+ *
+ * @return [boolean] True/false of playback state
+ */
+ public boolean getPlaybackState() throws RemoteException;
+
+ /** Method to set volume
+ *
+ * @param [float] Volume percentage.
+ *
+ * @return [boolean] True/false to set volume.
+ */
+ public boolean setVolume(float _percent) throws RemoteException;
+
+ /** Method to get volume
+ *
+ * @param None.
+ *
+ * @return [float] Volume percentage.
+ */
+ public float getVolume() throws RemoteException;
+
+ /** Method to get position in the song
+ *
+ * @param None.
+ *
+ * @return [int] Position in the song when playing music.
+ */
+ public int getPosition()throws RemoteException;
+
+ /** Method to set position
+ *
+ * @param [int] Position to set (in milliseconds)
+ *
+ * @return [void] None.
+ */
+ public void setPosition(int _mSec) throws RemoteException;
+
+ /** Method to set position
+ *
+ * @param [short[]] Sample packets from music file
+ * @param [int] Offset
+ * @param [int] Length
+ *
+ * @return [void] None.
+ */
+ public void loadData(short[] _samples, int _offs, int _len) throws RemoteException;
+
+
+ /** Method to clear all pcm data
+ *
+ * @param None
+ *
+ * @return [void] None.
+ */
+ public void clearData() throws RemoteException;
+
+
+ /** Method to register callbacks
+ *
+ * @param [SpeakerCallback] Callback object
+ *
+ * @return [void] None.
+ */
+ public void registerCallback(@NonLocalRemote SpeakerCallback _cb) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** speaker Callback for when a speaker changes state (sound ends).
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-01-27
+ */
+
+public interface SpeakerCallback extends Remote {
+
+ /** Callback method for when speaker music ends.
+ *
+ * @param _speaker [speaker] .
+ *
+ * @return [void] None.
+ */
+ public void speakerDone(@NonLocalRemote Speaker _speaker) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+
+// Standard Java Packages
+import java.util.ArrayList;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+
+
+/** Class Sprinkler interface for sprinkler devices.
+ *
+ * @author Ali Younis <ayounis @ uci.edu>
+ * @version 1.0
+ * @since 2016-03-31
+ */
+public interface Sprinkler extends Remote {
+
+ /** Method to set the state of a specified zone
+ *
+ * @param _zone [int] : zone number to set.
+ * @param _onOff [boolean] : the state to set the zone to, on or off.
+ * @param _onDurationSeconds [int]: the duration to set the state on to, if -1 then infinite.
+ *
+ * @return [void] None.
+ */
+ public void setZone(int _zone, boolean _onOff, int _onDurationSeconds) throws RemoteException;
+
+
+ /** Method to get the current state of all the zones.
+ *
+ * @param None.
+ *
+ * @return [List<ZoneState>] list of the states for the zones.
+ */
+ public List<ZoneState> getZoneStates() throws RemoteException;
+
+
+ /** Method to get the number of zones this sprinkler can control.
+ *
+ * @param None.
+ *
+ * @return [int] number of zones that can be controlled.
+ */
+ public int getNumberOfZones() throws RemoteException;
+
+
+ /** Method to get whether or not this sprinkler can control durations.
+ *
+ * @param None.
+ *
+ * @return [boolean] boolean if this sprinkler can do durations.
+ */
+ public boolean doesHaveZoneTimers() throws RemoteException;
+
+
+ /** Method to initialize the sprinkler.
+ *
+ * @param None.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+package iotcode.interfaces;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Gateway public interface, e.g. for PhoneGateway
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-26
+ */
+
+public interface WeatherGateway extends Remote {
+
+ /** Method to start the gateway.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void start() throws RemoteException;
+
+
+ /** Method to stop the gateway.
+ *
+ * @param None.
+ *
+ * @return None
+ */
+ public void stop() throws RemoteException;
+
+
+ /** Method to initialize the gateway.
+ *
+ * @return [void] None.
+ */
+ public void init() throws RemoteException;
+
+
+ /** Register an object to retrieve callbacks when new data is available.
+ *
+ * @param _callbackTo [WeatherGatewayCallback].
+ *
+ * @return [void] None.
+ */
+ public void registerCallback(@NonLocalRemote WeatherGatewayCallback _callbackTo) throws RemoteException;
+
+
+ /** Get inches per week data
+ *
+ * @param None.
+ *
+ * @return [double] Rainfall (inches per week).
+ */
+ public double getInchesPerWeek() throws RemoteException;
+
+
+ /** Get weather area zip code
+ *
+ * @param None.
+ *
+ * @return [int] Area zipcode.
+ */
+ public int getWeatherZipCode() throws RemoteException;
+
+
+ /** Days to keep watering the lawns
+ *
+ * @param None.
+ *
+ * @return [int] Number of days.
+ */
+ public int getDaysToWaterOn() throws RemoteException;
+
+
+ /** Get inches per minute data
+ *
+ * @param None.
+ *
+ * @return [double] Rainfall (inches per minute).
+ */
+ public double getInchesPerMinute() throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Interface WeatherGatewayCallback for allowing callbacks from the PhoneGateway class.
+ *
+ * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version 1.0
+ * @since 2016-04-26
+ */
+
+public interface WeatherGatewayCallback extends Remote {
+
+ /** Callback method for when the information is retrieved.
+ *
+ * @param _wgw [WeatherGateway].
+ * @return [void] None.
+ */
+ public void informationRetrieved(@NonLocalRemote WeatherGateway _wgw) throws RemoteException;
+}
--- /dev/null
+package iotcode.interfaces;
+
+public class ZoneState {
+ private int zoneNumber = 0;
+ private boolean onOffState = false;
+ private int duration = -1;
+
+ public ZoneState(int _zoneNumber, boolean _onOffState, int _duration) {
+ zoneNumber = _zoneNumber;
+ onOffState = _onOffState;
+ duration = _duration;
+ }
+
+ public int getZoneNumber() {
+ return zoneNumber;
+ }
+
+ public boolean getOnOffState() {
+ return onOffState;
+ }
+
+ public int getDuration() {
+ return duration;
+ }
+
+ public void setOnOffState(boolean _onOffState) {
+ onOffState = _onOffState;
+ }
+
+ public void setDuration(int _duration) {
+ duration = _duration;
+ }
+
+
+
+ public String toString() {
+ String retString = "Zone Number: ";
+ retString += Integer.toString(zoneNumber);
+ retString += "\t On/Off State: ";
+
+ if (onOffState) {
+ retString += "On";
+ } else {
+ retString += "Off";
+ }
+ retString += "\t Duration: ";
+ retString += Integer.toString(duration);
+
+ return retString;
+ }
+}
+++ /dev/null
-public interface CallBackInterface {
-
- public int printInt();
- public void setInt(int _i);
-
- capability CallBack {
- description = "The quick brown fox jumps over the smart dog";
- description = "Another description";
- method = "printInt()";
- method = "setInt(int _i)";
- }
-}
-
-
+++ /dev/null
-
-requires CallBackInterface with CallBack as interface CallBackInterfaceWithCallBack;
-
+++ /dev/null
-public interface Camera {
-
- public List<Float> MethodA(int A, int B);
- public void MethodA(int A, int B, int AB);
- public int MethodB(int C, String D[]);
- public String MethodC(String E, List<Integer> F);
- public float MethodD(List<String> G, float H);
- public boolean MethodE(String I, boolean J);
- public void MethodF(LightBulb K);
- public Enum MethodG(Enum L);
- public Struct MethodH(Struct M, int N);
-
- capability ImageCapture {
- description = "The quick brown fox jumps over the smart dog";
- description = "Another description";
- method = "MethodA(int A, int B)";
- method = "MethodB(int C, String D[])";
- method = "MethodC(String E, List<Integer> F)";
- method = "MethodF(LightBulb K)";
- method = "MethodG(Enum L)";
- method = "MethodH(Struct M, int N)";
- }
-
- capability VideoRecording {
- description = "The quick brown fox jumps over the cool dog";
- method = "MethodA(int A, int B)";
- method = "MethodA(int A, int B, int AB)";
- method = "MethodD(List<String> G, float H)";
- }
-
- capability BackupData {
- description = "The quick brown fox jumps over the clever dog";
- method = "MethodE(String I, boolean J)";
- }
-
- struct Struct {
-
- string name;
- float value;
- int year;
- }
-}
-
-
+++ /dev/null
-
-requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData;
-
+++ /dev/null
-
-enum Enum {
-
- APPLE,
- ORANGE,
- GRAPE
-}
+++ /dev/null
-public interface LightBulb {
-
- public void MethodA(int A, float B);
- public void MethodA(int A, float B, int AB);
- public int MethodB(String C, String D);
- public byte MethodC(String E, List<Integer> F);
-
- capability Flicker {
- description = "The quick brown fox jumps over the smart dog";
- description = "Another description";
- method = "MethodA(int A, float B)";
- method = "MethodB(String C, String D)";
- method = "MethodC(String E, List<Integer> F)";
- }
-
- capability AutoOnOff {
- description = "The quick brown fox jumps over the cool dog";
- method = "MethodA(int A, float B)";
- method = "MethodA(int A, float B, int AB)";
- method = "MethodC(String E, List<Integer> F)";
- }
-
- enum Enum {
-
- APPLE,
- ORANGE,
- GRAPE,
- MANGO
- }
-}
-
-
+++ /dev/null
-
-requires LightBulb with Flicker as interface LightBulbWithFlicker;
-
+++ /dev/null
-
-struct Struct {
-
- string name;
- float value;
- int year;
-}
+++ /dev/null
-public interface TestClassInterface {
-
- public byte getByte(byte in);
- public short getShort(short in);
- public long getLong(long in);
- public float getFloat(float in);
- public double getDouble(double in);
- public boolean getBoolean(boolean in);
- public char getChar(char in);
-
- public byte[] getByteArray(byte in[]);
- public short[] getShortArray(short in[]);
- public long[] getLongArray(long in[]);
- public float[] getFloatArray(float in[]);
- public double[] getDoubleArray(double in[]);
- public boolean[] getBooleanArray(boolean in[]);
- public char[] getCharArray(char in[]);
-
- public List<Byte> getByteList(List<Byte> in);
- public List<Short> getShortList(List<Short> in);
- public List<Long> getLongList(List<Long> in);
- public List<Float> getFloatList(List<Float> in);
- public List<Double> getDoubleList(List<Double> in);
- public List<Boolean> getBooleanList(List<Boolean> in);
- public List<Character> getCharList(List<Character> in);
-
- public Enum handleEnum(Enum en);
- public Enum[] handleEnumArray(Enum en[]);
- public List<Enum> handleEnumList(List<Enum> en);
- public Enum handleEnumComplex(Enum en, int i, char c);
-
- public Struct handleStruct(Struct str);
- public Struct[] handleStructArray(Struct str[]);
- public List<Struct> handleStructList(List<Struct> str);
-
- public void registerCallback(CallBackInterface _cb);
- public void registerCallbackArray(CallBackInterface _cb[]);
- public void registerCallbackList(List<CallBackInterface> _cb);
- public int callBack();
-
- public int getA();
- public void setA(int _int);
- public void setB(float _float);
- public void setC(String _string);
- public String sumArray(String newA[]);
- public int setAndGetA(int newA);
- public int setACAndGetA(String newC, int newA);
-
- capability Setters {
- description = "All the set methods";
- method = "getByte(byte in)";
- method = "getShort(short in)";
- method = "getLong(long in)";
- method = "getFloat(float in)";
- method = "getDouble(double in)";
- method = "getBoolean(boolean in)";
- method = "getChar(char in)";
- method = "getByteArray(byte in[])";
- method = "getShortArray(short in[])";
- method = "getLongArray(long in[])";
- method = "getFloatArray(float in[])";
- method = "getDoubleArray(double in[])";
- method = "getBooleanArray(boolean in[])";
- method = "getCharArray(char in[])";
- method = "getByteList(List<Byte> in)";
- method = "getShortList(List<Short> in)";
- method = "getLongList(List<Long> in)";
- method = "getFloatList(List<Float> in)";
- method = "getDoubleList(List<Double> in)";
- method = "getBooleanList(List<Boolean> in)";
- method = "getCharList(List<Character> in)";
-
- method = "handleEnum(Enum en)";
- method = "handleEnumArray(Enum en[])";
- method = "handleEnumList(List<Enum> en)";
- method = "handleEnumComplex(Enum en, int i, char c)";
-
- method = "handleStruct(Struct str)";
- method = "handleStructArray(Struct str[])";
- method = "handleStructList(List<Struct> str)";
-
- method = "registerCallback(CallBackInterface _cb)";
- method = "registerCallbackArray(CallBackInterface _cb[])";
- method = "registerCallbackList(List<CallBackInterface> _cb)";
- method = "callBack()";
-
- method = "getA()";
- method = "setA(int _int)";
- method = "setB(float _float)";
- method = "setC(String _string)";
- }
-
- capability SetAndGets {
- description = "All the set-and-get methods";
- method = "sumArray(String newA[])";
- method = "setAndGetA(int newA)";
- method = "setACAndGetA(String newC, int newA)";
- }
-
- enum Enum {
-
- APPLE,
- ORANGE,
- GRAPE
- }
-
- struct Struct {
-
- string name;
- float value;
- int year;
- }
-}
-
-
+++ /dev/null
-public interface TestClassInterface {
-
- public Enum handleEnum(Enum en);
- public Enum[] handleEnumArray(Enum en[]);
- public List<Enum> handleEnumList(List<Enum> en);
- public Enum handleEnumComplex(Enum en, int i, char c);
- public Enum[] handleEnumComplex2(Enum en[], int in, char c);
- public Enum[] handleEnumTwo(Enum en1[], Enum en2[]);
-
- public Struct handleStruct(Struct str);
- public Struct[] handleStructArray(Struct str[]);
- public List<Struct> handleStructList(List<Struct> str);
- public Struct handleStructComplex(int in, char c, Struct str);
- public List<Struct> handleStructTwo(List<Struct> str1, List<Struct> str2);
- public List<Struct> handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3);
- public List<Struct> handleStructComplex2(int in, char c, Struct str[]);
-
- public Enum[] handleEnumStruct(Enum en[], List<Struct> str, char c);
-
- public void registerCallback(CallBackInterface _cb);
- public void registerCallbackArray(CallBackInterface _cb[]);
- public void registerCallbackList(List<CallBackInterface> _cb);
- public void registerCallbackComplex(int in, List<CallBackInterface> _cb, double db);
- public int callBack();
- public Enum[] handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb);
-
-
- public Enum[] handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb);
- public Enum[] handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2);
- public Enum[] handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2);
-
- capability EnumsStructs {
- description = "All the set methods";
-
- method = "handleEnum(Enum en)";
- method = "handleEnumArray(Enum en[])";
- method = "handleEnumList(List<Enum> en)";
- method = "handleEnumComplex(Enum en, int i, char c)";
- method = "handleEnumComplex2(Enum en[], int in, char c)";
- method = "handleEnumTwo(Enum en1[], Enum en2[])";
- method = "handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2)";
-
- method = "handleStruct(Struct str)";
- method = "handleStructArray(Struct str[])";
- method = "handleStructList(List<Struct> str)";
- method = "handleStructComplex(int in, char c, Struct str)";
- method = "handleStructComplex2(int in, char c, Struct str[])";
- method = "handleStructTwo(List<Struct> str1, List<Struct> str2)";
- method = "handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3)";
-
- method = "handleEnumStruct(Enum en[], List<Struct> str, char c)";
- method = "handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb)";
- method = "handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb)";
- method = "handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2)";
- }
-
- capability Callbacks {
- description = "All the set-and-get methods";
-
- method = "registerCallback(CallBackInterface _cb)";
- method = "registerCallbackArray(CallBackInterface _cb[])";
- method = "registerCallbackList(List<CallBackInterface> _cb)";
- method = "registerCallbackComplex(int in, List<CallBackInterface> _cb, double db)";
- method = "callBack()";
- }
-
- enum Enum {
-
- APPLE,
- ORANGE,
- GRAPE
- }
-
- struct Struct {
-
- string name;
- float value;
- int year;
- }
-}
-
-
+++ /dev/null
-
-requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete;
-
+++ /dev/null
-
-requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete;
-
include $(BASE)/common.mk
-all: tree parser compiler rmi
+all: tree parser compiler rmi runtime installer
+
+infra: runtime installer
# Parser compilation and run
PHONY += tree
PHONY += compiler
compiler:
$(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/*.java
- cp ../config/iotpolicy/*.pol $(BIN_DIR)/iotpolicy/
-PHONY += run-compiler
-run-compiler:
- #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler camerapolicy.pol camerarequires.pol lightbulbpolicy.pol lightbulbrequires.pol -cplus Cplus -java Java
- #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
+PHONY += run-compiler-dev
+run-compiler-dev:
+ cp ../localconfig/iotpolicy/development/*.pol $(BIN_DIR)/iotpolicy/
+ cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
-# Runtime system compilation
-PHONY += runtime
-runtime:
- $(JAVAC) -classpath . iotruntime/master/*.java -d $(BIN_DIR)
+PHONY += run-compiler-lifx
+run-compiler-lifx:
+ cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
+ cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
+ cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
# TODO: Can remove this later - just to test-compile the resulted files from the compiler
PHONY += compile
cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
-# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
-# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
-# cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
-# cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+ cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
+ cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
+ cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+ cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
PHONY += run-java-skeleton
rmi:
mkdir -p $(BIN_DIR)
$(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
-# $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
-# mkdir -p $(BIN_DIR)/iotrmi/C++
- #$(G++) iotrmi/C++/IoTSocketServer.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketServer.out
- #$(G++) iotrmi/C++/IoTSocketClient.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketClient.out
-# $(G++) iotrmi/C++/IoTRMICall.cpp -o $(BIN_DIR)/iotrmi/C++/IoTRMICall.out --std=c++11
-# $(G++) iotrmi/C++/IoTRMIObject.cpp -o $(BIN_DIR)/iotrmi/C++/IoTRMIObject.out --std=c++11
+ $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
mkdir -p $(BIN_DIR)/iotrmi/C++/sample
- #$(G++) iotrmi/C++/sample/CallBackInterface.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBackInterface.out --std=c++11
- #$(G++) iotrmi/C++/sample/CallBack.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack.out --std=c++11
-# $(G++) iotrmi/C++/sample/CallBack_CBStub.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBStub.out --std=c++11
-# $(G++) iotrmi/C++/sample/CallBack_CBSkeleton.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBSkeleton.out --std=c++11
-# $(G++) iotrmi/C++/sample/CallBack_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Stub.out --std=c++11
-# $(G++) iotrmi/C++/sample/CallBack_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Skeleton.out --std=c++11
- #$(G++) iotrmi/C++/sample/TestClass.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass.out --std=c++11
-# $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread -pg
-# $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg
- #$(G++) iotrmi/C++/sample/Test.cpp -o ../bin/iotrmi/C++/sample/Test.out --std=c++11 -lpthread
- #$(G++) iotrmi/C++/sample/Test2.cpp -o ../bin/iotrmi/C++/sample/Test2.out --std=c++11 -pthread -pg
-# $(G++) iotrmi/C++/sample/StructC.cpp -o ../bin/iotrmi/C++/sample/StructC.out --std=c++11
-# $(G++) iotrmi/C++/sample/EnumC.cpp -o ../bin/iotrmi/C++/sample/EnumC.out --std=c++11
-
+ $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread -pg
+ $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg
PHONY += run-rmiserver
run-rmiserver:
run-rmiclient:
$(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Stub
+PHONY += installer
+installer:
+ $(JAVAC) -d $(BIN_DIR) iotinstaller/*.java
+ cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/
+ cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/
+
+PHONY += runtime
+runtime:
+ $(JAVAC) -classpath .:$(RUNTIMEJARS):$(PHONEJARS):$(ZIPJARS) iotruntime/*.java iotruntime/master/*.java iotruntime/slave/*.java iotruntime/messages/*.java iotruntime/stub/*.java iotruntime/zigbee/*.java -d $(BIN_DIR)
+ cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/
+ cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/
+ cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/
+
PHONY += doc
-doc: iotruntime iotinstaller
- $(JAVADOC) -d $(DOCS_DIR) iotpolicy/*.java
+doc: runtime installer rmi compiler
+ $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java
.PHONY: $(PHONY)
DeclarationHandler decHandler = mapIntDeclHand.get(intface);
InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(intface);
// Pass in set of methods and get import classes
- List<String> methods = intDecl.getMethods();
+ Set<String> methods = intMeth.getValue();
Set<String> importClasses = getImportClasses(methods, intDecl);
List<String> stdImportClasses = getStandardJavaIntfaceImportClasses();
List<String> allImportClasses = getAllLibClasses(stdImportClasses, importClasses);
println("#define _" + newIntface.toUpperCase() + "_HPP__");
println("#include <iostream>");
// Pass in set of methods and get import classes
- Set<String> includeClasses = getIncludeClasses(intMeth.getValue(), intDecl, intface, false);
+ Set<String> methods = intMeth.getValue();
+ Set<String> includeClasses = getIncludeClasses(methods, intDecl, intface, false);
List<String> stdIncludeClasses = getStandardCplusIncludeClasses();
List<String> allIncludeClasses = getAllLibClasses(stdIncludeClasses, includeClasses);
printIncludeStatements(allIncludeClasses); println("");
println("{");
println("public:");
// Write methods
- writeMethodCplusInterface(intMeth.getValue(), intDecl);
+ writeMethodCplusInterface(methods, intDecl);
println("};");
println("#endif");
pw.close();
+++ /dev/null
-package iotruntime.brillo;
-
-// Google APIs
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.services.clouddevices.CloudDevices;
-import com.google.api.services.clouddevices.model.Device;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/** Abstract class IoTBrilloWeave that is the base of all
- * Brillo/Weave-communication-based class
- *
- * @author Rahmadi Trimananda <rtrimana @ uci.edu>
- * @version 1.0
- * @since 2016-06-08
- */
-public abstract class IoTBrilloWeave implements Remote {
-
- /**
- * Class IoTBrilloWeave properties
- */
- protected IoTBrilloWeaveCloudConnection iotCloudConnection;
- protected CloudDevices apiClient;
- protected Device device;
-
- /**
- * Class IoTBrilloWeave constants
- */
- protected final JacksonFactory jsonFactory = new JacksonFactory();
-
- /**
- * Class IoTBrilloWeave constructor
- */
- protected IoTBrilloWeave(String _clientId, String _clientSecret, String _apiKey, String _deviceId) {
-
- iotCloudConnection = new IoTBrilloWeaveCloudConnection(_clientId, _clientSecret, _apiKey);
- iotCloudConnection.connectionSetup(_deviceId);
- apiClient = iotCloudConnection.getApiClientObject();
- device = iotCloudConnection.getDeviceObject();
- }
-
- /**
- * setAuthScope() method to set authentication scope
- *
- * @return void
- */
- protected void setAuthScope(String _authScopeAddress) {
- iotCloudConnection.setAuthScope(_authScopeAddress);
- }
-}
+++ /dev/null
-package iotruntime.brillo;
-
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
-import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
-import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
-import com.google.api.client.googleapis.services.CommonGoogleClientRequestInitializer;
-import com.google.api.client.http.javanet.NetHttpTransport;
-import com.google.api.client.json.GenericJson;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.services.clouddevices.CloudDevices;
-import com.google.api.services.clouddevices.model.CloudDeviceChannel;
-import com.google.api.services.clouddevices.model.Command;
-import com.google.api.services.clouddevices.model.CommandDefNew;
-import com.google.api.services.clouddevices.model.Device;
-import com.google.api.services.clouddevices.model.DevicesListResponse;
-import com.google.api.services.clouddevices.model.RegistrationTicket;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** Class IoTBrilloWeaveCloudConnection provides basic APIs for
- * authorization on Google Brillo/Weave server
- *
- * @author Rahmadi Trimananda <rtrimana @ uci.edu>
- * @version 1.0
- * @since 2016-06-08
- */
-
-public class IoTBrilloWeaveCloudConnection {
-
- /**
- * Class LEDFlasherImplementation constants
- */
- private static final String AUTH_SCOPE = "https://www.googleapis.com/auth/clouddevices";
- private static final String REDIRECT_URL = "urn:ietf:wg:oauth:2.0:oob";
- private static final File CREDENTIALS_CACHE_FILE = new File("credentials_cache.json");
- private final NetHttpTransport httpTransport = new NetHttpTransport();
- private final JacksonFactory jsonFactory = new JacksonFactory();
-
- /**
- * Class LEDFlasherImplementation properties
- */
- private static String authScope;
- private static String clientID;
- private static String clientSecret;
- private static String apiKey;
- private CloudDevices apiClient;
- private Device device;
-
- /**
- * Class LEDFlasherImplementation constructor
- */
- public IoTBrilloWeaveCloudConnection(String _clientId, String _clientSecret, String _apiKey) {
- clientID = _clientId;
- clientSecret = _clientSecret;
- apiKey = _apiKey;
- authScope = AUTH_SCOPE;
- apiClient = null;
- device = null;
- }
-
- /**
- * setAuthScope() method to set authentication scope
- *
- * @return void
- */
- public void setAuthScope(String _authScopeAddress) {
- authScope = "https://" + _authScopeAddress + "/auth/clouddevices";
- }
-
- /**
- * getApiClient() method to authorize and get access to client API
- *
- * @return CloudDevices
- */
- private CloudDevices getApiClient() throws IOException {
- // Try to load cached credentials.
- GoogleCredential credential = getCachedCredential();
- if (credential == null) {
- System.out.println("Did not find cached credentials");
- credential = authorize();
- }
- return new CloudDevices.Builder(httpTransport, jsonFactory, credential)
- .setApplicationName("Weave Sample")
- .setServicePath("clouddevices/v1")
- .setGoogleClientRequestInitializer(new CommonGoogleClientRequestInitializer(apiKey))
- .build();
- }
-
- /**
- * authorize() to authorize client access
- * <p>
- * This function checks credential file and create one if there isn't any yet
- *
- * @return GoogleCredential
- */
- private GoogleCredential authorize() throws IOException {
- String authorizationUrl = new GoogleAuthorizationCodeRequestUrl(
- clientID, REDIRECT_URL, Collections.singleton(authScope)).build();
- // Direct user to the authorization URI.
- System.out.println("Go to the following link in your browser:");
- System.out.println(authorizationUrl);
- // Get authorization code from user.
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("What is the authorization code?");
- String authorizationCode = in.readLine();
-
- // Use the authorization code to get an access token and a refresh token.
- GoogleTokenResponse response = new GoogleAuthorizationCodeTokenRequest(
- httpTransport, jsonFactory, clientID, clientSecret, authorizationCode,
- REDIRECT_URL).execute();
- cacheCredential(response.getRefreshToken());
- // Use the access and refresh tokens to set up credentials.
- GoogleCredential credential = new GoogleCredential.Builder()
- .setJsonFactory(jsonFactory)
- .setTransport(httpTransport)
- .setClientSecrets(clientID, clientSecret)
- .build()
- .setFromTokenResponse(response);
- return credential;
- }
-
- /**
- * getCachedCredential() to try to read credential from file
- *
- * @return GoogleCredential
- */
- private GoogleCredential getCachedCredential() {
- try {
- return GoogleCredential.fromStream(new FileInputStream(CREDENTIALS_CACHE_FILE));
- } catch (IOException e) {
- return null;
- }
- }
-
- /**
- * cacheCredential() to create a cache credential file
- * <p>
- * This function checks credential file and create one if there isn't any yet
- *
- * @param refreshToken String value for refresh_token field
- * @return GoogleCredential
- */
- private void cacheCredential(String refreshToken) {
- GenericJson json = new GenericJson();
- json.setFactory(jsonFactory);
- json.put("client_id", clientID);
- json.put("client_secret", clientSecret);
- json.put("refresh_token", refreshToken);
- json.put("type", "authorized_user");
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(CREDENTIALS_CACHE_FILE);
- out.write(json.toPrettyString().getBytes(Charset.defaultCharset()));
- } catch (IOException e) {
- System.err.println("Error caching credentials");
- e.printStackTrace();
- } finally {
- if (out != null) {
- try { out.close(); } catch (IOException e) { /* Ignore. */ }
- }
- }
- }
-
- /**
- * authorize() to authorize client access
- * <p>
- * This function checks credential file and create one if there isn't any yet
- *
- * @param deviceId String value device ID for connection setup
- * @return void
- */
- public void connectionSetup(String deviceId) {
-
- //CloudDevices apiClient;
- try {
- apiClient = getApiClient();
- } catch (IOException ex) { throw new RuntimeException("Could not get API client", ex); }
-
- DevicesListResponse devicesListResponse;
- try {
- devicesListResponse = apiClient.devices().list().execute();
- } catch (IOException e) { throw new RuntimeException("Could not list devices", e); }
- List<Device> devices = devicesListResponse.getDevices();
- //Device device;
- if (devices == null || devices.isEmpty()) {
- throw new Error("List of device is empty! Please register your device on Google Weave Developers website!");
- } else {
- // Choose device based on device ID
- for (Device dev : devices) {
- if (dev.getId().equals(deviceId)) {
- device = dev;
- break;
- }
- }
- //device = devices.get(0);
- }
-
- System.out.println("Available device: " + device.getId());
-
- try {
- System.out.println("Command definitions:\n" + jsonFactory.toPrettyString(device.getCommandDefs()));
- } catch (IOException e) { throw new RuntimeException(e); }
- }
-
-
- /**
- * getApiClientObject() to return API client object
- *
- * @return void
- */
- public CloudDevices getApiClientObject() {
- return apiClient;
- }
-
-
- /**
- * getDeviceObject() to return device object
- *
- * @return void
- */
- public Device getDeviceObject() {
- return device;
- }
-
-
- public static void main(String[] args) {
-
- String clientId = "627170482755-4l2gd5m3lf6ej674vqr8sdc14gmeva3e.apps.googleusercontent.com";
- String clientSecret = "Yhj6QzCxeO2B0i25JHqYShsi";
- String apiKey = "AIzaSyDcYp9RQAV2ELZWxVIjPBAzIPGiXAAORs0";
-
- IoTBrilloWeaveCloudConnection iotBrillo = new IoTBrilloWeaveCloudConnection(clientId, clientSecret, apiKey);
- iotBrillo.connectionSetup("77173ed5-3303-4c54-f852-b8f51fb7b31f");
- }
-}
+++ /dev/null
-package iotruntime.brillo;
-
-// Java libraries
-import java.io.BufferedWriter;
-import java.io.PrintWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.lang.Class;
-import java.lang.reflect.*;
-import java.util.Map;
-
-// Google APIs
-import com.google.api.services.clouddevices.model.CommandDefNew;
-import com.google.api.services.clouddevices.model.Device;
-
-
-/** IoTBrilloWeaveCodeGenerator class that connects to
- * Google Brillo/Weave server based on user's credentials
- * and creates user's class and interface
- * <p>
- * Steps:
- * 0) Compile iotruntime
- * 1) Run this code generator
- * - go to $(IOTJAVA_CLASSPATH)/iot/bin/iotruntime/brillo/
- * - run this class with this command line:
- * java -cp .:../../:../../../jars/brillo/*:../../../jars/brillo/libs/* iotruntime.brillo.IoTBrilloWeaveCodeGenerator -help
- * - follow the instructions to generate codes
- * 2) If credentials_cache.json hasn't been created then one will be created
- * 3) Both interface and implementation java API source files will be created
- * 4) We can move them to the right directories with the credentials_cache.json
- * - move the interface java file into folder "interfaces"
- * - create a folder in "iot/benchmarks/drivers" with the class name and put
- * the class java file there; don't forget to create <class>.config file
- * and modify the Makefile
- * 5) A device driver can be created based on the created API's
- *
- * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
- * @version 1.0
- * @since 2016-06-09
- */
-public class IoTBrilloWeaveCodeGenerator {
-
- /**
- * IoTBrilloWeaveCodeGenerator properties
- */
- private PrintWriter pw;
- private String strInterfaceName;
- private String strClassName;
- private IoTBrilloWeaveCloudConnection iotBrillo;
-
- /**
- * Constructor
- */
- public IoTBrilloWeaveCodeGenerator(String[] strArgs) {
-
- this.strInterfaceName = strArgs[0];
- this.strClassName = strArgs[1];
- this.iotBrillo = new IoTBrilloWeaveCloudConnection(strArgs[2], strArgs[3], strArgs[4]);
- this.iotBrillo.connectionSetup(strArgs[5]);
- }
-
-
- /**
- * Generate interface
- *
- * @return void
- */
- public void generateInterface() throws IOException {
-
- // Initialize FileWriter and PrintWriter
- FileWriter fwInterface = new FileWriter(strInterfaceName + ".java");
- this.pw = new PrintWriter(new BufferedWriter(fwInterface));
- // Write the interface header
- generateInterfaceImports();
- println("");
- println("public interface " + strInterfaceName + " extends Remote {");
- println("");
- generateInterfaceBody(this.iotBrillo.getDeviceObject());
- println("");
- //Close interface
- println("}");
- pw.close();
- }
-
-
- /**
- * Generate interface import statements
- *
- * @return void
- */
- public void generateInterfaceInit() {
- println("public void init() throws RemoteException;");
- }
-
-
- /**
- * Generate interface init method
- *
- * @return void
- */
- public void generateInterfaceImports() {
- println("package iotcode.interfaces;");
- println("");
- println("import java.rmi.Remote;");
- println("import java.rmi.RemoteException;");
- }
-
-
- /**
- * Generate interface body
- *
- * @param device Device object that contains JSON parameters
- * @return void
- */
- private void generateInterfaceBody(Device device) {
-
- generateInterfaceInit();
- Map<String,Map<String,CommandDefNew>> mapCommand = device.getCommandDefs();
- for(String strCmd : mapCommand.keySet()) {
- Map<String,CommandDefNew> mapSubCommand = mapCommand.get(strCmd);
- for(String strSubCmd : mapSubCommand.keySet()) {
- print("public void " + strCmd + "_" + strSubCmd + "(");
- CommandDefNew cmd = mapSubCommand.get(strSubCmd);
- if (cmd.getParameters() != null) {
- // If we have parameters ...
- int iParamCount = 0;
- Map<String,Map<String,Object>> mapParam = cmd.getParameters();
- for (String strParamName : mapParam.keySet()) {
- iParamCount++;
- Map<String,Object> mapParamProp = mapParam.get(strParamName);
- for (String strParamProp : mapParamProp.keySet()) {
- if (strParamProp.equals("type")) {
- print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
- if (iParamCount == mapParam.size())
- println(strParamName + ") throws RemoteException;");
- else
- print(strParamName + ", ");
- }
- }
- }
- } else {
- // If we don't have parameters ...
- println(") throws RemoteException;");
- }
- }
- }
- }
-
-
- /**
- * Type translator from JSON syntax to Java
- *
- * @return String
- */
- private String getJavaType(String strJsonType) {
-
- if (strJsonType.equals("string")) {
- return "String";
- } else if (strJsonType.equals("integer")) {
- return "Integer";
- } else if (strJsonType.equals("boolean")) {
- return "Boolean";
- } else if (strJsonType.equals("number")) {
- return "Float";
- } else { // NULL is returned when type is not recognized
- return null;
- }
- }
-
-
- /**
- * Generate class
- *
- * @return void
- */
- public void generateClass() throws IOException {
-
- // Initialize FileWriter and PrintWriter
- FileWriter fwClass = new FileWriter(strClassName + ".java");
- this.pw = new PrintWriter(new BufferedWriter(fwClass));
- // Write the import statements
- generateImports();
- println("");
- println("public class " + strClassName +
- " extends IoTBrilloWeave" +
- " implements " + strInterfaceName + " {");
- println("");
- generateAtConfigs();
- println("");
- generateConstructor();
- println("");
- generateInit();
- println("");
- generateClassAPIs(this.iotBrillo.getDeviceObject());
- //Close class
- println("}");
- pw.close();
- }
-
-
- /**
- * Generate @config statements for IoTDeviceAddress
- *
- * @return void
- */
- public void generateAtConfigs() {
-
- println("@config private IoTSet<IoTAddress> GoogleAccountAddress;");
- println("@config private IoTSet<IoTAddress> GoogleAPIsAddress;");
- }
-
-
- /**
- * Generate init method
- *
- * @return void
- */
- public void generateInit() {
-
- println("public void init() {");
- println("Iterator itr = GoogleAccountAddress.iterator();");
- println("IoTAddress address = (IoTAddress)itr.next();");
- println("super.setAuthScope(address.getHostName());");
- println("}");
- }
-
-
- /**
- * Generate class APIs
- *
- * @param device Device object that contains JSON parameters
- * @return void
- */
- private void generateClassAPIs(Device device) {
-
- // Generate method header
- Map<String,Map<String,CommandDefNew>> mapCommand = device.getCommandDefs();
- for(String strCmd : mapCommand.keySet()) {
- Map<String,CommandDefNew> mapSubCommand = mapCommand.get(strCmd);
- for(String strSubCmd : mapSubCommand.keySet()) {
- print("public void " + strCmd + "_" + strSubCmd + "(");
- CommandDefNew cmd = mapSubCommand.get(strSubCmd);
- boolean doesParamExist = false;
- if (cmd.getParameters() != null) {
- // If we have parameters ...
- doesParamExist = true;
- int iParamCount = 0;
- Map<String,Map<String,Object>> mapParam = cmd.getParameters();
- for (String strParamName : mapParam.keySet()) {
- iParamCount++;
- Map<String,Object> mapParamProp = mapParam.get(strParamName);
- for (String strParamProp : mapParamProp.keySet()) {
- if (strParamProp.equals("type")) {
- print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
- if (iParamCount == mapParam.size())
- println(strParamName + ") {");
- else
- print(strParamName + ", ");
- }
- }
- }
- } else {
- // If we don't have parameters ...
- println(") {");
- }
- generateMethodBody(cmd, doesParamExist, strCmd, strSubCmd);
- generateCommandInsertionAndException();
- println("}");
- println("");
- }
- }
- }
-
-
- /**
- * Generate method body
- *
- * @param cmd Object CommandDefNew that contains information about the command
- * @param doesParamExist Boolean that tracks if the method has parameters
- * @param strCmd String that contains the main command name
- * @param strSubCmd String that contains the sub command name
- * @return void
- */
- private void generateMethodBody(CommandDefNew cmd, boolean doesParamExist, String strCmd, String strSubCmd) {
-
- if (doesParamExist) {
- // If we have parameters ...
- //int iParamCount = 0;
- println("Map<String, Object> parameters = new HashMap<String, Object>();");
- Map<String,Map<String,Object>> mapParam = cmd.getParameters();
- for (String strParamName : mapParam.keySet()) {
- //iParamCount++;
- Map<String,Object> mapParamProp = mapParam.get(strParamName);
- for (String strParamProp : mapParamProp.keySet()) {
- if (strParamProp.equals("type")) {
- //print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
- println("parameters.put(\"" + strParamName + "\", " + strParamName + ");");
- }
- }
- }
- }
- println("Command command = new Command()");
- println("\t.setName(\"" + strCmd + "." + strSubCmd + "\")");
- if (doesParamExist)
- println("\t.setParameters(parameters)");
- println("\t.setDeviceId(device.getId());");
- }
-
-
- /**
- * Generate command insertion and exception statements
- *
- * @return void
- */
- private void generateCommandInsertionAndException() {
- println("try {");
- println("command = apiClient.commands().insert(command).execute(); }");
- println("catch (IOException e) {");
- println("throw new RuntimeException(\"Could not insert command\", e); }");
- println("");
- println("try {");
- println("System.out.println(\"Sent command to the device:\" + jsonFactory.toPrettyString(command)); }");
- println("catch (IOException e) {");
- println("throw new RuntimeException(e); }");
- }
-
-
- /**
- * Generate import statements
- *
- * @return void
- */
- private void generateImports() {
-
- println("package iotcode." + strClassName + ";");
- println("");
- println("import com.google.api.client.json.jackson2.JacksonFactory;");
- println("import com.google.api.services.clouddevices.CloudDevices;");
- println("import com.google.api.services.clouddevices.model.Command;");
- println("import com.google.api.services.clouddevices.model.Device;");
- println("");
- println("import java.io.IOException;");
- println("import java.util.HashMap;");
- println("import java.util.Iterator;");
- println("import java.util.Map;");
- println("");
- println("import iotcode.interfaces.LEDFlasher;");
- println("import iotruntime.brillo.IoTBrilloWeave;");
- println("import iotruntime.brillo.IoTBrilloWeaveCloudConnection;");
- println("import iotruntime.slave.IoTAddress;");
- println("import iotruntime.slave.IoTSet;");
- println("import iotchecker.qual.*;");
- }
-
-
- /**
- * Generate constructor
- *
- * @return void
- */
- private void generateConstructor() {
- // Write the constructor
- println("public " + strClassName +
- "(String _clientId, String _clientSecret, String _apiKey, String _deviceId) {");
- println("super(_clientId, _clientSecret, _apiKey, _deviceId);");
- println("}");
- }
-
-
- /**
- * Display help message
- *
- * @return void
- */
- public static void displayHelpMessage() {
- System.out.println();
- System.out.println("Please use this code generator in the following syntax:");
- System.out.print("java -cp <classpath> IoTBrilloWeaveCodeGenerator <interface_name> ");
- System.out.println("<class_name> <client_id> <client_secret> <api_key> <device_id>");
- System.out.println("e.g.");
- System.out.print("java -cp .:../clouddevices/*:../clouddevices/libs/* IoTBrilloWeaveCodeGenerator ");
- System.out.print("LEDFlasherTest LEDFlasherTestImplementation 627170482755-4l2gd5m3lf6ej674vqr8sdc14gmeva3e.apps.googleusercontent.com ");
- System.out.println("Yhj6QzCxeO2B0i25JHqYShsi AIzaSyDcYp9RQAV2ELZWxVIjPBAzIPGiXAAORs0 77173ed5-3303-4c54-f852-b8f51fb7b31f");
- System.out.println();
- System.out.println("To show this help message: java IoTBrilloWeaveCodeGenerator --help");
- System.out.println();
- }
-
-
- /**
- * Helper functions that help print to files
- */
- boolean newline=true;
- int tablevel=0;
-
- private void print(String str) {
- if (newline) {
- int tab=tablevel;
- if (str.equals("}"))
- tab--;
- for(int i=0; i<tab; i++)
- pw.print("\t");
- }
- pw.print(str);
- updatetabbing(str);
- newline=false;
- }
-
- private void println(String str) {
- if (newline) {
- int tab = tablevel;
- if (str.equals("}"))
- tab--;
- for(int i=0; i<tab; i++)
- pw.print("\t");
- }
- pw.println(str);
- updatetabbing(str);
- newline = true;
- }
-
- private void updatetabbing(String str) {
- tablevel += count(str,'{') - count(str,'}');
- }
-
- private int count(String str, char key) {
- char[] array = str.toCharArray();
- int count = 0;
- for(int i=0; i<array.length; i++) {
- if (array[i] == key)
- count++;
- }
- return count;
- }
-
-
- /**
- * Call main function for file generations
- *
- * @param args[0] Interface name
- * @param args[1] Class name
- * @param args[2] Client ID
- * @param args[3] Client secret
- * @param args[4] API key
- * @param args[5] Device ID
- */
- public static void main(String[] args) throws IOException {
-
- if(args.length < 6 || args[0].contains("help")) {
- displayHelpMessage();
- } else {
- IoTBrilloWeaveCodeGenerator iotBrilloCodeGen = new IoTBrilloWeaveCodeGenerator(args);
- iotBrilloCodeGen.generateInterface();
- iotBrilloCodeGen.generateClass();
- }
- }
-}
+++ /dev/null
-{
- "client_id" : "627170482755-mu1kmvsm0d5tmnjgnuafi0ju9aoc5ke3.apps.googleusercontent.com",
- "client_secret" : "ffUz8PygD7pwus_4wjwS6x2Z",
- "refresh_token" : "1/YcIkx5DxvT0YKpvmdKW6mlyGn5HenpbqgJRQ7AH2xVY",
- "type" : "authorized_user"
-}
\ No newline at end of file
* 5) Initialize the field of the instrumented class objects with actual field objects
* 6) Run the init() function of the instrumented class
*
- * @param typeRef int
- * @param typePath TypePath
* @param desc String
* @param visible boolean
* @return AnnotationVisitor
* This method visits annotation that is meta-annotated as TYPE_USE, so we can instrument @config here
*/
@Override
- public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath,
- String desc, boolean visible) {
+ public AnnotationVisitor visitAnnotation(String desc,
+ boolean visible) {
- //RuntimeOutput.print("ClassRuntimeInstrumenterMaster@AnnotationTypeVisitor: " + desc, bVerbose);
+ //RuntimeOutput.print("ClassRuntimeInstrumenterMaster@AnnotationVisitor: " + desc, bVerbose);
// Check annotation description @config
if(desc.equals(STR_IOT_ANNOTATION_SIGNATURE)) {
throw new Error("ClassRuntimeInstrumenterMaster@AnnotationTypeVisitor: " + strFieldDesc + " not recognized!");
}
}
- return super.visitTypeAnnotation(typeRef, typePath, desc, visible);
+ return super.visitAnnotation(desc, visible);
}
}
--- /dev/null
+LW1 GreenLawnLW1
+CM1 AmcrestCameraCM1
+WRITE
--- /dev/null
+LW1 GreenLawnLW1
+SS1 SpruceSensorSS1
+WRITE
--- /dev/null
+LW1 GreenLawnLW1
+SP1 EspSprinklerSP1
+WRITE
--- /dev/null
+RM2 RoomTwo
+CM2 AmcrestCameraTwo
+WRITE
--- /dev/null
+RM2 RoomTwo
+LB2 LifxLightBulbTwo
+WRITE
--- /dev/null
+RM4 AudioRoomRM4
+SK2 DummySpeakerSK2
+WRITE
--- /dev/null
+ID=GB2
+ADDRESSFOR=GoogleBrilloWeave
+ADDRESS=www.googleapis.com
+END
--- /dev/null
+
+IoTMain
+ID CM3
+TYPE Camera
+TYPESPECIFIC AmcrestCamera
+END
+
+Table 2
+USERNAME VARCHAR 20
+PASSWORD VARCHAR 20
+END
+
+Data
+admin
+55779CatSoundz35
+END
+
--- /dev/null
+
+IoTMain
+ID RM4
+TYPE Room
+TYPESPECIFIC AudioRoom
+END
+
+Table 1
+ROOMID INT 11
+END
+
+Data
+1
+END
+
+
--- /dev/null
+
+IoTMain
+ID BW1
+TYPE LEDFlasher
+TYPESPECIFIC BrilloLEDFlasher
+END
+
+Table 4
+CLIENTID VARCHAR 100
+CLIENTSECRET VARCHAR 50
+APIKEY VARCHAR 50
+DEVICEID VARCHAR 50
+END
+
+Data
+627170482755-mu1kmvsm0d5tmnjgnuafi0ju9aoc5ke3.apps.googleusercontent.com
+ffUz8PygD7pwus_4wjwS6x2Z
+AIzaSyCE9-pbnCBYNCvhcsw18Am-Negs6wMiD5Y
+87901f05-7b02-6fc1-a023-66de2a18192a
+END
+
--- /dev/null
+ID=SP2
+ADDRESSFOR=BlossomSprinklerAdd2
+DEVICEADDRESS=00:00:00:00:00:00
+PORTNUMBER=80
+PROTOCOL=nopro
+END
--- /dev/null
+ID=SK2
+ADDRESSFOR=IHomeAdd5
+DEVICEADDRESS=c8:d5:fe:e6:a2:d8
+#DEVICEADDRESS=00:00:00:00:00:00
+# For wildcard we don't put a specific port number
+# Policies are in place to regulate traffic based on just IP addresses
+# of the driver and the device
+PORTNUMBER=-1
+PROTOCOL=udp
+SOURCEWILDCARD=false
+DESTWILDCARD=true
+END
--- /dev/null
+
+IoTComputeNode
+HOSTADDRESS=dw-2.eecs.uci.edu
+PROCESSOR=3400
+MEMORY=32
+END
--- /dev/null
+
+IoTMain
+ID LW1
+TYPE Lawn
+TYPESPECIFIC GreenLawn
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+
+IoTMain
+ID LB2
+TYPE LightBulb
+TYPESPECIFIC LifxLightBulb
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+
+IoTMain
+ID GG1
+TYPE GPSGateway
+TYPESPECIFIC GPSPhoneGateway
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+
+IoTMain
+ID RM2
+TYPE Room
+TYPESPECIFIC RoomTwo
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+
+IoTMain
+ID SK2
+TYPE Speaker
+TYPESPECIFIC IHome
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+
+IoTMain
+ID SP2
+TYPE Sprinkler
+TYPESPECIFIC BlossomSprinkler
+END
+
+Table 1
+CHANNELID VARCHAR 20
+END
+
+Data
+ABCDE
+END
+
--- /dev/null
+
+IoTMain
+ID SS1
+TYPE MoistureSensor
+TYPESPECIFIC SpruceSensor
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
--- /dev/null
+ID=SS1
+ADDRESSFOR=SpruceSensorZBAdd
+DEVICEADDRESS=00:0d:6f:00:03:eb:f2:ee
+END
--- /dev/null
+public interface LightBulb {
+
+ public void init();
+ public void turnOff();
+ public void turnOn();
+ public boolean getState();
+ public void setColor(double _hue, double _saturation, double _brightness);
+ public void setTemperature(int _temperature);
+ public double getBrightness();
+ public double getHue();
+ public double getSaturation();
+ public int getTemperature();
+ public double getBrightnessRangeLowerBound();
+ public double getBrightnessRangeUpperBound();
+ public double getHueRangeLowerBound();
+ public double getHueRangeUpperBound();
+ public double getSaturationRangeLowerBound();
+ public double getSaturationRangeUpperBound();
+ public int getTemperatureRangeLowerBound();
+ public int getTemperatureRangeUpperBound();
+
+ capability Initialize {
+ description = "Initialize object";
+ method = "init()";
+ }
+
+ capability Power {
+ description = "Turn on/off";
+ method = "turnOff()";
+ method = "turnOn()";
+ method = "getState()";
+ }
+
+ capability SetColorProperties {
+ description = "Get color properties";
+ method = "setColor(double _hue, double _saturation, double _brightness)";
+ method = "setTemperature(int _temperature)";
+ }
+
+ capability GetColorProperties {
+ description = "Set color properties";
+ method = "getBrightness()";
+ method = "getHue()";
+ method = "getSaturation()";
+ method = "getTemperature()";
+ }
+
+ capability GetColorPropertiesRange {
+ description = "Get upper and lower bounds of color properties";
+ method = "setColor(double _hue, double _saturation, double _brightness)";
+ method = "getBrightnessRangeLowerBound()";
+ method = "getBrightnessRangeUpperBound()";
+ method = "getHueRangeLowerBound()";
+ method = "getHueRangeUpperBound()";
+ method = "getSaturationRangeLowerBound()";
+ method = "getSaturationRangeUpperBound()";
+ method = "getTemperatureRangeLowerBound()";
+ method = "getTemperatureRangeUpperBound()";
+ }
+}
+
+
--- /dev/null
+
+requires LightBulb with Initialize, Power, SetColorProperties, GetColorProperties as interface LightBulbTest;
+
--- /dev/null
+public interface CallBackInterface {
+
+ public int printInt();
+ public void setInt(int _i);
+
+ capability CallBack {
+ description = "The quick brown fox jumps over the smart dog";
+ description = "Another description";
+ method = "printInt()";
+ method = "setInt(int _i)";
+ }
+}
+
+
--- /dev/null
+
+requires CallBackInterface with CallBack as interface CallBackInterfaceWithCallBack;
+
--- /dev/null
+public interface Camera {
+
+ public List<Float> MethodA(int A, int B);
+ public void MethodA(int A, int B, int AB);
+ public int MethodB(int C, String D[]);
+ public String MethodC(String E, List<Integer> F);
+ public float MethodD(List<String> G, float H);
+ public boolean MethodE(String I, boolean J);
+ public void MethodF(LightBulb K);
+ public Enum MethodG(Enum L);
+ public Struct MethodH(Struct M, int N);
+
+ capability ImageCapture {
+ description = "The quick brown fox jumps over the smart dog";
+ description = "Another description";
+ method = "MethodA(int A, int B)";
+ method = "MethodB(int C, String D[])";
+ method = "MethodC(String E, List<Integer> F)";
+ method = "MethodF(LightBulb K)";
+ method = "MethodG(Enum L)";
+ method = "MethodH(Struct M, int N)";
+ }
+
+ capability VideoRecording {
+ description = "The quick brown fox jumps over the cool dog";
+ method = "MethodA(int A, int B)";
+ method = "MethodA(int A, int B, int AB)";
+ method = "MethodD(List<String> G, float H)";
+ }
+
+ capability BackupData {
+ description = "The quick brown fox jumps over the clever dog";
+ method = "MethodE(String I, boolean J)";
+ }
+
+ struct Struct {
+
+ string name;
+ float value;
+ int year;
+ }
+}
+
+
--- /dev/null
+
+requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData;
+
--- /dev/null
+
+enum Enum {
+
+ APPLE,
+ ORANGE,
+ GRAPE
+}
--- /dev/null
+public interface LightBulb {
+
+ public void MethodA(int A, float B);
+ public void MethodA(int A, float B, int AB);
+ public int MethodB(String C, String D);
+ public byte MethodC(String E, List<Integer> F);
+
+ capability Flicker {
+ description = "The quick brown fox jumps over the smart dog";
+ description = "Another description";
+ method = "MethodA(int A, float B)";
+ method = "MethodB(String C, String D)";
+ method = "MethodC(String E, List<Integer> F)";
+ }
+
+ capability AutoOnOff {
+ description = "The quick brown fox jumps over the cool dog";
+ method = "MethodA(int A, float B)";
+ method = "MethodA(int A, float B, int AB)";
+ method = "MethodC(String E, List<Integer> F)";
+ }
+
+ enum Enum {
+
+ APPLE,
+ ORANGE,
+ GRAPE,
+ MANGO
+ }
+}
+
+
--- /dev/null
+
+requires LightBulb with Flicker as interface LightBulbWithFlicker;
+
--- /dev/null
+
+struct Struct {
+
+ string name;
+ float value;
+ int year;
+}
--- /dev/null
+public interface TestClassInterface {
+
+ public byte getByte(byte in);
+ public short getShort(short in);
+ public long getLong(long in);
+ public float getFloat(float in);
+ public double getDouble(double in);
+ public boolean getBoolean(boolean in);
+ public char getChar(char in);
+
+ public byte[] getByteArray(byte in[]);
+ public short[] getShortArray(short in[]);
+ public long[] getLongArray(long in[]);
+ public float[] getFloatArray(float in[]);
+ public double[] getDoubleArray(double in[]);
+ public boolean[] getBooleanArray(boolean in[]);
+ public char[] getCharArray(char in[]);
+
+ public List<Byte> getByteList(List<Byte> in);
+ public List<Short> getShortList(List<Short> in);
+ public List<Long> getLongList(List<Long> in);
+ public List<Float> getFloatList(List<Float> in);
+ public List<Double> getDoubleList(List<Double> in);
+ public List<Boolean> getBooleanList(List<Boolean> in);
+ public List<Character> getCharList(List<Character> in);
+
+ public Enum handleEnum(Enum en);
+ public Enum[] handleEnumArray(Enum en[]);
+ public List<Enum> handleEnumList(List<Enum> en);
+ public Enum handleEnumComplex(Enum en, int i, char c);
+
+ public Struct handleStruct(Struct str);
+ public Struct[] handleStructArray(Struct str[]);
+ public List<Struct> handleStructList(List<Struct> str);
+
+ public void registerCallback(CallBackInterface _cb);
+ public void registerCallbackArray(CallBackInterface _cb[]);
+ public void registerCallbackList(List<CallBackInterface> _cb);
+ public int callBack();
+
+ public int getA();
+ public void setA(int _int);
+ public void setB(float _float);
+ public void setC(String _string);
+ public String sumArray(String newA[]);
+ public int setAndGetA(int newA);
+ public int setACAndGetA(String newC, int newA);
+
+ capability Setters {
+ description = "All the set methods";
+ method = "getByte(byte in)";
+ method = "getShort(short in)";
+ method = "getLong(long in)";
+ method = "getFloat(float in)";
+ method = "getDouble(double in)";
+ method = "getBoolean(boolean in)";
+ method = "getChar(char in)";
+ method = "getByteArray(byte in[])";
+ method = "getShortArray(short in[])";
+ method = "getLongArray(long in[])";
+ method = "getFloatArray(float in[])";
+ method = "getDoubleArray(double in[])";
+ method = "getBooleanArray(boolean in[])";
+ method = "getCharArray(char in[])";
+ method = "getByteList(List<Byte> in)";
+ method = "getShortList(List<Short> in)";
+ method = "getLongList(List<Long> in)";
+ method = "getFloatList(List<Float> in)";
+ method = "getDoubleList(List<Double> in)";
+ method = "getBooleanList(List<Boolean> in)";
+ method = "getCharList(List<Character> in)";
+
+ method = "handleEnum(Enum en)";
+ method = "handleEnumArray(Enum en[])";
+ method = "handleEnumList(List<Enum> en)";
+ method = "handleEnumComplex(Enum en, int i, char c)";
+
+ method = "handleStruct(Struct str)";
+ method = "handleStructArray(Struct str[])";
+ method = "handleStructList(List<Struct> str)";
+
+ method = "registerCallback(CallBackInterface _cb)";
+ method = "registerCallbackArray(CallBackInterface _cb[])";
+ method = "registerCallbackList(List<CallBackInterface> _cb)";
+ method = "callBack()";
+
+ method = "getA()";
+ method = "setA(int _int)";
+ method = "setB(float _float)";
+ method = "setC(String _string)";
+ }
+
+ capability SetAndGets {
+ description = "All the set-and-get methods";
+ method = "sumArray(String newA[])";
+ method = "setAndGetA(int newA)";
+ method = "setACAndGetA(String newC, int newA)";
+ }
+
+ enum Enum {
+
+ APPLE,
+ ORANGE,
+ GRAPE
+ }
+
+ struct Struct {
+
+ string name;
+ float value;
+ int year;
+ }
+}
+
+
--- /dev/null
+public interface TestClassInterface {
+
+ public Enum handleEnum(Enum en);
+ public Enum[] handleEnumArray(Enum en[]);
+ public List<Enum> handleEnumList(List<Enum> en);
+ public Enum handleEnumComplex(Enum en, int i, char c);
+ public Enum[] handleEnumComplex2(Enum en[], int in, char c);
+ public Enum[] handleEnumTwo(Enum en1[], Enum en2[]);
+
+ public Struct handleStruct(Struct str);
+ public Struct[] handleStructArray(Struct str[]);
+ public List<Struct> handleStructList(List<Struct> str);
+ public Struct handleStructComplex(int in, char c, Struct str);
+ public List<Struct> handleStructTwo(List<Struct> str1, List<Struct> str2);
+ public List<Struct> handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3);
+ public List<Struct> handleStructComplex2(int in, char c, Struct str[]);
+
+ public Enum[] handleEnumStruct(Enum en[], List<Struct> str, char c);
+
+ public void registerCallback(CallBackInterface _cb);
+ public void registerCallbackArray(CallBackInterface _cb[]);
+ public void registerCallbackList(List<CallBackInterface> _cb);
+ public void registerCallbackComplex(int in, List<CallBackInterface> _cb, double db);
+ public int callBack();
+ public Enum[] handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb);
+
+
+ public Enum[] handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb);
+ public Enum[] handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2);
+ public Enum[] handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2);
+
+ capability EnumsStructs {
+ description = "All the set methods";
+
+ method = "handleEnum(Enum en)";
+ method = "handleEnumArray(Enum en[])";
+ method = "handleEnumList(List<Enum> en)";
+ method = "handleEnumComplex(Enum en, int i, char c)";
+ method = "handleEnumComplex2(Enum en[], int in, char c)";
+ method = "handleEnumTwo(Enum en1[], Enum en2[])";
+ method = "handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2)";
+
+ method = "handleStruct(Struct str)";
+ method = "handleStructArray(Struct str[])";
+ method = "handleStructList(List<Struct> str)";
+ method = "handleStructComplex(int in, char c, Struct str)";
+ method = "handleStructComplex2(int in, char c, Struct str[])";
+ method = "handleStructTwo(List<Struct> str1, List<Struct> str2)";
+ method = "handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3)";
+
+ method = "handleEnumStruct(Enum en[], List<Struct> str, char c)";
+ method = "handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb)";
+ method = "handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb)";
+ method = "handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2)";
+ }
+
+ capability Callbacks {
+ description = "All the set-and-get methods";
+
+ method = "registerCallback(CallBackInterface _cb)";
+ method = "registerCallbackArray(CallBackInterface _cb[])";
+ method = "registerCallbackList(List<CallBackInterface> _cb)";
+ method = "registerCallbackComplex(int in, List<CallBackInterface> _cb, double db)";
+ method = "callBack()";
+ }
+
+ enum Enum {
+
+ APPLE,
+ ORANGE,
+ GRAPE
+ }
+
+ struct Struct {
+
+ string name;
+ float value;
+ int year;
+ }
+}
+
+
--- /dev/null
+
+requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete;
+
--- /dev/null
+
+requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete;
+
--- /dev/null
+# IoTMaster configuration
+
+MAC_ADDRESS=74:da:38:68:72:8a
+IOT_CODE_PATH=./../iotcode/
+CONTROLLERS_CODE_PATH=../
+RUNTIME_DIR=~/iotjava/iotruntime;
+#CLASS_PATH=-cp .:/usr/share/java/*:./../../iotjava/:./../../iotjava/iotruntime/:./../../iotjava/iotinstaller/
+CLASS_PATH=-cp .:/usr/share/java/*:./../:./../iotruntime/:./../iotinstaller/
+
+#benchmarks/libs/boofcv_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
+#benchmarks/libs/georegression_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
+
+RMI_PATH=-Djava.rmi.server.codebase=file:.:/usr/share/java/*
+RMI_HOSTNAME=-Djava.rmi.server.hostname=
+LOG_FILE_PATH=log/
+SSH_USERNAME=ssh iotuser@
+ROUTER_ADD=192.168.2.1
+
+#The only host that SSH is allowed from to the router
+MONITORING_HOST=74:da:38:68:72:8a
+
+#Zigbee gateway information
+ZIGBEE_GATEWAY_ADDRESS=c0:4a:00:10:9c:b3
+ZIGBEE_GATEWAY_PORT=5005
+ZIGBEE_IOTMASTER_PORT=12345
+
+#Verboseness of runtime messages
+VERBOSE=Yes
+
--- /dev/null
+# IoTSlave configuration
+
+JAR_FILE_PATH=./../iotruntime/
+
+# e.g. iotcode.AmcrestCamera - basically the path of the benchmark class files
+OBJECT_CLASS_PREFIX=iotcode
+
+# e.g. interfaces.Camera - basically the path of the interface class file
+INTERFACE_PREFIX=interfaces
+
+#Verboseness of runtime messages
+VERBOSE=Yes
--- /dev/null
+# MySQLInterface configuration
+
+HOST=128.195.204.105
+DATABASE=IoTMain
+USERNAME=root
+PASSWORD=root
--- /dev/null
+mysql> select * from LightBulb where zone=1;
++-------------------+------+-------+
+| ID | ZONE | POWER |
++-------------------+------+-------+
+| 00:11:00:00:00:02 | 1 | 30 |
++-------------------+------+-------+
+1 row in set (0.00 sec)
+
+mysql> select * from ProximitySensor where zone=2;
++-------------------+------+-------+
+| ID | ZONE | POWER |
++-------------------+------+-------+
+| 00:10:00:00:00:03 | 2 | 100 |
+| 00:10:00:00:00:07 | 2 | 100 |
++-------------------+------+-------+
+2 rows in set (0.00 sec)
+
+mysql> select * from IoTComm;
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE | TYPE_SOURCE | ID_DESTINATION | TYPE_DESTINATION | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl | 00:11:00:00:00:02 | LightBulbImpl | WRITE |
+| 00:10:00:00:00:01 | ProximitySensorImpl | 00:11:00:00:00:01 | LightBulbImpl | WRITE |
+| 00:10:00:00:00:05 | ProximitySensorBrandC | 00:11:00:00:00:01 | LightBulbImpl | WRITE |
+| 00:10:00:00:00:07 | ProximitySensorBrandD | 00:11:00:00:00:02 | LightBulbImpl | WRITE |
++-------------------+-----------------------+-------------------+----------------------+--------+
+11 rows in set (0.00 sec)
+
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE | TYPE_SOURCE | ID_DESTINATION | TYPE_DESTINATION | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl | 00:11:00:00:00:02 | LightBulbImpl | WRITE |
+| | 00:11:00:00:00:01 | LightBulbImpl | WRITE |
+| 00:10:00:00:00:05 | ProximitySensorBrandC | 00:11:00:00:00:01 | LightBulbImpl | WRITE |
+| 00:10:00:00:00:07 | ProximitySensorBrandD | 00:11:00:00:00:02 | LightBulbImpl | WRITE |
++-------------------+-----------------------+-------------------+----------------------+--------+
+
+
+Objects need to be created:
+
+AcmeProximity (dc-8)
+LightBulbImpl 00:11:00:00:00:01 (dc-9)
+LightBulbImpl 00:11:00:00:00:02 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:01 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:03 (dc-9)
+ProximitySensorBrandC 00:10:00:00:00:05 (dc-11)
+ProximitySensorBrandD 00:10:00:00:00:07 (dc-11)
+
--- /dev/null
+mysql> select * from ProximitySensor where zone=2;
++-------------------+------+-------+
+| ID | ZONE | POWER |
++-------------------+------+-------+
+| 00:10:00:00:00:03 | 2 | 100 |
+| 00:10:00:00:00:07 | 2 | 100 |
++-------------------+------+-------+
+2 rows in set (0.00 sec)
+
+mysql> select * from Vent where zone=1;
++-------------------+------+
+| ID | ZONE |
++-------------------+------+
+| 00:14:00:00:00:01 | 1 |
+| 00:14:00:00:00:02 | 1 |
++-------------------+------+
+2 rows in set (0.00 sec)
+
+mysql> select * from IoTComm;
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE | TYPE_SOURCE | ID_DESTINATION | TYPE_DESTINATION | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl | 00:14:00:00:00:01 | VentImpl | WRITE |
+| 00:10:00:00:00:02 | ProximitySensorImpl | 00:14:00:00:00:02 | VentImpl | WRITE |
+| 00:10:00:00:00:03 | ProximitySensorImpl | 00:14:00:00:00:03 | VentImpl | WRITE |
+| 00:10:00:00:00:03 | ProximitySensorImpl | 00:14:00:00:00:04 | VentImpl | WRITE |
++-------------------+-----------------------+-------------------+----------------------+--------+
+11 rows in set (0.00 sec)
+
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE | TYPE_SOURCE | ID_DESTINATION | TYPE_DESTINATION | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl | 00:14:00:00:00:01 | VentImpl | WRITE |
+| 00:10:00:00:00:02 | ProximitySensorImpl | 00:14:00:00:00:02 | VentImpl | WRITE |
+| 00:10:00:00:00:03 | ProximitySensorImpl | 00:14:00:00:00:03 | VentImpl | WRITE |
+| | 00:14:00:00:00:04 | VentImpl | WRITE |
++-------------------+-----------------------+-------------------+----------------------+--------+
+
+Objects need to be created:
+
+AcmeVentControl (dc-8)
+VentImpl 00:14:00:00:00:01 (dc-11)
+VentImpl 00:14:00:00:00:02 (dc-11)
+VentImpl 00:14:00:00:00:03 (dc-11)
+VentImpl 00:14:00:00:00:04 (dc-11)
+ProximitySensorImpl 00:10:00:00:00:01 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:02 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:03 (dc-9)
+ProximitySensorBrandD 00:10:00:00:00:07 (dc-11)
+
--- /dev/null
+SELECT * FROM
+IoTAddress
+WHERE
+TYPE='GoogleBrilloWeave2'
+;
--- /dev/null
+SELECT * FROM
+IoTAddress
+WHERE
+TYPE='GoogleBrilloWeave1'
+;
--- /dev/null
+SELECT * FROM
+Room
+WHERE
+TYPE='AudioRoom'
+;
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='BlossomSprinklerAdd1'
+;
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='AmcrestCameraAdd'
+;
--- /dev/null
+SELECT * FROM\r
+Camera\r
+WHERE\r
+ID='CM1'\r
+;\r
--- /dev/null
+SELECT * FROM
+Camera
+;
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='SpruceSensorAdd'
+;
--- /dev/null
+SELECT * FROM
+IoTZigbeeAddress
+WHERE
+TYPE='SpruceSensorZBAdd'
+;
--- /dev/null
+SELECT * FROM\r
+GPSGateway\r
+;\r
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='GPSPhoneGatewayAdd'
+;
--- /dev/null
+SELECT * FROM\r
+WeatherGateway\r
+;\r
--- /dev/null
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+Camera\r
+;\r
--- /dev/null
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+MoistureSensor\r
+;\r
--- /dev/null
+SELECT * FROM\r
+Lawn\r
+;\r
--- /dev/null
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+Sprinkler\r
+WHERE\r
+ID_DESTINATION='SP2'\r
+;\r
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='LifxLightBulbAdd'
+;
--- /dev/null
+SELECT * FROM
+LEDFlasher
+;
--- /dev/null
+SELECT * FROM
+LightBulb
+;
--- /dev/null
+SELECT * FROM
+LightBulb
+;
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='BlossomSprinklerAdd2'
+;
--- /dev/null
+SELECT * FROM
+LightBulb
+;
--- /dev/null
+SELECT * FROM\r
+MoistureSensor\r
+;\r
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='WeatherPhoneGatewayAdd'
+;
--- /dev/null
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+Camera
+;
--- /dev/null
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+LightBulb
+;
--- /dev/null
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+Speaker
+;
--- /dev/null
+SELECT * FROM
+Room
+WHERE
+TYPE='LabRoom'
+;
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE LIKE 'IHomeAdd%'
+;
--- /dev/null
+SELECT * FROM\r
+Speaker\r
+;\r
--- /dev/null
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='EspSprinklerAdd'
+;
--- /dev/null
+SELECT * FROM\r
+IoTAddress\r
+WHERE\r
+ID='WF2'\r
+;\r
--- /dev/null
+SELECT * FROM\r
+IoTAddress\r
+WHERE\r
+ID='WF1'\r
+;\r