Making classes final to make inheritance impossible
[iot2.git] / iotjava / iotruntime / zigbee / IoTZigbee.java
index a7729188d89fc7c685581e9b774e257278e8bfde..593e9d31db84cc6d9194f3c1df7b86e4ec696fdd 100644 (file)
@@ -27,7 +27,7 @@ import iotruntime.slave.IoTDeviceAddress;
  * @version     1.0
  * @since       2016-04-12
  */
-public class IoTZigbee {
+public final class IoTZigbee {
 
        public final int SOCKET_SEND_BUFFER_SIZE = 1024;
        public final int SOCKET_RECEIVE_BUFFER_SIZE = 1024;
@@ -287,7 +287,28 @@ public class IoTZigbee {
                                } else {
                                        IoTZigbeeMessage callbackMessage = null;
 
-                                       if (packetData.get("type").equals("zcl_read_attributes_response")) {
+                                       //made by changwoo
+                                       if (packetData.get("type").equals("zcl_zone_status_change_notification")){
+                                               int packetId = Integer.parseInt(packetData.get("packet_id"), 16);
+                                               int clusterId = Integer.parseInt(packetData.get("cluster_id"), 16);
+                                               int profileId = Integer.parseInt(packetData.get("profile_id"), 16);
+                                               int status = Integer.parseInt(packetData.get("status"), 10);
+                                               boolean successOrFail = false;
+                                               if(packetData.get("attributes").equals("success")) successOrFail=true;
+                                               callbackMessage = new IoTZigbeeMessageZclZoneStatusChangeNotification(packetId, clusterId, profileId, status, successOrFail);
+
+                                       //made by changwoo
+                                       } else if (packetData.get("type").equals("zcl_write_attributes_response")) {
+
+                                               int packetId = Integer.parseInt(packetData.get("packet_id"), 16);
+                                               int clusterId = Integer.parseInt(packetData.get("cluster_id"), 16);
+                                               int profileId = Integer.parseInt(packetData.get("profile_id"), 16);
+                                               boolean successOrFail = false;
+                                               if(packetData.get("attributes").equals("success")) successOrFail=true;
+                                               
+                                               callbackMessage = new IoTZigbeeMessageZclWriteAttributesResponse(packetId, clusterId, profileId, successOrFail);
+
+                                       } else if (packetData.get("type").equals("zcl_read_attributes_response")) {
                                                int packetId = Integer.parseInt(packetData.get("packet_id"), 16);
                                                int clusterId = Integer.parseInt(packetData.get("cluster_id"), 16);
                                                int profileId = Integer.parseInt(packetData.get("profile_id"), 16);