Testing Smartthings sensors with some adjustments for 4th benchmark
[iot2.git] / iotjava / iotruntime / zigbee / IoTZigbee.java
index bc58c47713e21cb0bd4950a3023c32bbce3cd5bf..a7729188d89fc7c685581e9b774e257278e8bfde 100644 (file)
@@ -95,6 +95,62 @@ public class IoTZigbee {
                }
        }
 
+       //made by changwoo
+       public void sendChangeSwtichRequest(int packetId, int clusterId, int profileId, int value, int deviceEndpoint) throws IOException {
+               String message = "type: zcl_change_switch_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 changwoo
+       public void sendBroadcastingRouteRecordRequest(int packetId) throws IOException {
+               String message = "type: zdo_broadcast_route_record_request\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               DatagramPacket sendPacket = new DatagramPacket(message.getBytes(), message.getBytes().length, InetAddress.getByName(strHostAddress), iDstPort);
+               socket.send(sendPacket);
+       }
+
+       //made by changwoo
+       public void sendEnrollmentResponse(int packetId, int clusterId, int profileId, int deviceEndpoint) throws IOException {
+               String message = "type: zcl_enrollment_response\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               message += "cluster_id: " + String.format("%04x", clusterId) + "\n";
+               message += "profile_id: " + String.format("%04x", profileId) + "\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 changwoo
+       public void sendWriteAttributesCommand(int packetId, int clusterId, int profileId, int deviceEndpoint) throws IOException {
+               String message = "type: zcl_write_attributes\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               message += "cluster_id: " + String.format("%04x", clusterId) + "\n";
+               message += "profile_id: " + String.format("%04x", profileId) + "\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 changwoo
+       public void sendManagementPermitJoiningRequest(int packetId, int clusterId, int deviceEndpoint) throws IOException {
+               String message = "type: management_permit_joining_request\n";
+               message += "packet_id: " + String.format("%04x", packetId) + "\n";
+               message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
+               message += "cluster_id: " + String.format("%04x", clusterId) + "\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);
+       }
 
        public void sendBindRequest(int packetId, int clusterId, int deviceEndpoint) throws IOException {
                String message = "type: zdo_bind_request\n";