From: Ali Younis Date: Tue, 25 Apr 2017 05:50:43 +0000 (-0700) Subject: Benchmark X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e79302be6150bc95d21394e6891f648d38501369;p=iotcloud.git Benchmark --- diff --git a/version2/src/java/light_fan_benchmark/IoTAddress.java b/version2/src/java/light_fan_benchmark/IoTAddress.java index 5f15330..ee96322 100644 --- a/version2/src/java/light_fan_benchmark/IoTAddress.java +++ b/version2/src/java/light_fan_benchmark/IoTAddress.java @@ -61,7 +61,7 @@ public class IoTAddress { //e.g. http:// + inetAddress.getHostAddress() + strURLComplete // http://192.168.2.254/cgi-bin/mjpg/video.cgi? return "http://" + inetAddress.getHostAddress() + strURLComplete; - + } /** diff --git a/version2/src/java/light_fan_benchmark/IoTDeviceAddress.java b/version2/src/java/light_fan_benchmark/IoTDeviceAddress.java index 0642439..d738f3f 100644 --- a/version2/src/java/light_fan_benchmark/IoTDeviceAddress.java +++ b/version2/src/java/light_fan_benchmark/IoTDeviceAddress.java @@ -134,4 +134,18 @@ public class IoTDeviceAddress extends IoTAddress { public boolean getIsDstPortWildcard() { return isDstPortWildCard; } + + + /** + * getUrl() method + * + * @return String + */ + public String getURL(String strURLComplete) { + + //e.g. http:// + inetAddress.getHostAddress() + strURLComplete + // http://192.168.2.254/cgi-bin/mjpg/video.cgi? + return "http://" + inetAddress.getHostAddress() + ":" + iDstPort + strURLComplete; + + } } diff --git a/version2/src/java/light_fan_benchmark/IoTHTTP.java b/version2/src/java/light_fan_benchmark/IoTHTTP.java index 5d9d2b7..c364c4e 100644 --- a/version2/src/java/light_fan_benchmark/IoTHTTP.java +++ b/version2/src/java/light_fan_benchmark/IoTHTTP.java @@ -46,6 +46,7 @@ public class IoTHTTP { public void setURL(String strUrlComplete) throws MalformedURLException { url = new URL(iotDevAdd.getURL(strUrlComplete)); + System.out.println(url.toString()); } diff --git a/version2/src/java/light_fan_benchmark/Wemo.java b/version2/src/java/light_fan_benchmark/Wemo.java index d020b75..42764a3 100644 --- a/version2/src/java/light_fan_benchmark/Wemo.java +++ b/version2/src/java/light_fan_benchmark/Wemo.java @@ -27,7 +27,6 @@ public class Wemo { - public void turnOff() throws IOException { IoTHTTP httpConnection = null; try { @@ -37,9 +36,13 @@ public class Wemo { httpConnection.openConnection(); httpConnection.setDoOutput(true); httpConnection.setRequestMethod("POST"); + httpConnection.setRequestProperty("Connection", "close"); httpConnection.setRequestProperty("Content-type", "text/xml; charset=\"utf-8\""); httpConnection.setRequestProperty("SOAPACTION", "\"urn:Belkin:service:basicevent:1#SetBinaryState\""); - httpConnection.setRequestProperty("Accept", ""); + + httpConnection.setRequestProperty("User-Agent", "Java/1.8.0"); + httpConnection.setRequestProperty("Host", "\"192.168.1.5:49153"); + httpConnection.setRequestProperty("Accept", "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"); String reqXML = "0\n"; diff --git a/version2/src/java/light_fan_benchmark/WemoController.java b/version2/src/java/light_fan_benchmark/WemoController.java new file mode 100644 index 0000000..16db7ae --- /dev/null +++ b/version2/src/java/light_fan_benchmark/WemoController.java @@ -0,0 +1,9 @@ +class WemoController { + public static void main(String[] args) throws Exception { + IoTDeviceAddress devAddr = new IoTDeviceAddress("192.168.1.5", 49153, 49153, false, false); + Wemo wemo = new Wemo(devAddr); + + wemo.turnOn(); + } + +} \ No newline at end of file diff --git a/version2/src/java/light_fan_benchmark/run3.bash b/version2/src/java/light_fan_benchmark/run3.bash new file mode 100755 index 0000000..4db8a37 --- /dev/null +++ b/version2/src/java/light_fan_benchmark/run3.bash @@ -0,0 +1,3 @@ +#!/bin/sh + +java -cp .:/Users/Ali/Desktop/iotcloud/version2/src/java/iotcloud/bin WemoController \ No newline at end of file