use of com.zsmartsystems.zigbee.zcl.clusters.general.ReportAttributesCommand in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeEndpoint method commandReceived.
/**
* Incoming command handler. The endpoint will process any commands addressed to this endpoint ID and pass o
* clusters and applications
*
* @param command the {@link ZclCommand} received
*/
public void commandReceived(ZclCommand command) {
if (!command.getSourceAddress().equals(getEndpointAddress())) {
return;
}
// Pass all commands received from this endpoint to any registered applications
synchronized (applications) {
for (ZigBeeApplication application : applications.values()) {
application.commandReceived(command);
}
}
// Get the cluster
ZclCluster cluster = getReceiveCluster(command.getClusterId(), command.getCommandDirection());
if (cluster == null) {
logger.debug("{}: Cluster {} not found for attribute response", getEndpointAddress(), command.getClusterId());
return;
}
if (command instanceof ReportAttributesCommand) {
ReportAttributesCommand attributeCommand = (ReportAttributesCommand) command;
// Pass the reports to the cluster
cluster.handleAttributeReport(attributeCommand.getReports());
return;
}
if (command instanceof ReadAttributesResponse) {
ReadAttributesResponse attributeCommand = (ReadAttributesResponse) command;
// Pass the reports to the cluster
cluster.handleAttributeStatus(attributeCommand.getRecords());
return;
}
// If this is a specific cluster command, pass the command to the cluster command handler
if (!command.isGenericCommand()) {
cluster.handleCommand(command);
}
}
use of com.zsmartsystems.zigbee.zcl.clusters.general.ReportAttributesCommand in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclGeneralCluster method reportAttributesCommand.
/**
* The Report Attributes Command
* <p>
* The report attributes command is used by a device to report the values of one or
* more of its attributes to another device, bound a priori. Individual clusters, defined
* elsewhere in the ZCL, define which attributes are to be reported and at what
* interval.
*
* @param reports {@link List<AttributeReport>} Reports
* @return the {@link Future<CommandResult>} command result future
*/
public Future<CommandResult> reportAttributesCommand(List<AttributeReport> reports) {
ReportAttributesCommand command = new ReportAttributesCommand();
// Set the fields
command.setReports(reports);
return send(command);
}
Aggregations