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.*;
@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;
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++){
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);
}
}
- //made by changwoo
+ // made by Changwoo
private void sleep(int multipleTime){
if(multipleTime<=0){
multipleTime=1;
public void newMessageAvailable(IoTZigbeeMessage _zm) {
- //made by changwoo
+ // made by Changwoo
if(_zm instanceof IoTZigbeeMessageZclZoneStatusChangeNotification){
IoTZigbeeMessageZclZoneStatusChangeNotification message = (IoTZigbeeMessageZclZoneStatusChangeNotification)_zm;
if(message.getSuccessOrFail()){
}
}//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) {