Checking in working pysniffer on a RaspberryPi3 (part of IoTSec, a research system...
[iot2.git] / benchmarks / drivers / Java / DlinkAlarm / DlinkAlarm.java
index 6b0ee185b2c024dfd1d3bdf6e769afe27d66037e..c1232b9b1062180d5c2aa0e7a7b92b7df1a77660 100644 (file)
@@ -100,6 +100,10 @@ public class DlinkAlarm implements Alarm {
         
         // We don't use zone at this point (for this alarm there is only 1 zone and 1 alarm)
 
+        // Send login request first
+        sendLoginRequest();
+        // Send login info (challenge and HMAC encrypted message)
+        sendLoginInfo();
         // True means on
         if (_onOff) {
             if ((_onDurationSeconds == -1) || (_onDurationSeconds > 86400)) {
@@ -169,10 +173,6 @@ public class DlinkAlarm implements Alarm {
                           "\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>";
             // End!
             end = "</soap:Body></soap:Envelope>\r\n";
-            // Send login request first
-            sendLoginRequest();
-            // Send login info (challenge and HMAC encrypted message)
-            sendLoginInfo();
                } catch (Exception e) {
                        e.printStackTrace();
                }
@@ -454,27 +454,6 @@ public class DlinkAlarm implements Alarm {
         // Return time since January 1, 1970 00:00:00 UTC in seconds
         return System.currentTimeMillis()/1000;
     }
-    
-    /*public static void main(String[] args) throws Exception {
-
-        String ipAddress = "192.168.1.183";
-        String devicePin = "215530";
-        IoTDeviceAddress iotAddress = new IoTDeviceAddress(ipAddress, 12345, 80, false, false);
-        Set<IoTDeviceAddress> setAddress = new HashSet<IoTDeviceAddress>();
-        setAddress.add(iotAddress);
-        IoTSet<IoTDeviceAddress> iotSetAddress = new IoTSet<IoTDeviceAddress>(setAddress);
-        
-        DlinkAlarm alarm = new DlinkAlarm(iotSetAddress, devicePin);
-        alarm.init();
-        // Set alarm
-        alarm.setZone(0, true, -1);
-        // Set alarm
-        alarm.setZone(0, false, 0);
-        // Set alarm
-        alarm.setZone(0, true, -1);
-        // Set alarm
-        alarm.setZone(0, false, 0);
-    }*/
 }