Additional files and methods for doorlock functionalities
authorrtrimana <rtrimana@uci.edu>
Wed, 21 Jun 2017 17:15:58 +0000 (10:15 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 21 Jun 2017 17:15:58 +0000 (10:15 -0700)
iotjava/iotruntime/zigbee/IoTZigbee.java
iotjava/iotruntime/zigbee/IoTZigbeeMessageZclChangeSwitchResponse.java [new file with mode: 0644]

index 593e9d3..a047be5 100644 (file)
@@ -23,7 +23,7 @@ import iotruntime.slave.IoTDeviceAddress;
 
 /** Class IoTZigbee
  *
- * @author      Ali Younis <ayounis @ uci.edu>
+ * @author      Ali Younis <ayounis @ uci.edu>, Changwoo Lee, Jiawei Gu
  * @version     1.0
  * @since       2016-04-12
  */
@@ -108,6 +108,34 @@ public final class IoTZigbee {
                socket.send(sendPacket);
        }
 
+       //made by Jiawei
+       public void sendLockOrUnlockDoorRequest(int packetId, int clusterId, int profileId, int deviceEndpoint, int value) throws IOException {
+               String message = "type: zcl_lock_or_unlock_door_request\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "value: " + String.format("%01x", value) + "\n";
+               message += "cluster_id: " + String.format("%04x", clusterId) + "\n";
+               message += "profile_id: " + String.format("%04x", profileId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               message += "device_endpoint: " + String.format("%02x", deviceEndpoint) + "\n";
+               DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName(strHostAddress), iDstPort);
+               socket.send(sendPacket);
+       }
+
+       //made by Jiawei
+       public void sendReadDoorStatusRequest(int packetId, int clusterId, int profileId, int deviceEndpoint, int framecontrol, int commandframe, int attribute_id) throws IOException {
+               String message = "type: zcl_read_door_status_request\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "framecontrol: " + String.format("%02x", framecontrol) + "\n";
+               message += "cluster_id: " + String.format("%04x", clusterId) + "\n";
+               message += "profile_id: " + String.format("%04x", profileId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               message += "device_endpoint: " + String.format("%02x", deviceEndpoint) + "\n";
+               message += "commandframe: " + String.format("%02x", commandframe) + "\n";
+               message += "attribute_id: " + String.format("%04x", attribute_id) + "\n";
+               DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName(strHostAddress), iDstPort);
+               socket.send(sendPacket);
+       }
+
        //made by changwoo
        public void sendBroadcastingRouteRecordRequest(int packetId) throws IOException {
                String message = "type: zdo_broadcast_route_record_request\n";
diff --git a/iotjava/iotruntime/zigbee/IoTZigbeeMessageZclChangeSwitchResponse.java b/iotjava/iotruntime/zigbee/IoTZigbeeMessageZclChangeSwitchResponse.java
new file mode 100644 (file)
index 0000000..89005b9
--- /dev/null
@@ -0,0 +1,39 @@
+package iotruntime.zigbee;
+
+/** Zigbee Message Zcl Change Switch Response
+ *
+ * @author      Yuting Tan <ytan5 @ uci.edu>
+ * @version     1.0
+ * @since       2017-2-28
+ */
+public class IoTZigbeeMessageZclChangeSwitchResponse extends IoTZigbeeMessage {
+
+       private boolean SuccessOrFail=false;
+       private int clusterId;
+       private int profileId;
+       private int status;
+
+       public IoTZigbeeMessageZclChangeSwitchResponse(int _packetId, int _clusterId, int _profileId, int _status, boolean _SuccessOrFail){
+               super(_packetId);
+
+               clusterId = _clusterId;
+               profileId = _profileId;
+               status = _status;
+               SuccessOrFail = _SuccessOrFail;
+       }
+       public boolean getSuccessOrFail(){
+               return SuccessOrFail;
+       }
+
+       public int getClusterId() {
+               return clusterId;
+       }
+
+       public int getProfileId() {
+               return profileId;
+       }
+
+       public int getStatus(){
+               return status;
+       }
+}