Cleaning up benchmarks and drivers code.
[iot2.git] / benchmarks / drivers / Java / WaterLeakSensor / WaterLeakSensor.java
index 7a28cbe8c6a6df49de5a4d7dfc644e93d1cdf0bf..ec8c5e17c31cffb98f7ab8bbfd5590c8ac08db8b 100644 (file)
@@ -6,11 +6,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Semaphore;
 
-// Checker annotations
-//import iotchecker.qual.*;
-import iotcode.annotation.*;
-
 // IoT Packages
+import iotcode.annotation.*;
 import iotruntime.slave.*;
 import iotcode.interfaces.*;
 import iotruntime.zigbee.*;
@@ -45,6 +42,7 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
        @config private IoTSet<IoTDeviceAddress> waterleakSensorUdpAddress;
        @config private IoTSet<IoTZigbeeAddress> waterleakSensorZigbeeAddress;
 
+       // TODO: Test constructor
        //public WaterLeakSensor(IoTSet<IoTDeviceAddress> dSet, IoTSet<IoTZigbeeAddress> zigSet) {
                //waterleakSensorUdpAddress = dSet;
                //waterleakSensorZigbeeAddress = zigSet;
@@ -83,7 +81,7 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
                        zigConnection.init();
                        System.out.println("Initialized!");
 
-                       //made by changwoo
+                       // made by Changwoo
                        sleep(10);
                        System.out.println("Sending Management Permit Joining Request");
                        for(int z=0; z<3; z++){
@@ -91,14 +89,14 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
                                sleep(0);
                        }
 
-                       //made by changwoo
+                       // made by Changwoo
                        while (!didWriteAttrb.get()) {
                                System.out.println("Sending Write Attribute Request");
                                zigConnection.sendWriteAttributesCommand(0x0002, 0x0500, 0x0104, 0x01);
                                sleep(0);
                        }
 
-                       //made by changwoo
+                       // made by Changwoo
                        System.out.println("Sending Enrollment Reponse");
                        zigConnection.sendEnrollmentResponse(0x0003, 0x0500, 0x0104, 0x01);
                        sleep(0);
@@ -108,7 +106,7 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
                }
        }
 
-       //made by changwoo
+       // made by Changwoo
        private void sleep(int multipleTime){
                if(multipleTime<=0){
                        multipleTime=1;
@@ -201,7 +199,7 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
 
        public void newMessageAvailable(IoTZigbeeMessage _zm) {
 
-               //made by changwoo
+               // made by Changwoo
                if(_zm instanceof IoTZigbeeMessageZclZoneStatusChangeNotification){
                        IoTZigbeeMessageZclZoneStatusChangeNotification message = (IoTZigbeeMessageZclZoneStatusChangeNotification)_zm;
                        if(message.getSuccessOrFail()){
@@ -224,14 +222,14 @@ public class WaterLeakSensor implements IoTZigbeeCallback, SmartthingsSensor {
                                }
                        }//if
                
-               //made by changwoo
-               }//if
+               // made by Changwoo
+               }
                else if (_zm instanceof IoTZigbeeMessageZclWriteAttributesResponse) {
                        IoTZigbeeMessageZclWriteAttributesResponse message = (IoTZigbeeMessageZclWriteAttributesResponse)_zm;
                        if (message.getSuccessOrFail()) {
                                didWriteAttrb.set(true);
                        }//if
-               }//else if
+               }
        }
 
        public void registerCallback(SmartthingsSensorSmartCallback _callbackTo) {