Completing ZigbeeTest with doorlock test
[iot2.git] / benchmarks / other / DoorlockAndOutlet / ZigbeeTest_doorlock.java
index 20ff4f2f791cd47683f0e326150cf426f2d77bd2..a27b9541e3af151b82083c04f3aff86cb03cb32c 100644 (file)
@@ -13,28 +13,30 @@ import java.rmi.RemoteException;
 public class ZigbeeTest_doorlock 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 = "127.0.0.1";
+    private static final String MY_IP_ADDRESS = "192.168.1.198";
     public static final String DEVIDE_MAC_ADDRESS = "002446fffd00b0ba"; //doorlock sensor
 
-    public void newReadingAvailable(SmartthingsSensor _sensor) {
-       //public void newReadingAvailable(SmartthingsSensor _sensor) throws RemoteException {
-        System.out.println("New Message!!!!");
-        int status = ((DoorlockSensor)_sensor).getStatus();
-        switch (status) {
-            case 0:
-                System.out.println("Not fully locked");
-                break;
-            case 1:
-                System.out.println("Locked");
-                break;
-            case 2:
-                System.out.println("Unlocked");
-                break;
-            default:
-                System.out.println("Unknown value: " + status);
-                break;
-        }
-    }
+    //public void newReadingAvailable(SmartthingsSensor _sensor) {
+       public void newReadingAvailable(int _value, boolean _activeValue) {
+
+               System.out.println("New Message!!!!");
+               //int status = ((DoorlockSensor)_sensor).getStatus();
+               int status = _value;
+               switch (status) {
+                       case 0:
+                               System.out.println("Not fully locked");
+                               break;
+                       case 1:
+                               System.out.println("Locked");
+                               break;
+                       case 2:
+                               System.out.println("Unlocked");
+                               break;
+                       default:
+                               System.out.println("Unknown value: " + status);
+                               break;
+               }
+       }
 
     public static void main(String[] args) throws UnknownHostException, SocketException, InterruptedException, IOException, IOException, RemoteException{
 
@@ -50,7 +52,7 @@ public class ZigbeeTest_doorlock implements SmartthingsSensorCallback {
         socket.setReuseAddress(true);
         socket.close();
 
-        IoTDeviceAddress zigUdpAddr  = new IoTDeviceAddress("127.0.0.1", 5959, 5005,false,false);
+        IoTDeviceAddress zigUdpAddr  = new IoTDeviceAddress("192.168.1.192", 5959, 5005,false,false);
         IoTZigbeeAddress zigAddrLong = new IoTZigbeeAddress(DEVIDE_MAC_ADDRESS);
 
         Set<IoTZigbeeAddress> zigSet = new HashSet<IoTZigbeeAddress>();