Completing ZigbeeTest with doorlock test
[iot2.git] / benchmarks / other / DoorlockAndOutlet / ZigbeeTest_doorlock.java
index 20ff4f2..a27b954 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>();