Completing ZigbeeTest with doorlock test
[iot2.git] / benchmarks / other / ZigbeeTest / ZigbeeTest_waterleak.java
index 1bd5524..11dbb30 100644 (file)
@@ -12,7 +12,7 @@ import java.rmi.RemoteException;
 public class ZigbeeTest_waterleak implements SmartthingsSensorCallback {
     public final int SOCKET_SEND_BUFFER_SIZE = 1024;
     public final int SOCKET_RECEIVE_BUFFER_SIZE = 1024;
 public class ZigbeeTest_waterleak implements SmartthingsSensorCallback {
     public final int SOCKET_SEND_BUFFER_SIZE = 1024;
     public final int SOCKET_RECEIVE_BUFFER_SIZE = 1024;
-    private static final String MY_IP_ADDRESS = "192.168.2.108";
+    private static final String MY_IP_ADDRESS = "192.168.1.198";
     private static final int PORT_NUMBER = 5959;
     public static final String DEVIDE_MAC_ADDRESS = "000d6f000ada75e3"; //water leak
 
     private static final int PORT_NUMBER = 5959;
     public static final String DEVIDE_MAC_ADDRESS = "000d6f000ada75e3"; //water leak
 
@@ -28,13 +28,17 @@ public class ZigbeeTest_waterleak implements SmartthingsSensorCallback {
         message += "ip_address: " + MY_IP_ADDRESS + "\n"; // local ip address
         message += "port: " + PORT_NUMBER + "\n";  // port number
         message += "device_address_long: " + DEVIDE_MAC_ADDRESS + "\n";
         message += "ip_address: " + MY_IP_ADDRESS + "\n"; // local ip address
         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);
+        DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName("192.168.1.192"), 5005); // address and port of the gateway which means Raspberry PI's IP address
+        //DatagramSocket socket = new DatagramSocket(22222);
+        DatagramSocket socket = new DatagramSocket(12345);
         socket.setSendBufferSize(4096);
         socket.setReceiveBufferSize(4096);
         socket.send(sendPacket);
         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);
+        //IoTDeviceAddress zigUdpAddr  = new IoTDeviceAddress("192.168.2.227", PORT_NUMBER, 5005,false,false);
+        IoTDeviceAddress zigUdpAddr  = new IoTDeviceAddress("192.168.1.192", PORT_NUMBER, 5005,false,false);
         IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS);
 
         Set<IoTZigbeeAddress> zigSet = new HashSet<IoTZigbeeAddress>();
         IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS);
 
         Set<IoTZigbeeAddress> zigSet = new HashSet<IoTZigbeeAddress>();