private final int iSrcPort;
private final int iDstPort;
private DatagramSocket socket; // the socket interface that we are guarding
- private boolean didClose; // make sure that the clean up was done correctly
+ private boolean didClose; // make sure that the clean up was done correctly
private final IoTZigbeeAddress zigbeeAddress;
}
}
- //made by changwoo
+ // Created 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";
socket.send(sendPacket);
}
- //made by Jiawei
+ // Created 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";
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 {
+ // Created 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";
socket.send(sendPacket);
}
- //made by changwoo
+ // Created 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";
socket.send(sendPacket);
}
- //made by changwoo
+ // Created 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";
socket.send(sendPacket);
}
- //made by changwoo
+ // Created 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";
socket.send(sendPacket);
}
- //made by changwoo
+ // Created 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";
socket.send(sendPacket);
}
- public void sendConfigureReportingCommand(int packetId, int clusterId, int profileId, int src_endpoint, int dest_endpoint, int attributeId, int dataType, int minReportingInterval, int maxReportingInterval, byte[] reportableChange) throws IOException {
+ public void sendConfigureReportingCommand(int packetId, int clusterId, int profileId, int src_endpoint, int dest_endpoint,
+ int attributeId, int dataType, int minReportingInterval, int maxReportingInterval, byte[] reportableChange) throws IOException {
String message = "type: zcl_configure_reporting\n";
message += "packet_id: " + String.format("%04x", packetId) + "\n";
message += "device_address_long: " + zigbeeAddress.getAddress() + "\n";
socket.send(sendPacket);
}
- public void sendConfigureReportingCommand(int packetId, int clusterId, int profileId, int dest_endpoint, int attributeId, int dataType, int minReportingInterval, int maxReportingInterval, byte[] reportableChange) throws IOException {
- sendConfigureReportingCommand(packetId, clusterId, profileId, 0x00, dest_endpoint, attributeId, dataType, minReportingInterval, maxReportingInterval, reportableChange);
+ public void sendConfigureReportingCommand(int packetId, int clusterId, int profileId, int dest_endpoint, int attributeId, int dataType,
+ int minReportingInterval, int maxReportingInterval, byte[] reportableChange) throws IOException {
+ sendConfigureReportingCommand(packetId, clusterId, profileId, 0x00, dest_endpoint, attributeId, dataType, minReportingInterval,
+ maxReportingInterval, reportableChange);
}
public void registerCallback(IoTZigbeeCallback callbackTo) {
} else {
IoTZigbeeMessage callbackMessage = null;
- //made by changwoo
+ // Created 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);
if(packetData.get("attributes").equals("success")) successOrFail=true;
callbackMessage = new IoTZigbeeMessageZclZoneStatusChangeNotification(packetId, clusterId, profileId, status, successOrFail);
- //made by changwoo
+ // Created 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);
- List<IoTZigbeeMessageZclReadAttributesResponse.Attribute> attrList = new ArrayList<IoTZigbeeMessageZclReadAttributesResponse.Attribute>();
+ List<IoTZigbeeMessageZclReadAttributesResponse.Attribute> attrList = new
+ ArrayList<IoTZigbeeMessageZclReadAttributesResponse.Attribute>();
String[] attributes = packetData.get("attributes").split(";");
for (String attr : attributes) {
parts[0] = parts[0].trim();
parts[1] = parts[1].trim();
- IoTZigbeeMessageZclReadAttributesResponse.Attribute at = new IoTZigbeeMessageZclReadAttributesResponse.Attribute(Integer.parseInt(parts[0], 16), 0, false, null);
+ IoTZigbeeMessageZclReadAttributesResponse.Attribute at = new
+ IoTZigbeeMessageZclReadAttributesResponse.Attribute(Integer.parseInt(parts[0], 16), 0, false, null);
attrList.add(at);
} else {
parts[0] = parts[0].trim();
parts[1] = parts[1].trim();
parts[2] = parts[2].trim();
parts[3] = parts[3].trim();
- IoTZigbeeMessageZclReadAttributesResponse.Attribute at = new IoTZigbeeMessageZclReadAttributesResponse.Attribute(Integer.parseInt(parts[0], 16), Integer.parseInt(parts[1], 16), true, hexStringToByteArray(parts[3]));
+ IoTZigbeeMessageZclReadAttributesResponse.Attribute at = new
+ IoTZigbeeMessageZclReadAttributesResponse.Attribute(Integer.parseInt(parts[0], 16),
+ Integer.parseInt(parts[1], 16), true, hexStringToByteArray(parts[3]));
attrList.add(at);
}
}
if (packetData.get("attributes").equals("all_success")) {
callbackMessage = new IoTZigbeeMessageZclConfigureReportingResponse(packetId, clusterId, profileId, true, null);
} else {
- List<IoTZigbeeMessageZclConfigureReportingResponse.Attribute> attrList = new ArrayList<IoTZigbeeMessageZclConfigureReportingResponse.Attribute>();
+ List<IoTZigbeeMessageZclConfigureReportingResponse.Attribute> attrList = new
+ ArrayList<IoTZigbeeMessageZclConfigureReportingResponse.Attribute>();
String[] attributes = packetData.get("attributes").split(";");
for (String attr : attributes) {
parts[0] = parts[0].trim();
parts[1] = parts[1].trim();
parts[2] = parts[2].trim();
- IoTZigbeeMessageZclConfigureReportingResponse.Attribute at = new IoTZigbeeMessageZclConfigureReportingResponse.Attribute(Integer.parseInt(parts[0], 16), parts[1].equals("success"), parts[2].equals("reported"));
+ IoTZigbeeMessageZclConfigureReportingResponse.Attribute at = new
+ IoTZigbeeMessageZclConfigureReportingResponse.Attribute(Integer.parseInt(parts[0], 16),
+ parts[1].equals("success"), parts[2].equals("reported"));
attrList.add(at);
}
callbackMessage = new IoTZigbeeMessageZclConfigureReportingResponse(packetId, clusterId, profileId, false, attrList);
parts[0] = parts[0].trim();
parts[1] = parts[1].trim();
parts[2] = parts[2].trim();
- IoTZigbeeMessageZclReportAttributes.Attribute at = new IoTZigbeeMessageZclReportAttributes.Attribute(Integer.parseInt(parts[0], 16), Integer.parseInt(parts[1], 16), hexStringToByteArray(parts[2]));
+ IoTZigbeeMessageZclReportAttributes.Attribute at = new
+ IoTZigbeeMessageZclReportAttributes.Attribute(Integer.parseInt(parts[0], 16),
+ Integer.parseInt(parts[1], 16), hexStringToByteArray(parts[2]));
attrList.add(at);
}
}
}
-
-
} catch (Exception e) {
e.printStackTrace();
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-