From: rtrimana Date: Thu, 5 Jan 2017 22:07:39 +0000 (-0800) Subject: Adjustments to ZigbeeTest and Python files to use just 1 port for shooting Zigbee... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=commitdiff_plain;h=85b13ca883c45bad3d45e4bc978793b5656cd9f4;hp=3ce0924a2451b4f2573c390f99cadf8d307977bd Adjustments to ZigbeeTest and Python files to use just 1 port for shooting Zigbee protocol rules --- diff --git a/benchmarks/other/ZigbeeTest/ZigbeeTest_motion.java b/benchmarks/other/ZigbeeTest/ZigbeeTest_motion.java index e62301f..832e0be 100644 --- a/benchmarks/other/ZigbeeTest/ZigbeeTest_motion.java +++ b/benchmarks/other/ZigbeeTest/ZigbeeTest_motion.java @@ -30,10 +30,13 @@ public class ZigbeeTest_motion implements SmartthingsSensorCallback { message += "port: " + "5956\n"; // port number message += "device_address_long: " + DEVIDE_MAC_ADDRESS + "\n"; DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName("192.168.2.227"), 5005); // address and port of the gateway which means Raspberry PI's IP address - DatagramSocket socket = new DatagramSocket(11222); + //DatagramSocket socket = new DatagramSocket(11222); + DatagramSocket socket = new DatagramSocket(12345); socket.setSendBufferSize(4096); socket.setReceiveBufferSize(4096); socket.send(sendPacket); + socket.setReuseAddress(true); + socket.close(); IoTDeviceAddress zigUdpAddr = new IoTDeviceAddress("192.168.2.227", 5956, 5005,false,false); IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS); diff --git a/benchmarks/other/ZigbeeTest/ZigbeeTest_multipurpose.java b/benchmarks/other/ZigbeeTest/ZigbeeTest_multipurpose.java index a9298cd..8265f6b 100644 --- a/benchmarks/other/ZigbeeTest/ZigbeeTest_multipurpose.java +++ b/benchmarks/other/ZigbeeTest/ZigbeeTest_multipurpose.java @@ -28,10 +28,13 @@ public class ZigbeeTest_multipurpose implements SmartthingsSensorCallback { message += "port: " + "5957\n"; // port number message += "device_address_long: " + DEVIDE_MAC_ADDRESS + "\n"; DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName("192.168.2.227"), 5005); - DatagramSocket socket = new DatagramSocket(11111); + //DatagramSocket socket = new DatagramSocket(11111); + DatagramSocket socket = new DatagramSocket(12345); socket.setSendBufferSize(4096); socket.setReceiveBufferSize(4096); socket.send(sendPacket); + socket.setReuseAddress(true); + socket.close(); IoTDeviceAddress zigUdpAddr = new IoTDeviceAddress("192.168.2.227", 5957, 5005,false,false); IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS); diff --git a/benchmarks/other/ZigbeeTest/ZigbeeTest_waterleak.java b/benchmarks/other/ZigbeeTest/ZigbeeTest_waterleak.java index 1bd5524..856fe20 100644 --- a/benchmarks/other/ZigbeeTest/ZigbeeTest_waterleak.java +++ b/benchmarks/other/ZigbeeTest/ZigbeeTest_waterleak.java @@ -29,10 +29,13 @@ public class ZigbeeTest_waterleak implements SmartthingsSensorCallback { message += "port: " + PORT_NUMBER + "\n"; // port number message += "device_address_long: " + DEVIDE_MAC_ADDRESS + "\n"; DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName("192.168.2.227"), 5005); // address and port of the gateway which means Raspberry PI's IP address - DatagramSocket socket = new DatagramSocket(22222); + //DatagramSocket socket = new DatagramSocket(22222); + DatagramSocket socket = new DatagramSocket(12345); socket.setSendBufferSize(4096); socket.setReceiveBufferSize(4096); socket.send(sendPacket); + socket.setReuseAddress(true); + socket.close(); IoTDeviceAddress zigUdpAddr = new IoTDeviceAddress("192.168.2.227", PORT_NUMBER, 5005,false,false); IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS); diff --git a/iotjava/Makefile b/iotjava/Makefile index c90044f..a0a67f1 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -178,7 +178,7 @@ 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 ../sslkey/*.jks $(BIN_DIR)/iotruntime/ + cp ../others/sslkey/*.jks $(BIN_DIR)/iotruntime/ cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/ PHONY += doc diff --git a/iotjava/iotruntime/master/ZigbeeConfig.java b/iotjava/iotruntime/master/ZigbeeConfig.java index 3ded618..7bf6f3e 100644 --- a/iotjava/iotruntime/master/ZigbeeConfig.java +++ b/iotjava/iotruntime/master/ZigbeeConfig.java @@ -101,7 +101,8 @@ public final class ZigbeeConfig { * * @return void */ - public void closeConnection() { + public void closeConnection() throws IOException { + socket.setReuseAddress(true); socket.close(); } } diff --git a/others/sslkey/192.168.2.108.jks b/others/sslkey/192.168.2.108.jks new file mode 100644 index 0000000..382855a Binary files /dev/null and b/others/sslkey/192.168.2.108.jks differ diff --git a/others/sslkey/192.168.2.191.jks b/others/sslkey/192.168.2.191.jks new file mode 100644 index 0000000..24c90ac Binary files /dev/null and b/others/sslkey/192.168.2.191.jks differ diff --git a/others/sslkey/192.168.2.192.jks b/others/sslkey/192.168.2.192.jks new file mode 100644 index 0000000..f231763 Binary files /dev/null and b/others/sslkey/192.168.2.192.jks differ diff --git a/others/sslkey/192.168.2.244.jks b/others/sslkey/192.168.2.244.jks new file mode 100644 index 0000000..120bdfe Binary files /dev/null and b/others/sslkey/192.168.2.244.jks differ