From: rtrimana Date: Mon, 12 Dec 2016 19:46:59 +0000 (-0800) Subject: Preparing Makefiles, stub, skeleton, config files, etc. for porting LifxLightBulb... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=aeebaa13676fe92404f364e5f747766a9c2c4e6c Preparing Makefiles, stub, skeleton, config files, etc. for porting LifxLightBulb and Lifxtest --- diff --git a/benchmarks/Lifxtest/Lifxtest.config b/benchmarks/Lifxtest/Lifxtest.config new file mode 100644 index 0000000..5a44766 --- /dev/null +++ b/benchmarks/Lifxtest/Lifxtest.config @@ -0,0 +1 @@ +ADDITIONAL_ZIP_FILE=No diff --git a/benchmarks/Lifxtest/Lifxtest.java b/benchmarks/Lifxtest/Lifxtest.java new file mode 100644 index 0000000..df95114 --- /dev/null +++ b/benchmarks/Lifxtest/Lifxtest.java @@ -0,0 +1,74 @@ +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 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(); + } + } +} diff --git a/benchmarks/Lifxtest/LightBulbTest_Stub.java b/benchmarks/Lifxtest/LightBulbTest_Stub.java new file mode 100644 index 0000000..2a697ce --- /dev/null +++ b/benchmarks/Lifxtest/LightBulbTest_Stub.java @@ -0,0 +1,112 @@ +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; + } + +} diff --git a/benchmarks/Lifxtest/Makefile b/benchmarks/Lifxtest/Makefile new file mode 100755 index 0000000..9a4eb32 --- /dev/null +++ b/benchmarks/Lifxtest/Makefile @@ -0,0 +1,17 @@ +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) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index dac207c..0c49d34 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -4,9 +4,7 @@ BOOFJARS := $(BOOFDIR)/BoofCV-feature-0.21.jar:$(BOOFDIR)/BoofCV-io-0.21.jar:$(B 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: diff --git a/benchmarks/annotation/config.java b/benchmarks/annotation/config.java new file mode 100644 index 0000000..de85890 --- /dev/null +++ b/benchmarks/annotation/config.java @@ -0,0 +1,15 @@ +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 + * @version 1.0 + * @since 2016-12-12 + */ +@Retention(RetentionPolicy.RUNTIME) +public @interface config { +} diff --git a/benchmarks/annotation/constraint.java b/benchmarks/annotation/constraint.java new file mode 100644 index 0000000..6e8fe10 --- /dev/null +++ b/benchmarks/annotation/constraint.java @@ -0,0 +1,14 @@ +package iotcode.annotation; + +import java.lang.annotation.*; + +/** @constraint annotation + * This annotation is for the runtime system to instrument IoTSet and IoTRelation + * + * @author Rahmadi Trimananda + * @version 1.0 + * @since 2015-12-01 + */ +@Retention(RetentionPolicy.RUNTIME) +public @interface constraint { +} diff --git a/benchmarks/drivers/LifxLightBulb/LifxLightBulb.java b/benchmarks/drivers/LifxLightBulb/LifxLightBulb.java index 021e749..cbc0ca9 100644 --- a/benchmarks/drivers/LifxLightBulb/LifxLightBulb.java +++ b/benchmarks/drivers/LifxLightBulb/LifxLightBulb.java @@ -9,9 +9,8 @@ import java.util.Date; 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; @@ -20,8 +19,6 @@ import iotruntime.slave.IoTSet; // String to byte conversion import javax.xml.bind.DatatypeConverter; -import iotchecker.qual.*; - public class LifxLightBulb implements LightBulb { /******************************************************************************************************************************************* diff --git a/benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java b/benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java new file mode 100644 index 0000000..17b1381 --- /dev/null +++ b/benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java @@ -0,0 +1,260 @@ +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 set0Allowed; + + + public LightBulb_Skeleton(LightBulb _mainObj, int _port) throws Exception { + mainObj = _mainObj; + rmiObj = new IoTRMIObject(_port); + set0Allowed = new ArrayList(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!"); + } + } + } + +} diff --git a/benchmarks/drivers/Makefile b/benchmarks/drivers/Makefile new file mode 100644 index 0000000..1a1a0a0 --- /dev/null +++ b/benchmarks/drivers/Makefile @@ -0,0 +1,23 @@ +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) diff --git a/benchmarks/interfaces/LightBulb.java b/benchmarks/interfaces/LightBulb.java new file mode 100644 index 0000000..2d7c928 --- /dev/null +++ b/benchmarks/interfaces/LightBulb.java @@ -0,0 +1,25 @@ +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(); +} diff --git a/benchmarks/interfaces/LightBulbTest.java b/benchmarks/interfaces/LightBulbTest.java new file mode 100644 index 0000000..2d19f6e --- /dev/null +++ b/benchmarks/interfaces/LightBulbTest.java @@ -0,0 +1,18 @@ +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(); +} diff --git a/benchmarks/interfaces/Makefile b/benchmarks/interfaces/Makefile new file mode 100755 index 0000000..53c2b9c --- /dev/null +++ b/benchmarks/interfaces/Makefile @@ -0,0 +1,13 @@ +BASE = ../.. + +include $(BASE)/common.mk + +JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):. + +all: interfaces + +PHONY += interfaces +interfaces: + $(JAVAC) $(JFLAGS) *.java + +.PHONY: $(PHONY) diff --git a/benchmarks/original_interfaces/Camera.java b/benchmarks/original_interfaces/Camera.java new file mode 100644 index 0000000..cc5cfb4 --- /dev/null +++ b/benchmarks/original_interfaces/Camera.java @@ -0,0 +1,145 @@ +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 + * @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] the supported resolutions of the camera. + */ + public List 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; + +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/CameraCallback.java b/benchmarks/original_interfaces/CameraCallback.java new file mode 100644 index 0000000..19bcf3d --- /dev/null +++ b/benchmarks/original_interfaces/CameraCallback.java @@ -0,0 +1,28 @@ +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 + * @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; +} diff --git a/benchmarks/original_interfaces/GPSGateway.java b/benchmarks/original_interfaces/GPSGateway.java new file mode 100644 index 0000000..007f856 --- /dev/null +++ b/benchmarks/original_interfaces/GPSGateway.java @@ -0,0 +1,99 @@ +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 + * @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; +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/GPSGatewayCallback.java b/benchmarks/original_interfaces/GPSGatewayCallback.java new file mode 100644 index 0000000..52f4a7c --- /dev/null +++ b/benchmarks/original_interfaces/GPSGatewayCallback.java @@ -0,0 +1,32 @@ +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 + * @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; +} diff --git a/benchmarks/original_interfaces/LEDFlasher.java b/benchmarks/original_interfaces/LEDFlasher.java new file mode 100644 index 0000000..7647f8f --- /dev/null +++ b/benchmarks/original_interfaces/LEDFlasher.java @@ -0,0 +1,32 @@ +package iotcode.interfaces; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** Class LEDFlasher interface for LEDFlasher Brillo devices. + *

+ * This interface is generated by IoTBrilloWeaveCodeGenerator. + * These comments were added after code generation. + * + * @author Rahmadi Trimananda + * @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; + +} diff --git a/benchmarks/original_interfaces/Lawn.java b/benchmarks/original_interfaces/Lawn.java new file mode 100644 index 0000000..3f2eeb7 --- /dev/null +++ b/benchmarks/original_interfaces/Lawn.java @@ -0,0 +1,8 @@ +package iotcode.interfaces; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +public interface Lawn extends Remote { + +} diff --git a/benchmarks/original_interfaces/LightBulb.java b/benchmarks/original_interfaces/LightBulb.java new file mode 100644 index 0000000..368696e --- /dev/null +++ b/benchmarks/original_interfaces/LightBulb.java @@ -0,0 +1,165 @@ +package iotcode.interfaces; + +// RMI Packages +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** Class LightBulb interface for the light bulb devices. + * + * @author Ali Younis + * @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; + +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/Makefile b/benchmarks/original_interfaces/Makefile new file mode 100755 index 0000000..e03361e --- /dev/null +++ b/benchmarks/original_interfaces/Makefile @@ -0,0 +1,23 @@ +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) diff --git a/benchmarks/original_interfaces/MoistureSensor.java b/benchmarks/original_interfaces/MoistureSensor.java new file mode 100644 index 0000000..d2879e1 --- /dev/null +++ b/benchmarks/original_interfaces/MoistureSensor.java @@ -0,0 +1,66 @@ +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 + * @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; +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/MoistureSensorCallback.java b/benchmarks/original_interfaces/MoistureSensorCallback.java new file mode 100644 index 0000000..6a9d21e --- /dev/null +++ b/benchmarks/original_interfaces/MoistureSensorCallback.java @@ -0,0 +1,29 @@ +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 + * @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; +} diff --git a/benchmarks/original_interfaces/Room.java b/benchmarks/original_interfaces/Room.java new file mode 100644 index 0000000..e907c8e --- /dev/null +++ b/benchmarks/original_interfaces/Room.java @@ -0,0 +1,21 @@ +package iotcode.interfaces; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +/** Interface Room for all room implementations + * + * @author Ali Younis + * @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; +} diff --git a/benchmarks/original_interfaces/Speaker.java b/benchmarks/original_interfaces/Speaker.java new file mode 100644 index 0000000..891e722 --- /dev/null +++ b/benchmarks/original_interfaces/Speaker.java @@ -0,0 +1,109 @@ +package iotcode.interfaces; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +// Checker annotations +import iotchecker.qual.NonLocalRemote; + +/** Speaker Interface Class + * + * @author Rahmadi Trimananda + * @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; +} diff --git a/benchmarks/original_interfaces/SpeakerCallback.java b/benchmarks/original_interfaces/SpeakerCallback.java new file mode 100644 index 0000000..e1ffedb --- /dev/null +++ b/benchmarks/original_interfaces/SpeakerCallback.java @@ -0,0 +1,26 @@ +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 + * @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; +} diff --git a/benchmarks/original_interfaces/Sprinkler.java b/benchmarks/original_interfaces/Sprinkler.java new file mode 100644 index 0000000..0a21905 --- /dev/null +++ b/benchmarks/original_interfaces/Sprinkler.java @@ -0,0 +1,84 @@ +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 + * @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] list of the states for the zones. + */ + public List 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; +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/WeatherGateway.java b/benchmarks/original_interfaces/WeatherGateway.java new file mode 100644 index 0000000..247cf96 --- /dev/null +++ b/benchmarks/original_interfaces/WeatherGateway.java @@ -0,0 +1,101 @@ +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 + * @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; +} + + + + + + + + + + + + + + diff --git a/benchmarks/original_interfaces/WeatherGatewayCallback.java b/benchmarks/original_interfaces/WeatherGatewayCallback.java new file mode 100644 index 0000000..0ffc3ff --- /dev/null +++ b/benchmarks/original_interfaces/WeatherGatewayCallback.java @@ -0,0 +1,25 @@ +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 + * @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; +} diff --git a/benchmarks/original_interfaces/ZoneState.java b/benchmarks/original_interfaces/ZoneState.java new file mode 100644 index 0000000..85894e3 --- /dev/null +++ b/benchmarks/original_interfaces/ZoneState.java @@ -0,0 +1,51 @@ +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; + } +} diff --git a/config/iotpolicy/callbackpolicy.pol b/config/iotpolicy/callbackpolicy.pol deleted file mode 100644 index 947b899..0000000 --- a/config/iotpolicy/callbackpolicy.pol +++ /dev/null @@ -1,14 +0,0 @@ -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)"; - } -} - - diff --git a/config/iotpolicy/callbackrequires.pol b/config/iotpolicy/callbackrequires.pol deleted file mode 100644 index 96126d3..0000000 --- a/config/iotpolicy/callbackrequires.pol +++ /dev/null @@ -1,3 +0,0 @@ - -requires CallBackInterface with CallBack as interface CallBackInterfaceWithCallBack; - diff --git a/config/iotpolicy/camerapolicy.pol b/config/iotpolicy/camerapolicy.pol deleted file mode 100644 index ca807b6..0000000 --- a/config/iotpolicy/camerapolicy.pol +++ /dev/null @@ -1,44 +0,0 @@ -public interface Camera { - - public List 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 F); - public float MethodD(List 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 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 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; - } -} - - diff --git a/config/iotpolicy/camerarequires.pol b/config/iotpolicy/camerarequires.pol deleted file mode 100644 index 90049de..0000000 --- a/config/iotpolicy/camerarequires.pol +++ /dev/null @@ -1,3 +0,0 @@ - -requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData; - diff --git a/config/iotpolicy/enum.pol b/config/iotpolicy/enum.pol deleted file mode 100644 index c9e85b6..0000000 --- a/config/iotpolicy/enum.pol +++ /dev/null @@ -1,7 +0,0 @@ - -enum Enum { - - APPLE, - ORANGE, - GRAPE -} diff --git a/config/iotpolicy/lightbulbpolicy.pol b/config/iotpolicy/lightbulbpolicy.pol deleted file mode 100644 index b879626..0000000 --- a/config/iotpolicy/lightbulbpolicy.pol +++ /dev/null @@ -1,32 +0,0 @@ -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 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 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 F)"; - } - - enum Enum { - - APPLE, - ORANGE, - GRAPE, - MANGO - } -} - - diff --git a/config/iotpolicy/lightbulbrequires.pol b/config/iotpolicy/lightbulbrequires.pol deleted file mode 100644 index 24a7ca1..0000000 --- a/config/iotpolicy/lightbulbrequires.pol +++ /dev/null @@ -1,3 +0,0 @@ - -requires LightBulb with Flicker as interface LightBulbWithFlicker; - diff --git a/config/iotpolicy/struct.pol b/config/iotpolicy/struct.pol deleted file mode 100644 index 9b38ad1..0000000 --- a/config/iotpolicy/struct.pol +++ /dev/null @@ -1,7 +0,0 @@ - -struct Struct { - - string name; - float value; - int year; -} diff --git a/config/iotpolicy/testclasspolicy.pol b/config/iotpolicy/testclasspolicy.pol deleted file mode 100644 index e7cdc3b..0000000 --- a/config/iotpolicy/testclasspolicy.pol +++ /dev/null @@ -1,115 +0,0 @@ -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 getByteList(List in); - public List getShortList(List in); - public List getLongList(List in); - public List getFloatList(List in); - public List getDoubleList(List in); - public List getBooleanList(List in); - public List getCharList(List in); - - public Enum handleEnum(Enum en); - public Enum[] handleEnumArray(Enum en[]); - public List handleEnumList(List en); - public Enum handleEnumComplex(Enum en, int i, char c); - - public Struct handleStruct(Struct str); - public Struct[] handleStructArray(Struct str[]); - public List handleStructList(List str); - - public void registerCallback(CallBackInterface _cb); - public void registerCallbackArray(CallBackInterface _cb[]); - public void registerCallbackList(List _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 in)"; - method = "getShortList(List in)"; - method = "getLongList(List in)"; - method = "getFloatList(List in)"; - method = "getDoubleList(List in)"; - method = "getBooleanList(List in)"; - method = "getCharList(List in)"; - - method = "handleEnum(Enum en)"; - method = "handleEnumArray(Enum en[])"; - method = "handleEnumList(List en)"; - method = "handleEnumComplex(Enum en, int i, char c)"; - - method = "handleStruct(Struct str)"; - method = "handleStructArray(Struct str[])"; - method = "handleStructList(List str)"; - - method = "registerCallback(CallBackInterface _cb)"; - method = "registerCallbackArray(CallBackInterface _cb[])"; - method = "registerCallbackList(List _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; - } -} - - diff --git a/config/iotpolicy/testclasspolicy_advanced.pol b/config/iotpolicy/testclasspolicy_advanced.pol deleted file mode 100644 index b7899df..0000000 --- a/config/iotpolicy/testclasspolicy_advanced.pol +++ /dev/null @@ -1,82 +0,0 @@ -public interface TestClassInterface { - - public Enum handleEnum(Enum en); - public Enum[] handleEnumArray(Enum en[]); - public List handleEnumList(List 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 handleStructList(List str); - public Struct handleStructComplex(int in, char c, Struct str); - public List handleStructTwo(List str1, List str2); - public List handleStructThree(List str1, List str2, List str3); - public List handleStructComplex2(int in, char c, Struct str[]); - - public Enum[] handleEnumStruct(Enum en[], List str, char c); - - public void registerCallback(CallBackInterface _cb); - public void registerCallbackArray(CallBackInterface _cb[]); - public void registerCallbackList(List _cb); - public void registerCallbackComplex(int in, List _cb, double db); - public int callBack(); - public Enum[] handleCallbackEnum(Enum en[], char c, List _cb); - - - public Enum[] handleAll(Enum en[], List str, char c, List _cb); - public Enum[] handleAllTwo(Enum en1[], Enum en2[], List str1, List str2, char c, List _cb1, List _cb2); - public Enum[] handleEnumThree(Enum en1[], Enum en2[], List str1, List str2); - - capability EnumsStructs { - description = "All the set methods"; - - method = "handleEnum(Enum en)"; - method = "handleEnumArray(Enum en[])"; - method = "handleEnumList(List 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 str1, List str2)"; - - method = "handleStruct(Struct str)"; - method = "handleStructArray(Struct str[])"; - method = "handleStructList(List str)"; - method = "handleStructComplex(int in, char c, Struct str)"; - method = "handleStructComplex2(int in, char c, Struct str[])"; - method = "handleStructTwo(List str1, List str2)"; - method = "handleStructThree(List str1, List str2, List str3)"; - - method = "handleEnumStruct(Enum en[], List str, char c)"; - method = "handleCallbackEnum(Enum en[], char c, List _cb)"; - method = "handleAll(Enum en[], List str, char c, List _cb)"; - method = "handleAllTwo(Enum en1[], Enum en2[], List str1, List str2, char c, List _cb1, List _cb2)"; - } - - capability Callbacks { - description = "All the set-and-get methods"; - - method = "registerCallback(CallBackInterface _cb)"; - method = "registerCallbackArray(CallBackInterface _cb[])"; - method = "registerCallbackList(List _cb)"; - method = "registerCallbackComplex(int in, List _cb, double db)"; - method = "callBack()"; - } - - enum Enum { - - APPLE, - ORANGE, - GRAPE - } - - struct Struct { - - string name; - float value; - int year; - } -} - - diff --git a/config/iotpolicy/testclassrequires.pol b/config/iotpolicy/testclassrequires.pol deleted file mode 100644 index 713fb4e..0000000 --- a/config/iotpolicy/testclassrequires.pol +++ /dev/null @@ -1,3 +0,0 @@ - -requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete; - diff --git a/config/iotpolicy/testclassrequires_advanced.pol b/config/iotpolicy/testclassrequires_advanced.pol deleted file mode 100644 index b00b4cf..0000000 --- a/config/iotpolicy/testclassrequires_advanced.pol +++ /dev/null @@ -1,3 +0,0 @@ - -requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete; - diff --git a/iotjava/Makefile b/iotjava/Makefile index 1a4d49c..4d1d321 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -2,7 +2,9 @@ BASE := .. 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 @@ -16,18 +18,18 @@ parser: 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 @@ -36,10 +38,10 @@ 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 @@ -76,27 +78,10 @@ PHONY += rmi 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: @@ -106,8 +91,21 @@ PHONY += run-rmiclient 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) diff --git a/iotjava/gmon.out b/iotjava/gmon.out new file mode 100644 index 0000000..42a3312 Binary files /dev/null and b/iotjava/gmon.out differ diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java index a5a6781..0f696be 100644 --- a/iotjava/iotpolicy/IoTCompiler.java +++ b/iotjava/iotpolicy/IoTCompiler.java @@ -361,7 +361,7 @@ public class IoTCompiler { DeclarationHandler decHandler = mapIntDeclHand.get(intface); InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(intface); // Pass in set of methods and get import classes - List methods = intDecl.getMethods(); + Set methods = intMeth.getValue(); Set importClasses = getImportClasses(methods, intDecl); List stdImportClasses = getStandardJavaIntfaceImportClasses(); List allImportClasses = getAllLibClasses(stdImportClasses, importClasses); @@ -2543,7 +2543,8 @@ public class IoTCompiler { println("#define _" + newIntface.toUpperCase() + "_HPP__"); println("#include "); // Pass in set of methods and get import classes - Set includeClasses = getIncludeClasses(intMeth.getValue(), intDecl, intface, false); + Set methods = intMeth.getValue(); + Set includeClasses = getIncludeClasses(methods, intDecl, intface, false); List stdIncludeClasses = getStandardCplusIncludeClasses(); List allIncludeClasses = getAllLibClasses(stdIncludeClasses, includeClasses); printIncludeStatements(allIncludeClasses); println(""); @@ -2552,7 +2553,7 @@ public class IoTCompiler { println("{"); println("public:"); // Write methods - writeMethodCplusInterface(intMeth.getValue(), intDecl); + writeMethodCplusInterface(methods, intDecl); println("};"); println("#endif"); pw.close(); diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeave.java b/iotjava/iotruntime/brillo/IoTBrilloWeave.java deleted file mode 100644 index 8a1e743..0000000 --- a/iotjava/iotruntime/brillo/IoTBrilloWeave.java +++ /dev/null @@ -1,51 +0,0 @@ -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 - * @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); - } -} diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java b/iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java deleted file mode 100644 index 0fa3a18..0000000 --- a/iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java +++ /dev/null @@ -1,246 +0,0 @@ -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 - * @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 - *

- * 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 - *

- * 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 - *

- * 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 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"); - } -} diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java b/iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java deleted file mode 100644 index cd6b0f7..0000000 --- a/iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java +++ /dev/null @@ -1,461 +0,0 @@ -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 - *

- * 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 .config file - * and modify the Makefile - * 5) A device driver can be created based on the created API's - * - * @author Rahmadi Trimananda - * @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> mapCommand = device.getCommandDefs(); - for(String strCmd : mapCommand.keySet()) { - Map 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> mapParam = cmd.getParameters(); - for (String strParamName : mapParam.keySet()) { - iParamCount++; - Map 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 GoogleAccountAddress;"); - println("@config private IoTSet 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> mapCommand = device.getCommandDefs(); - for(String strCmd : mapCommand.keySet()) { - Map 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> mapParam = cmd.getParameters(); - for (String strParamName : mapParam.keySet()) { - iParamCount++; - Map 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 parameters = new HashMap();"); - Map> mapParam = cmd.getParameters(); - for (String strParamName : mapParam.keySet()) { - //iParamCount++; - Map 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 IoTBrilloWeaveCodeGenerator "); - System.out.println(" "); - 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 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 F); + public float MethodD(List 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 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 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; + } +} + + diff --git a/localconfig/iotpolicy/development/camerarequires.pol b/localconfig/iotpolicy/development/camerarequires.pol new file mode 100644 index 0000000..90049de --- /dev/null +++ b/localconfig/iotpolicy/development/camerarequires.pol @@ -0,0 +1,3 @@ + +requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData; + diff --git a/localconfig/iotpolicy/development/enum.pol b/localconfig/iotpolicy/development/enum.pol new file mode 100644 index 0000000..c9e85b6 --- /dev/null +++ b/localconfig/iotpolicy/development/enum.pol @@ -0,0 +1,7 @@ + +enum Enum { + + APPLE, + ORANGE, + GRAPE +} diff --git a/localconfig/iotpolicy/development/lightbulbpolicy.pol b/localconfig/iotpolicy/development/lightbulbpolicy.pol new file mode 100644 index 0000000..b879626 --- /dev/null +++ b/localconfig/iotpolicy/development/lightbulbpolicy.pol @@ -0,0 +1,32 @@ +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 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 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 F)"; + } + + enum Enum { + + APPLE, + ORANGE, + GRAPE, + MANGO + } +} + + diff --git a/localconfig/iotpolicy/development/lightbulbrequires.pol b/localconfig/iotpolicy/development/lightbulbrequires.pol new file mode 100644 index 0000000..24a7ca1 --- /dev/null +++ b/localconfig/iotpolicy/development/lightbulbrequires.pol @@ -0,0 +1,3 @@ + +requires LightBulb with Flicker as interface LightBulbWithFlicker; + diff --git a/localconfig/iotpolicy/development/struct.pol b/localconfig/iotpolicy/development/struct.pol new file mode 100644 index 0000000..9b38ad1 --- /dev/null +++ b/localconfig/iotpolicy/development/struct.pol @@ -0,0 +1,7 @@ + +struct Struct { + + string name; + float value; + int year; +} diff --git a/localconfig/iotpolicy/development/testclasspolicy.pol b/localconfig/iotpolicy/development/testclasspolicy.pol new file mode 100644 index 0000000..e7cdc3b --- /dev/null +++ b/localconfig/iotpolicy/development/testclasspolicy.pol @@ -0,0 +1,115 @@ +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 getByteList(List in); + public List getShortList(List in); + public List getLongList(List in); + public List getFloatList(List in); + public List getDoubleList(List in); + public List getBooleanList(List in); + public List getCharList(List in); + + public Enum handleEnum(Enum en); + public Enum[] handleEnumArray(Enum en[]); + public List handleEnumList(List en); + public Enum handleEnumComplex(Enum en, int i, char c); + + public Struct handleStruct(Struct str); + public Struct[] handleStructArray(Struct str[]); + public List handleStructList(List str); + + public void registerCallback(CallBackInterface _cb); + public void registerCallbackArray(CallBackInterface _cb[]); + public void registerCallbackList(List _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 in)"; + method = "getShortList(List in)"; + method = "getLongList(List in)"; + method = "getFloatList(List in)"; + method = "getDoubleList(List in)"; + method = "getBooleanList(List in)"; + method = "getCharList(List in)"; + + method = "handleEnum(Enum en)"; + method = "handleEnumArray(Enum en[])"; + method = "handleEnumList(List en)"; + method = "handleEnumComplex(Enum en, int i, char c)"; + + method = "handleStruct(Struct str)"; + method = "handleStructArray(Struct str[])"; + method = "handleStructList(List str)"; + + method = "registerCallback(CallBackInterface _cb)"; + method = "registerCallbackArray(CallBackInterface _cb[])"; + method = "registerCallbackList(List _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; + } +} + + diff --git a/localconfig/iotpolicy/development/testclasspolicy_advanced.pol b/localconfig/iotpolicy/development/testclasspolicy_advanced.pol new file mode 100644 index 0000000..b7899df --- /dev/null +++ b/localconfig/iotpolicy/development/testclasspolicy_advanced.pol @@ -0,0 +1,82 @@ +public interface TestClassInterface { + + public Enum handleEnum(Enum en); + public Enum[] handleEnumArray(Enum en[]); + public List handleEnumList(List 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 handleStructList(List str); + public Struct handleStructComplex(int in, char c, Struct str); + public List handleStructTwo(List str1, List str2); + public List handleStructThree(List str1, List str2, List str3); + public List handleStructComplex2(int in, char c, Struct str[]); + + public Enum[] handleEnumStruct(Enum en[], List str, char c); + + public void registerCallback(CallBackInterface _cb); + public void registerCallbackArray(CallBackInterface _cb[]); + public void registerCallbackList(List _cb); + public void registerCallbackComplex(int in, List _cb, double db); + public int callBack(); + public Enum[] handleCallbackEnum(Enum en[], char c, List _cb); + + + public Enum[] handleAll(Enum en[], List str, char c, List _cb); + public Enum[] handleAllTwo(Enum en1[], Enum en2[], List str1, List str2, char c, List _cb1, List _cb2); + public Enum[] handleEnumThree(Enum en1[], Enum en2[], List str1, List str2); + + capability EnumsStructs { + description = "All the set methods"; + + method = "handleEnum(Enum en)"; + method = "handleEnumArray(Enum en[])"; + method = "handleEnumList(List 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 str1, List str2)"; + + method = "handleStruct(Struct str)"; + method = "handleStructArray(Struct str[])"; + method = "handleStructList(List str)"; + method = "handleStructComplex(int in, char c, Struct str)"; + method = "handleStructComplex2(int in, char c, Struct str[])"; + method = "handleStructTwo(List str1, List str2)"; + method = "handleStructThree(List str1, List str2, List str3)"; + + method = "handleEnumStruct(Enum en[], List str, char c)"; + method = "handleCallbackEnum(Enum en[], char c, List _cb)"; + method = "handleAll(Enum en[], List str, char c, List _cb)"; + method = "handleAllTwo(Enum en1[], Enum en2[], List str1, List str2, char c, List _cb1, List _cb2)"; + } + + capability Callbacks { + description = "All the set-and-get methods"; + + method = "registerCallback(CallBackInterface _cb)"; + method = "registerCallbackArray(CallBackInterface _cb[])"; + method = "registerCallbackList(List _cb)"; + method = "registerCallbackComplex(int in, List _cb, double db)"; + method = "callBack()"; + } + + enum Enum { + + APPLE, + ORANGE, + GRAPE + } + + struct Struct { + + string name; + float value; + int year; + } +} + + diff --git a/localconfig/iotpolicy/development/testclassrequires.pol b/localconfig/iotpolicy/development/testclassrequires.pol new file mode 100644 index 0000000..713fb4e --- /dev/null +++ b/localconfig/iotpolicy/development/testclassrequires.pol @@ -0,0 +1,3 @@ + +requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete; + diff --git a/localconfig/iotpolicy/development/testclassrequires_advanced.pol b/localconfig/iotpolicy/development/testclassrequires_advanced.pol new file mode 100644 index 0000000..b00b4cf --- /dev/null +++ b/localconfig/iotpolicy/development/testclassrequires_advanced.pol @@ -0,0 +1,3 @@ + +requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete; + diff --git a/localconfig/iotruntime/IoTMaster.config b/localconfig/iotruntime/IoTMaster.config new file mode 100644 index 0000000..66e7265 --- /dev/null +++ b/localconfig/iotruntime/IoTMaster.config @@ -0,0 +1,29 @@ +# 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 + diff --git a/localconfig/iotruntime/IoTSlave.config b/localconfig/iotruntime/IoTSlave.config new file mode 100644 index 0000000..293e348 --- /dev/null +++ b/localconfig/iotruntime/IoTSlave.config @@ -0,0 +1,12 @@ +# 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 diff --git a/localconfig/iotruntime/MySQLInterface.config b/localconfig/iotruntime/MySQLInterface.config new file mode 100644 index 0000000..749b543 --- /dev/null +++ b/localconfig/iotruntime/MySQLInterface.config @@ -0,0 +1,6 @@ +# MySQLInterface configuration + +HOST=128.195.204.105 +DATABASE=IoTMain +USERNAME=root +PASSWORD=root diff --git a/localconfig/mysql/AcmeProximity_query_results b/localconfig/mysql/AcmeProximity_query_results new file mode 100644 index 0000000..7b2908d --- /dev/null +++ b/localconfig/mysql/AcmeProximity_query_results @@ -0,0 +1,48 @@ +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) + diff --git a/localconfig/mysql/AcmeVentControl_query_results b/localconfig/mysql/AcmeVentControl_query_results new file mode 100644 index 0000000..b0ed022 --- /dev/null +++ b/localconfig/mysql/AcmeVentControl_query_results @@ -0,0 +1,50 @@ +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) + diff --git a/localconfig/mysql/GoogleAPIsAddress.config b/localconfig/mysql/GoogleAPIsAddress.config new file mode 100644 index 0000000..a5fe158 --- /dev/null +++ b/localconfig/mysql/GoogleAPIsAddress.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTAddress +WHERE +TYPE='GoogleBrilloWeave2' +; diff --git a/localconfig/mysql/GoogleAccountAddress.config b/localconfig/mysql/GoogleAccountAddress.config new file mode 100644 index 0000000..4221828 --- /dev/null +++ b/localconfig/mysql/GoogleAccountAddress.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTAddress +WHERE +TYPE='GoogleBrilloWeave1' +; diff --git a/localconfig/mysql/audioRooms.config b/localconfig/mysql/audioRooms.config new file mode 100644 index 0000000..61a95ee --- /dev/null +++ b/localconfig/mysql/audioRooms.config @@ -0,0 +1,5 @@ +SELECT * FROM +Room +WHERE +TYPE='AudioRoom' +; diff --git a/localconfig/mysql/blossomSprAddressSet.config b/localconfig/mysql/blossomSprAddressSet.config new file mode 100644 index 0000000..8c41319 --- /dev/null +++ b/localconfig/mysql/blossomSprAddressSet.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='BlossomSprinklerAdd1' +; diff --git a/localconfig/mysql/cam_addresses.config b/localconfig/mysql/cam_addresses.config new file mode 100644 index 0000000..b15d293 --- /dev/null +++ b/localconfig/mysql/cam_addresses.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='AmcrestCameraAdd' +; diff --git a/localconfig/mysql/cameraSet.config b/localconfig/mysql/cameraSet.config new file mode 100644 index 0000000..7e16ba1 --- /dev/null +++ b/localconfig/mysql/cameraSet.config @@ -0,0 +1,5 @@ +SELECT * FROM +Camera +WHERE +ID='CM1' +; diff --git a/localconfig/mysql/cameras.config b/localconfig/mysql/cameras.config new file mode 100644 index 0000000..939eb25 --- /dev/null +++ b/localconfig/mysql/cameras.config @@ -0,0 +1,3 @@ +SELECT * FROM +Camera +; diff --git a/localconfig/mysql/devUdpAddress.config b/localconfig/mysql/devUdpAddress.config new file mode 100644 index 0000000..2fa1888 --- /dev/null +++ b/localconfig/mysql/devUdpAddress.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='SpruceSensorAdd' +; diff --git a/localconfig/mysql/devZigbeeAddress.config b/localconfig/mysql/devZigbeeAddress.config new file mode 100644 index 0000000..befc17a --- /dev/null +++ b/localconfig/mysql/devZigbeeAddress.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTZigbeeAddress +WHERE +TYPE='SpruceSensorZBAdd' +; diff --git a/localconfig/mysql/gpsSet.config b/localconfig/mysql/gpsSet.config new file mode 100644 index 0000000..cde5488 --- /dev/null +++ b/localconfig/mysql/gpsSet.config @@ -0,0 +1,3 @@ +SELECT * FROM +GPSGateway +; diff --git a/localconfig/mysql/gps_address.config b/localconfig/mysql/gps_address.config new file mode 100644 index 0000000..2901c23 --- /dev/null +++ b/localconfig/mysql/gps_address.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='GPSPhoneGatewayAdd' +; diff --git a/localconfig/mysql/gwSet.config b/localconfig/mysql/gwSet.config new file mode 100644 index 0000000..a506d4c --- /dev/null +++ b/localconfig/mysql/gwSet.config @@ -0,0 +1,3 @@ +SELECT * FROM +WeatherGateway +; diff --git a/localconfig/mysql/lawnCameraRelation.config b/localconfig/mysql/lawnCameraRelation.config new file mode 100644 index 0000000..137a132 --- /dev/null +++ b/localconfig/mysql/lawnCameraRelation.config @@ -0,0 +1,6 @@ +SELECT RELATION FROM +FIRST +Lawn +OTHER +Camera +; diff --git a/localconfig/mysql/lawnMoistureSensorRelation.config b/localconfig/mysql/lawnMoistureSensorRelation.config new file mode 100644 index 0000000..5a72f79 --- /dev/null +++ b/localconfig/mysql/lawnMoistureSensorRelation.config @@ -0,0 +1,6 @@ +SELECT RELATION FROM +FIRST +Lawn +OTHER +MoistureSensor +; diff --git a/localconfig/mysql/lawnSet.config b/localconfig/mysql/lawnSet.config new file mode 100644 index 0000000..c507f89 --- /dev/null +++ b/localconfig/mysql/lawnSet.config @@ -0,0 +1,3 @@ +SELECT * FROM +Lawn +; diff --git a/localconfig/mysql/lawnSprinklerRelation.config b/localconfig/mysql/lawnSprinklerRelation.config new file mode 100644 index 0000000..9be34c7 --- /dev/null +++ b/localconfig/mysql/lawnSprinklerRelation.config @@ -0,0 +1,8 @@ +SELECT RELATION FROM +FIRST +Lawn +OTHER +Sprinkler +WHERE +ID_DESTINATION='SP2' +; diff --git a/localconfig/mysql/lb_addresses.config b/localconfig/mysql/lb_addresses.config new file mode 100644 index 0000000..74133dc --- /dev/null +++ b/localconfig/mysql/lb_addresses.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='LifxLightBulbAdd' +; diff --git a/localconfig/mysql/led_flasher.config b/localconfig/mysql/led_flasher.config new file mode 100644 index 0000000..c07542a --- /dev/null +++ b/localconfig/mysql/led_flasher.config @@ -0,0 +1,3 @@ +SELECT * FROM +LEDFlasher +; diff --git a/localconfig/mysql/lifx_light_bulb.config b/localconfig/mysql/lifx_light_bulb.config new file mode 100644 index 0000000..11171b0 --- /dev/null +++ b/localconfig/mysql/lifx_light_bulb.config @@ -0,0 +1,3 @@ +SELECT * FROM +LightBulb +; diff --git a/localconfig/mysql/light_bulbs.config b/localconfig/mysql/light_bulbs.config new file mode 100644 index 0000000..11171b0 --- /dev/null +++ b/localconfig/mysql/light_bulbs.config @@ -0,0 +1,3 @@ +SELECT * FROM +LightBulb +; diff --git a/localconfig/mysql/localAddressSet.config b/localconfig/mysql/localAddressSet.config new file mode 100644 index 0000000..f0ee404 --- /dev/null +++ b/localconfig/mysql/localAddressSet.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='BlossomSprinklerAdd2' +; diff --git a/localconfig/mysql/mainRoomLightBulbs.config b/localconfig/mysql/mainRoomLightBulbs.config new file mode 100644 index 0000000..11171b0 --- /dev/null +++ b/localconfig/mysql/mainRoomLightBulbs.config @@ -0,0 +1,3 @@ +SELECT * FROM +LightBulb +; diff --git a/localconfig/mysql/moistureSensorsSet.config b/localconfig/mysql/moistureSensorsSet.config new file mode 100644 index 0000000..ef7d5a7 --- /dev/null +++ b/localconfig/mysql/moistureSensorsSet.config @@ -0,0 +1,3 @@ +SELECT * FROM +MoistureSensor +; diff --git a/localconfig/mysql/ph_address.config b/localconfig/mysql/ph_address.config new file mode 100644 index 0000000..534acc9 --- /dev/null +++ b/localconfig/mysql/ph_address.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='WeatherPhoneGatewayAdd' +; diff --git a/localconfig/mysql/roomCameraRel.config b/localconfig/mysql/roomCameraRel.config new file mode 100644 index 0000000..3297815 --- /dev/null +++ b/localconfig/mysql/roomCameraRel.config @@ -0,0 +1,6 @@ +SELECT RELATION FROM +FIRST +Room +OTHER +Camera +; diff --git a/localconfig/mysql/roomMainBulbRel.config b/localconfig/mysql/roomMainBulbRel.config new file mode 100644 index 0000000..5f82a4b --- /dev/null +++ b/localconfig/mysql/roomMainBulbRel.config @@ -0,0 +1,6 @@ +SELECT RELATION FROM +FIRST +Room +OTHER +LightBulb +; diff --git a/localconfig/mysql/roomSpeakerRel.config b/localconfig/mysql/roomSpeakerRel.config new file mode 100644 index 0000000..3f88688 --- /dev/null +++ b/localconfig/mysql/roomSpeakerRel.config @@ -0,0 +1,6 @@ +SELECT RELATION FROM +FIRST +Room +OTHER +Speaker +; diff --git a/localconfig/mysql/rooms.config b/localconfig/mysql/rooms.config new file mode 100644 index 0000000..a085212 --- /dev/null +++ b/localconfig/mysql/rooms.config @@ -0,0 +1,5 @@ +SELECT * FROM +Room +WHERE +TYPE='LabRoom' +; diff --git a/localconfig/mysql/speakerAddresses.config b/localconfig/mysql/speakerAddresses.config new file mode 100644 index 0000000..1a93655 --- /dev/null +++ b/localconfig/mysql/speakerAddresses.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE LIKE 'IHomeAdd%' +; diff --git a/localconfig/mysql/speakerSet.config b/localconfig/mysql/speakerSet.config new file mode 100644 index 0000000..7ebde92 --- /dev/null +++ b/localconfig/mysql/speakerSet.config @@ -0,0 +1,3 @@ +SELECT * FROM +Speaker +; diff --git a/localconfig/mysql/spr_Addresses.config b/localconfig/mysql/spr_Addresses.config new file mode 100644 index 0000000..62fcb3c --- /dev/null +++ b/localconfig/mysql/spr_Addresses.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTDeviceAddress +WHERE +TYPE='EspSprinklerAdd' +; diff --git a/localconfig/mysql/weatherDataAddressMain.config b/localconfig/mysql/weatherDataAddressMain.config new file mode 100644 index 0000000..b05e947 --- /dev/null +++ b/localconfig/mysql/weatherDataAddressMain.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTAddress +WHERE +ID='WF2' +; diff --git a/localconfig/mysql/weatherDataAddresses.config b/localconfig/mysql/weatherDataAddresses.config new file mode 100644 index 0000000..8fc4407 --- /dev/null +++ b/localconfig/mysql/weatherDataAddresses.config @@ -0,0 +1,5 @@ +SELECT * FROM +IoTAddress +WHERE +ID='WF1' +;